# Deepgram (/en/ai/platform/models/tts/deepgram)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

> Documentation: Conversational AI.
> Documentation version: Preview.
> This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt).


Deepgram provides low-latency text-to-speech with a wide range of voices, optimized for real-time conversational AI applications.

## Sample configuration

The following example shows how to configure Deepgram as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent).

Deepgram supports BYOK only. It isn't available in managed mode. Store your Deepgram API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys).

**Python SDK**

```python
from agora_agent import Agent, DeepgramTTS, secret_ref

# client is your configured Agora client
agent = (
    Agent(client=client)
    .with_stt(...)  # configure your ASR vendor
    .with_llm(...)  # configure your LLM vendor
    .with_tts(
        DeepgramTTS(
            api_key=secret_ref("support_prod", "deepgram"),
            base_url="wss://api.deepgram.com/v1/speak",
            model="aura-2-thalia-en",
            sample_rate=24000,
        )
    )
)
```

**TypeScript SDK**

```ts
import { Agent, DeepgramTTS, secretRef } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(/* configure your ASR vendor */)
  .withLlm(/* configure your LLM vendor */)
  .withTts(
    new DeepgramTTS({
      apiKey: secretRef('support_prod', 'deepgram'),
      baseUrl: 'wss://api.deepgram.com/v1/speak',
      model: 'aura-2-thalia-en',
      sampleRate: 24000,
    }),
  );
```

**Go SDK**

```go
// client is your configured Agora client
sampleRate := vendors.SampleRate24kHz
agent := agentkit.NewAgent(client).
	WithStt( /* configure your ASR vendor */ ).
	WithLlm( /* configure your LLM vendor */ ).
	WithTts(vendors.NewDeepgramTTS(vendors.DeepgramTTSOptions{
		APIKey:     agentkit.SecretRef("support_prod", "deepgram"),
		BaseURL:    "wss://api.deepgram.com/v1/speak",
		Model:      "aura-2-thalia-en",
		SampleRate: &sampleRate,
	}))
```

**REST API**

Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Deepgram API key. In the following example, the key is stored as `deepgram` in the `support_prod` set:

```json
"tts": {
  "credential": {
    "mode": "byok",
    "fields": {
      "api_key": "$secrets.support_prod.deepgram"
    }
  },
  "vendor": "deepgram",
  "url": "wss://api.deepgram.com/v1/speak",
  "params": {
    "model": "aura-2-thalia-en",
    "sample_rate": 24000
  }
}
```

## Key parameters

The `tts` block takes the following fields. In the SDKs, `DeepgramTTS` sets them from its options.

**tts**

**`vendor` (string) required**

Set to `deepgram`.

**`credential` (object) required**

Set `mode` to `byok` and `fields.api_key` to a `$secrets.<set>.<key>` reference to your Deepgram API key. Get your API key from the [Deepgram Console](https://console.deepgram.com/).

**`url` (string) optional**

The WebSocket URL for the Deepgram streaming API. Defaults to `wss://api.deepgram.com/v1/speak`.

**`params` (object) required**

**`model` (string) required**

The identifier of the TTS model to use. See [Deepgram voices and languages](https://developers.deepgram.com/docs/tts-models).

**`sample_rate` (number) optional**

The audio sampling rate in Hz.

> **Caution**
>
> The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Deepgram without validation. For a full list of supported options, refer to the [Deepgram TTS documentation](https://developers.deepgram.com/docs/text-to-speech).

This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads.
