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

# Deepgram

> Use the Deepgram text-to-speech plugin in a Zero Runtime pipeline. Setup, options, and usage.

Deepgram is a **text-to-speech** plugin. It synthesizes the LLM's reply into the agent's
voice over a streaming WebSocket using Deepgram's Aura voices. It occupies the pipeline's
`tts` slot.

<Note>
  Deepgram is also available as a [speech-to-text](/plugins/stt/deepgram) plugin.
</Note>

## Setup

Set your Deepgram API key in the worker environment. Generate a key from the [Deepgram console](https://console.deepgram.com/):

```bash theme={null}
export DEEPGRAM_API_KEY=<key>
```

## Usage

Import the plugin and pass it to the pipeline's `tts` slot.

<CodeGroup>
  ```python Python theme={null}
  from zeroruntime.plugins import DeepgramTTS

  tts = DeepgramTTS(
      model="aura-2-andromeda-en",
  )

  # Pipeline(tts=tts, ...)
  ```

  ```typescript Node JS theme={null}
  import { DeepgramTTS } from '@zeroruntime/js-sdk/plugins';

  const tts = DeepgramTTS({
    model: 'aura-2-andromeda-en',
  });

  // Pipeline({ tts, ... })
  ```
</CodeGroup>

## Parameters

*Constructor parameters for `DeepgramTTS`. The Python and Node JS SDKs share these field names.*

| Parameter     | Type  | Default                             | Description                                                                             |
| ------------- | ----- | ----------------------------------- | --------------------------------------------------------------------------------------- |
| `api_key`     | `str` | `None`                              | Deepgram API key. Falls back to the `DEEPGRAM_API_KEY` environment variable when unset. |
| `model`       | `str` | `"aura-2-andromeda-en"`             | Deepgram Aura voice/model ID.                                                           |
| `encoding`    | `str` | `"linear16"`                        | Output audio encoding.                                                                  |
| `sample_rate` | `int` | `24000`                             | Output sample rate (Hz).                                                                |
| `base_url`    | `str` | `"wss://api.deepgram.com/v1/speak"` | Deepgram streaming endpoint.                                                            |

## Import paths

| SDK     | Import                                                      | Constructor            |
| ------- | ----------------------------------------------------------- | ---------------------- |
| Python  | `from zeroruntime.plugins import DeepgramTTS`               | `DeepgramTTS(...)`     |
| Node JS | `import { DeepgramTTS } from '@zeroruntime/js-sdk/plugins'` | `DeepgramTTS({ ... })` |

The synthesized audio is streamed back to the caller as the final stage of the
[pipeline](/concepts/pipeline).
