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

> Use the ElevenLabs text-to-speech plugin in a Zero Runtime pipeline. Setup, options, and usage in Python, JavaScript, and Go.

ElevenLabs is a **text-to-speech** plugin. It synthesizes the LLM's reply into the agent's
voice, streaming low-latency audio over a WebSocket. It occupies the pipeline's `tts` slot.

## Setup

Set your ElevenLabs API key in the worker environment. Generate a key from the [ElevenLabs dashboard](https://elevenlabs.io/app/settings/api-keys):

```bash theme={null}
export ELEVENLABS_API_KEY=<key>
```

## Usage

Import the plugin and pass it to the pipeline's `tts` slot.

<CodeGroup>
  ```python Python theme={null}
  from zrt.plugins import ElevenLabsTTS

  tts = ElevenLabsTTS(
      model="eleven_turbo_v2",
      voice="21m00Tcm4TlvDq8ikWAM",
  )

  # Pipeline(tts=tts, ...)
  ```
</CodeGroup>

<Note>
  The Python SDK defaults to model `eleven_turbo_v2` and voice `21m00Tcm4TlvDq8ikWAM`
  (the "Rachel" voice). Pass `model` and `voice` explicitly for consistent results across SDKs.
</Note>

## Voice settings

Fine-tune the voice with the `stability`, `similarity_boost`, `style`, and
`use_speaker_boost` constructor parameters (Python). Each field is also exposed directly in
the JavaScript and Go SDKs (`stability`, `similarityBoost`/`SimilarityBoost`, etc.).

```python Python theme={null}
from zrt.plugins import ElevenLabsTTS

tts = ElevenLabsTTS(
    stability=0.5,
    similarity_boost=0.75,
    style=0.0,
    use_speaker_boost=True,
)
```

## Parameters

*Constructor parameters for the Python SDK (`ElevenLabsTTS`). The JavaScript and Go SDKs expose equivalent options where supported, in their idiomatic form (camelCase / `TTSOptions` struct).*

| Parameter                  | Type    | Default                  | Description                                                                                                 |
| -------------------------- | ------- | ------------------------ | ----------------------------------------------------------------------------------------------------------- |
| `api_key`                  | `str`   | `None`                   | ElevenLabs API key. Falls back to the `ELEVENLABS_API_KEY` environment variable when unset.                 |
| `voice`                    | `str`   | `"21m00Tcm4TlvDq8ikWAM"` | Voice ID (the "Rachel" voice).                                                                              |
| `model`                    | `str`   | `"eleven_turbo_v2"`      | ElevenLabs synthesis model (`eleven_v3`, `eleven_multilingual_v2`, `eleven_flash_v2_5`, `eleven_flash_v2`). |
| `sample_rate`              | `int`   | `24000`                  | Output sample rate in Hz.                                                                                   |
| `stability`                | `float` | `0.5`                    | Voice consistency, 0.0-1.0 (higher is steadier).                                                            |
| `similarity_boost`         | `float` | `0.75`                   | Adherence to the original voice, 0.0-1.0.                                                                   |
| `style`                    | `float` | `0.0`                    | Style exaggeration, 0.0-1.0 (0 disables, adds latency).                                                     |
| `use_speaker_boost`        | `bool`  | `True`                   | Boost similarity to the speaker.                                                                            |
| `apply_text_normalization` | `str`   | `None`                   | Text normalization mode: `"auto"`, `"on"`, or `"off"`.                                                      |
| `enable_word_timestamps`   | `bool`  | `False`                  | Return per-word timing metadata.                                                                            |
| `speed`                    | `float` | `None`                   | Speaking-rate multiplier (\~0.7-1.2). Provider default when unset.                                          |
| `language`                 | `str`   | `None`                   | ISO-639-1 language hint for supported models.                                                               |
| `enable_ssml_parsing`      | `bool`  | `None`                   | Interpret SSML tags in the input text.                                                                      |
| `stream`                   | `bool`  | `True`                   | Stream audio as it is synthesized.                                                                          |

## Import paths

| SDK        | Import                                  | Constructor                                     |
| ---------- | --------------------------------------- | ----------------------------------------------- |
| Python     | `from zrt.plugins import ElevenLabsTTS` | `ElevenLabsTTS(...)`                            |
| JavaScript | `from '@zrt/js-sdk/plugins/elevenlabs'` | `ElevenLabsTTS({ ... })`                        |
| Go         | `.../zrt-golang-sdk/plugins/elevenlabs` | `elevenlabs.NewTTS(elevenlabs.TTSOptions{...})` |

The synthesized audio is streamed back to the caller as the final stage of the
[pipeline](/concepts/pipeline).
