> ## Documentation Index
> Fetch the complete documentation index at: https://anam.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Voice Detection

> Choose a speech-to-text provider and configure how your persona detects speech, handles silence, and manages turn-taking.

Choose how Anam transcribes user speech and configure how eagerly your persona responds via `voiceDetectionOptions` in the persona config.

```javascript theme={"system"}
const personaConfig = {
  name: "Cara",
  avatarId: "30fa96d0-26c4-4e55-94a0-517025942e18",
  avatarModel: "cara-4",
  voiceId: "6bfbe25a-979d-40f3-a92b-5394170af54b",
  llmId: "a7cf662c-2ace-4de1-a21e-ef0fbf144bb7",
  systemPrompt: "You are Cara, a helpful customer service representative.",
  languageCode: "en",
  voiceDetectionOptions: {
    sttProvider: "deepgram",
    endOfSpeechSensitivity: 0.5,
    silenceBeforeSkipTurnSeconds: 5,
    silenceBeforeSessionEndSeconds: 3,
    silenceBeforeAutoEndTurnSeconds: 5,
    speechEnhancementLevel: 0.8,
  },
};
```

## Choose a speech-to-text provider

In the Anam Lab, open your persona's **Advanced** settings and choose an **STT Provider** under **Voice Detection**. You can also set `voiceDetectionOptions.sttProvider` when you create or update a persona, or in an ephemeral `personaConfig` when requesting a session token.

| Value      | Behavior                                                                                                                                                               |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Unset      | Uses the platform default provider. In the Lab, select **Default**. Do not rely on this resolving to a particular provider.                                            |
| `anam`     | Uses Anam's speech-to-text provider. It supports every language available in the [transcription language selector](/docs/personas/voices/multilingual#supported-languages). |
| `deepgram` | Uses Deepgram. Supported `languageCode` values are `en`, `es`, `fr`, `de`, `hi`, `ru`, `pt`, `ja`, `it`, and `nl`.                                                     |

### Language compatibility

The STT provider and transcription language must be compatible:

* If you choose an explicit unsupported `languageCode`, the Lab disables the combination and the API rejects it.
* If `languageCode` is omitted, empty, `null`, or `inherit`, the persona uses your organization's default transcription language.
* The Lab evaluates **Inherit from org default** against the current organization default and marks incompatible provider or language options as unavailable.

<Warning>
  Set an explicit `languageCode` when you need to guarantee a specific STT provider. If your organization default changes to a language that the saved provider does not support, Anam ignores that provider selection for inherited-language sessions and uses the platform default provider instead. The session still starts, and the saved persona configuration is not changed.
</Warning>

To resolve an inherited-language mismatch, choose a supported language explicitly, select another provider, or contact [Anam support](mailto:support@anam.ai) to change your organization default. See [Multilingual Support](/docs/personas/voices/multilingual) for language configuration details.

<Note>
  `sttProvider` applies only to full-pipeline sessions and is selected when the session starts. It is not supported with audio passthrough or avatar-only transports, which do not run Anam speech-to-text, and it cannot be switched with a mid-session voice detection update.
</Note>

## Options

| Option                            | Range                | Default                  | Description                                                                                                                                                           |
| --------------------------------- | -------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sttProvider`                     | `anam` or `deepgram` | Unset (platform default) | Speech-to-text provider used to transcribe the user's speech.                                                                                                         |
| `endOfSpeechSensitivity`          | 0 – 1                | `0.5`                    | How eager the persona is to start speaking. 0 = waits until confident the user is done. 1 = responds earlier.                                                         |
| `silenceBeforeSkipTurnSeconds`    | 0 – 900 seconds      | `15` seconds             | How long the user can be silent before their turn is skipped and the persona prompts them. Set to `0` to disable turn skip so the persona never prompts a quiet user. |
| `silenceBeforeSessionEndSeconds`  | 0 – 7200 seconds     | `60` seconds             | How long the user can be silent before the session ends automatically. Set to `0` to disable automatic session end.                                                   |
| `silenceBeforeAutoEndTurnSeconds` | 0.5 – 10 seconds     | `5` seconds              | If the user starts speaking then stops, how long to wait before treating the turn as complete.                                                                        |
| `speechEnhancementLevel`          | 0 – 1                | `0.8`                    | Level of noise reduction and voice enhancement applied to input audio. Higher values improve transcription accuracy in noisy environments.                            |

<Note>
  Setting `silenceBeforeSkipTurnSeconds` to `0` disables turn skip — the persona will not prompt a quiet user. Setting `silenceBeforeSessionEndSeconds` to `0` disables automatic session end on silence.
</Note>

These settings can be set when creating or updating a persona. See the [API Reference](/docs/api-reference/personas/create-persona) for details.
