> ## 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 text-to-speech plugin.

## DeepgramTTS

Deepgram text-to-speech (TTS) provider.

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

### Constructor

```typescript theme={null}
new DeepgramTTS(opts: DeepgramTTSOptions)
```

<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="DeepgramTTSModel | string" default="aura-2-andromeda-en">
  Deepgram Aura voice/model id (e.g. `'aura-2-andromeda-en'`).
</ParamField>

<ParamField path="voice" type="string" default="model">
  Voice id to synthesize with. Defaults to the value of `model`.
</ParamField>

<ParamField path="language" type="string" default="en">
  Language code for synthesis (e.g. `'en'`).
</ParamField>

<ParamField path="sampleRate" type="number" default="24000">
  Output audio sample rate in Hz.
</ParamField>

<ParamField path="stream" type="boolean" default="true">
  Stream audio from the model.
</ParamField>

<ParamField path="encoding" type="string" default="linear16">
  Output audio encoding.
</ParamField>

<ParamField path="baseUrl" type="string" default="wss://api.deepgram.com/v1/speak">
  Deepgram Speak WebSocket endpoint.
</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>" />

### interrupt

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

Stop the current synthesis.

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

### onFirstAudioByte

```typescript theme={null}
onFirstAudioByte(callback: FirstAudioByteCallback): void
```

Register a callback fired when the first synthesized audio byte is emitted.

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

### removeAllListeners

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

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

### synthesize

```typescript theme={null}
synthesize(text: any, ..._extra: any[]): Promise<void>
```

Synthesize and speak `text` on the active session.

<ParamField path="text" type="any" required />

***

## DeepgramTTSModel

Supported Deepgram text-to-speech model names.

```typescript theme={null}
type DeepgramTTSModel = | 'aura-2-andromeda-en' | 'aura-2-thalia-en' | 'aura-2-asteria-en' | 'aura-2-luna-en' | 'aura-2-orion-en' | 'aura-2-arcas-en' | 'aura-2-zeus-en' | 'aura-2-hera-en' | 'aura-2-athena-en' | 'aura-2-apoll …
```
