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

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 zeroruntime.plugins import ElevenLabsTTS

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

  # Pipeline(tts=tts, ...)
  ```

  ```typescript Node JS theme={null}
  import { ElevenLabsTTS } from '@zeroruntime/js-sdk/plugins';

  const tts = ElevenLabsTTS({
    model: 'eleven_turbo_v2',
    voice: '21m00Tcm4TlvDq8ikWAM',
  });

  // Pipeline({ tts, ... })
  ```
</CodeGroup>

<Note>
  Both SDKs default 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 `voice_settings` mapping, which mirrors ElevenLabs'
native `voice_settings` shape: `stability`, `similarity_boost`, `style` and
`use_speaker_boost`.

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

  tts = ElevenLabsTTS(
      voice_settings={
          "stability": 0.5,
          "similarity_boost": 0.75,
          "style": 0.0,
          "use_speaker_boost": True,
      },
  )
  ```

  ```typescript Node JS theme={null}
  import { ElevenLabsTTS } from '@zeroruntime/js-sdk/plugins';

  const tts = ElevenLabsTTS({
    voice_settings: {
      stability: 0.5,
      similarity_boost: 0.75,
      style: 0.0,
      use_speaker_boost: true,
    },
  });
  ```
</CodeGroup>

## Parameters

*Constructor parameters for `ElevenLabsTTS`. The Python and Node JS SDKs share these field names.*

| 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 zeroruntime.plugins import ElevenLabsTTS`               | `ElevenLabsTTS(...)`     |
| Node JS | `import { ElevenLabsTTS } from '@zeroruntime/js-sdk/plugins'` | `ElevenLabsTTS({ ... })` |

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