> ## 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

> JavaScript API reference for the deepgram speech-to-text plugin.

## DeepgramSTT

Deepgram speech-to-text (STT) provider.

Creates a configured Deepgram STT instance for use in a voice agent.

### Constructor

```typescript theme={null}
new DeepgramSTT(opts: DeepgramSTTOptions)
```

<ParamField path="apiKey" type="string | null">
  Deepgram API key. Falls back to the `DEEPGRAM_API_KEY` environment
  variable, then `null` if neither is set.
</ParamField>

<ParamField path="model" type="DeepgramSTTModel | string" default="nova-2">
  Deepgram recognition model (e.g. `'nova-2'`, `'nova-3'`, `'enhanced'`).
</ParamField>

<ParamField path="language" type="string" default="en-US">
  BCP-47 language code for transcription (e.g. `'en-US'`, `'es'`, `'fr'`).
</ParamField>

<ParamField path="interimResults" type="boolean" default="true">
  Emit partial (interim) transcript results before a segment is finalized.
</ParamField>

<ParamField path="punctuate" type="boolean" default="true">
  Add punctuation to transcripts.
</ParamField>

<ParamField path="smartFormat" type="boolean" default="true">
  Apply smart formatting (dates, times, currency, etc.) to transcripts.
</ParamField>

<ParamField path="sampleRate" type="number" default="48000">
  Audio sample rate in Hz. Note: this is fixed at 48000 and
  has no effect; non-48000 values are ignored.
</ParamField>

<ParamField path="endpointing" type="number" default="50">
  Silence duration in milliseconds used to detect end of speech (endpointing).
</ParamField>

<ParamField path="fillerWords" type="boolean" default="true">
  Include filler words (e.g. "uh", "um") in transcripts.
</ParamField>

<ParamField path="keywords" type="string[] | null" default="null">
  Keywords to boost recognition for, optionally with intensifiers
  (e.g. `'Deepgram:2'`). `null` to disable.
</ParamField>

<ParamField path="keyterm" type="string[] | null" default="null">
  Key terms to boost recognition for (newer keyterm prompting). `null` to disable.
</ParamField>

<ParamField path="profanityFilter" type="boolean" default="false">
  Remove profanity from transcripts.
</ParamField>

<ParamField path="numerals" type="boolean" default="false">
  Convert spoken numbers into numeric digits.
</ParamField>

<ParamField path="tag" type="string | string[] | null" default="null">
  Free-form tag(s) attached to the request for tracking/usage reporting.
  `null` to disable.
</ParamField>

<ParamField path="enableDiarization" type="boolean" default="false">
  Enable speaker diarization (label which speaker said what).
</ParamField>

<ParamField path="redact" type="string | string[] | null" default="null">
  Redaction categories to remove from transcripts (e.g. `'pci'`, `'ssn'`,
  `'numbers'`). `null` to disable.
</ParamField>

<ParamField path="baseUrl" type="string" default="wss://api.deepgram.com/v1/listen">
  Deepgram streaming endpoint URL.
</ParamField>

### close

```typescript theme={null}
close(): Promise<void>
```

Release any resources held by the provider.

### closeEmitter

```typescript theme={null}
closeEmitter(): Promise<void>
```

Close the emitter: drop all handlers and stop emitting. Waits up to 2 seconds
for in-flight async handlers to settle before returning.

### emit

```typescript theme={null}
emit(event: string, ...args: any[]): void
```

<ParamField path="event" type="string" required />

### getRuntimeConfig

```typescript theme={null}
getRuntimeConfig(): Record<string, any>
```

<ResponseField name="returns" type="Record<string, any>" />

### listenerCount

```typescript theme={null}
listenerCount(event: string): number
```

<ParamField path="event" type="string" required />

<ResponseField name="returns" type="number" />

### off

```typescript theme={null}
off(event: string, handler: EventHandler): void
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

### on

```typescript theme={null}
on(event: string, handler: EventHandler): EventHandler
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

<ResponseField name="returns" type="EventHandler" />

### once

```typescript theme={null}
once(event: string, handler: EventHandler): EventHandler
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

<ResponseField name="returns" type="EventHandler" />

### onSttTranscript

```typescript theme={null}
onSttTranscript(callback: SttTranscriptCallback): void
```

Register a callback to receive transcripts as they are produced.

<ParamField path="callback" type="SttTranscriptCallback" required />

### processAudio

```typescript theme={null}
processAudio(_audioFrames: Uint8Array, _language?: string | null, ..._extra: any[]): Promise<void>
```

Process a buffer of audio frames. Override in a custom provider.

### removeAllListeners

```typescript theme={null}
removeAllListeners(event?: string): void
```

<ParamField path="event" type="string" />

### streamTranscribe

```typescript theme={null}
streamTranscribe(_audioStream: AsyncIterable<Uint8Array>, ..._extra: any[]): AsyncIterator<STTResponse>
```

Transcribe a streaming audio source, yielding STTResponses. Override in a custom provider.

<ResponseField name="returns" type="AsyncIterator<STTResponse>" />

***

## DeepgramSTTModel

Supported Deepgram speech-to-text model names.

```typescript theme={null}
type DeepgramSTTModel = | 'nova-3' | 'nova-3-general' | 'nova-3-medical' | 'nova-2' | 'nova-2-general' | 'nova-2-phonecall' | 'nova-2-meeting' | 'nova-2-conversationalai' | 'nova-2-medical' | 'nova-2-finance' | 'nova-2-drive …
```
