> ## 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 speech-to-text plugin in a Zero Runtime pipeline. Setup and usage in Python and JavaScript.

Deepgram is a **speech-to-text** plugin. It transcribes the caller's audio into text for
the LLM.

## 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 `stt` slot.

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

  stt = DeepgramSTT()

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

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

  const stt = DeepgramSTT();

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

## Parameters

*Constructor parameters for `DeepgramSTT`. 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`              | `"nova-2"`                           | Deepgram speech-to-text model.                                                          |
| `language`           | `str`              | `"en-US"`                            | Expected language (BCP-47 code) of the caller's speech.                                 |
| `interim_results`    | `bool`             | `True`                               | Emit partial transcripts while the caller is still speaking.                            |
| `punctuate`          | `bool`             | `True`                               | Add punctuation to transcripts.                                                         |
| `smart_format`       | `bool`             | `True`                               | Apply readable formatting to dates, numbers, and similar entities.                      |
| `sample_rate`        | `int`              | `48000`                              | Sample rate (Hz) of the input audio.                                                    |
| `endpointing`        | `int`              | `50`                                 | Milliseconds of silence before an utterance is finalized.                               |
| `filler_words`       | `bool`             | `True`                               | Keep filler words such as "uh" and "um" in transcripts.                                 |
| `keywords`           | `list[str]`        | `None`                               | Keywords to boost recognition for (legacy keyword boosting).                            |
| `keyterm`            | `list[str]`        | `None`                               | Key terms to boost (key-term prompting).                                                |
| `profanity_filter`   | `bool`             | `False`                              | Mask profanity in transcripts.                                                          |
| `numerals`           | `bool`             | `False`                              | Convert spoken numbers into digits.                                                     |
| `tag`                | `str \| list[str]` | `None`                               | Tags attached to the request for usage tracking.                                        |
| `enable_diarization` | `bool`             | `False`                              | Label which speaker said each word.                                                     |
| `base_url`           | `str`              | `"wss://api.deepgram.com/v1/listen"` | Deepgram streaming endpoint.                                                            |

## Import paths

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

Transcribed text passes to the [LLM](/plugins/llm/google) once
[turn detection](/plugins/turn-detection/namo) decides the caller has finished speaking.
