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

# Elevenlabs

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

## ElevenLabsTTS

ElevenLabs text-to-speech (TTS) provider.

### Constructor

```typescript theme={null}
new ElevenLabsTTS(opts: ElevenLabsTTSOptions)
```

<ParamField path="apiKey" type="string">
  ElevenLabs API key. Falls back to the `ELEVENLABS_API_KEY` environment variable when omitted.
</ParamField>

<ParamField path="voice" type="string">
  Voice ID to synthesize with. Default `'21m00Tcm4TlvDq8ikWAM'`.
</ParamField>

<ParamField path="model" type="ElevenLabsTTSModel | string">
  ElevenLabs model ID. Default `'eleven_turbo_v2'`.
  Other common values include `'eleven_multilingual_v2'` and `'eleven_flash_v2'`.
</ParamField>

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

<ParamField path="stability" type="number">
  Voice consistency vs. expressiveness. Range 0-1. Default `0.5`.
</ParamField>

<ParamField path="similarityBoost" type="number">
  How closely the output matches the original voice. Range 0-1. Default `0.75`.
</ParamField>

<ParamField path="style" type="number">
  Style exaggeration. Range 0-1. Default `0.0`.
</ParamField>

<ParamField path="useSpeakerBoost" type="boolean">
  Boosts similarity to the original speaker. Default `true`.
</ParamField>

<ParamField path="applyTextNormalization" type="string | null">
  Text normalization mode (e.g. expanding numbers and abbreviations).
  Typical values: `'auto'`, `'on'`, `'off'`. Default `null` (provider default).
</ParamField>

<ParamField path="enableWordTimestamps" type="boolean">
  Request per-word timestamps alongside the audio. Default `false`.
</ParamField>

<ParamField path="speed" type="number | null">
  Speaking rate multiplier. Default `null` (provider default).
</ParamField>

<ParamField path="language" type="string | null">
  Language code hint for synthesis (e.g. `'en'`). Default `null` (auto).
</ParamField>

<ParamField path="enableSsmlParsing" type="boolean | null">
  Whether to parse SSML markup in the input text. Default `null` (provider default).
</ParamField>

<ParamField path="stream" type="boolean">
  Stream audio as it is generated rather than waiting for the full result. Default `true`.
</ParamField>

<ParamField path="voiceSettings" type="ElevenLabsVoiceSettings | null">
  Native ElevenLabs voice settings object. Used to populate voice parameters
  (`stability`, `similarityBoost`, `style`, `useSpeakerBoost`) only where the
  corresponding top-level option was left at its default. Default `null`.
</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 />

***

## ElevenLabsTTSModel

Supported ElevenLabs TTS model names.

```typescript theme={null}
type ElevenLabsTTSModel = 'eleven_v3' | 'eleven_multilingual_v2' | 'eleven_flash_v2_5' | 'eleven_flash_v2'
```

***

## ElevenLabsVoiceSettings

ElevenLabs voice settings, mirroring ElevenLabs' native `voice_settings` shape.

Provided as an alternative to the top-level ElevenLabsTTSOptions fields
(`stability`, `similarityBoost`, `style`, `useSpeakerBoost`). A value here is
only applied when the corresponding top-level option is left at its default.

### Fields

<ParamField path="stability" type="number | null">
  Voice consistency vs. expressiveness. Range 0-1. Lower is more varied/expressive.
</ParamField>

<ParamField path="similarity_boost" type="number | null">
  How closely the output matches the original voice. Range 0-1.
</ParamField>

<ParamField path="style" type="number | null">
  Style exaggeration. Range 0-1. Higher amplifies the speaker's style.
</ParamField>

<ParamField path="use_speaker_boost" type="boolean | null">
  Boosts similarity to the original speaker.
</ParamField>
