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

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

<Card title="Usage guide" icon="book" href="/plugins/tts/elevenlabs" horizontal>
  Setup, environment variables, and Python/JavaScript/Go usage examples.
</Card>

## ElevenLabsTTS

Expressive streaming text-to-speech via ElevenLabs.

Multilingual neural voices with fine-grained control over stability, similarity,
style and speaker boost.

### Constructor

```python theme={null}
ElevenLabsTTS(*, api_key: 'str | None' = None, voice: 'str' = '21m00Tcm4TlvDq8ikWAM', model: 'ElevenLabsTTSModel | str' = 'eleven_turbo_v2', sample_rate: 'int' = 24000, stability: 'float' = 0.5, similarity_boost: 'float' = 0.75, style: 'float' = 0.0, use_speaker_boost: 'bool' = True, apply_text_normalization: 'Optional[str]' = None, enable_word_timestamps: 'bool' = False, speed: 'Optional[float]' = None, language: 'Optional[str]' = None, enable_ssml_parsing: 'Optional[bool]' = None, stream: 'bool' = True, **kwargs)
```

<ParamField path="api_key" type="str | None">
  ElevenLabs API key. Falls back to `ELEVENLABS_API_KEY`.
</ParamField>

<ParamField path="voice" type="str" default="21m00Tcm4TlvDq8ikWAM">
  Voice id. Default `"21m00Tcm4TlvDq8ikWAM"` (the "Rachel" voice).
</ParamField>

<ParamField path="model" type="ElevenLabsTTSModel | str" default="eleven_turbo_v2">
  Synthesis model: `eleven_v3`, `eleven_multilingual_v2`, `eleven_flash_v2_5` or `eleven_flash_v2` (the Flash models are the lowest latency). Default `"eleven_turbo_v2"`.
</ParamField>

<ParamField path="sample_rate" type="int" default="24000">
  Output rate in Hz. Default 24000.
</ParamField>

<ParamField path="stability" type="float" default="0.5">
  Voice consistency, 0.0–1.0 (higher is steadier). Default 0.5.
</ParamField>

<ParamField path="similarity_boost" type="float" default="0.75">
  Adherence to the original voice, 0.0–1.0. Default 0.75.
</ParamField>

<ParamField path="style" type="float" default="0.0">
  Style exaggeration, 0.0–1.0 (0 disables, adds latency). Default 0.0.
</ParamField>

<ParamField path="use_speaker_boost" type="bool" default="True">
  Boost similarity to the speaker. Default True.
</ParamField>

<ParamField path="apply_text_normalization" type="Optional[str]">
  Normalization mode (`"auto"`/`"on"`/`"off"`).
</ParamField>

<ParamField path="enable_word_timestamps" type="bool" default="False">
  Return per-word timing metadata. Default False.
</ParamField>

<ParamField path="speed" type="Optional[float]">
  Speaking-rate multiplier (\~0.7–1.2). Default None (provider default).
</ParamField>

<ParamField path="language" type="Optional[str]">
  ISO-639-1 language hint for supported models.
</ParamField>

<ParamField path="enable_ssml_parsing" type="Optional[bool]">
  Interpret SSML tags in the input text.
</ParamField>

<ParamField path="stream" type="bool" default="True">
  Stream audio as it is synthesized. Default True.
</ParamField>

### aclose

```python theme={null}
def aclose(self) -> 'None'
```

Release any resources held by the provider.

### emit

```python theme={null}
def emit(self, event: 'T', *args: 'Any') -> 'None'
```

Emit an event, invoking all registered handlers with the given arguments.

Handlers are called in registration order. Coroutine handlers are
scheduled on the running event loop. If the emitter is closed, the call
is a no-op.

<ParamField path="event" type="T" required>
  The event to emit.
</ParamField>

### interrupt

```python theme={null}
def interrupt(self) -> 'None'
```

Interrupt and cancel the current synthesis for the active session, if any.

### off

```python theme={null}
def off(self, event: 'T', callback: 'Callable[..., Any]') -> 'None'
```

Remove a previously registered handler for an event.

If the handler is not registered for the event, the call is a no-op.

<ParamField path="event" type="T" required>
  The event the handler was registered for.
</ParamField>

<ParamField path="callback" type="Callable[..., Any]" required>
  The handler to remove.
</ParamField>

### on

```python theme={null}
def on(self, event: 'T', callback: 'Callable[..., Any] | None' = None) -> 'Callable[..., Any]'
```

Register a handler for an event.

Can be used directly by passing a callback, or as a decorator when
`callback` is omitted.

<ParamField path="event" type="T" required>
  The event to listen for.
</ParamField>

<ParamField path="callback" type="Callable[..., Any] | None">
  The handler to invoke when the event is emitted. If `None`, a decorator is returned that registers the decorated function.
</ParamField>

<ResponseField name="returns" type="Callable[..., Any]">
  The registered callback when `callback` is provided, otherwise a decorator that registers and returns the function it wraps.
</ResponseField>

### on\_first\_audio\_byte

```python theme={null}
def on_first_audio_byte(self, callback: "'Callable[[int, int], Awaitable[None] | None]'") -> 'None'
```

Register the callback invoked when the first audio byte is produced.

<ParamField path="callback" type="'Callable[[int, int], Awaitable[None] | None]'" required>
  A callable, optionally async, invoked with synthesis timing information when the first audio byte is emitted.
</ParamField>

### synthesize

```python theme={null}
def synthesize(self, text: 'Any', **kwargs: 'Any') -> 'None'
```

Synthesize the given text into speech.

Implementations should convert the text to audio. The default behavior
forwards the text to the active session for playback when one is present.

<ParamField path="text" type="Any" required>
  The text to synthesize; coerced to a string if needed.
</ParamField>

***

## ElevenLabsTTSModel

```python theme={null}
ElevenLabsTTSModel = typing.Literal['eleven_v3', 'eleven_multilingual_v2', 'eleven_flash_v2_5', 'eleven_flash_v2']
```
