# ElevenLabs (/en/ai/models/tts/elevenlabs)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

ElevenLabs provides highly realistic AI voices with advanced prosody and natural speech patterns, delivering lifelike audio synthesis with emotional nuance and conversational flow.

<CalloutContainer type="warning">
  <CalloutTitle>
    Paid plan required
  </CalloutTitle>

  <CalloutDescription>
    You need a **paid ElevenLabs plan** for reliable TTS integration.

    ElevenLabs may restrict or disable free-tier accounts due to abuse-detection mechanisms, even if free credits are available. To avoid missing audio responses during testing and production, ensure you use a paid plan.
  </CalloutDescription>
</CalloutContainer>

### Sample configuration [#sample-configuration]

The following examples show how to configure ElevenLabs TTS when starting a conversational AI agent.

<Tabs defaultValue="python" groupId="ai-sdk-language">
  <TabsList>
    <TabsTrigger value="python">
      Python SDK
    </TabsTrigger>

    <TabsTrigger value="typescript">
      TypeScript SDK
    </TabsTrigger>

    <TabsTrigger value="go">
      Go SDK
    </TabsTrigger>

    <TabsTrigger value="rest-api">
      REST API
    </TabsTrigger>
  </TabsList>

  <TabsContent value="python">
    ```python
    from agora_agent import Agent
    from agora_agent.agentkit.vendors import ElevenLabsTTS

    # client is your configured Agora client
    agent = (
        Agent(client)
        .with_stt(...)  # configure your STT vendor
        .with_llm(...)  # configure your LLM vendor
        .with_tts(ElevenLabsTTS(
            key='your-elevenlabs-key',
            model_id='eleven_flash_v2_5',
            voice_id='pNInz6obpgDQGcFmaJgB',
            base_url='wss://api.elevenlabs.io/v1',
        ))
    )
    ```
  </TabsContent>

  <TabsContent value="typescript">
    ```typescript
    import { Agent, ElevenLabsTTS } from 'agora-agents';

    // client is your configured Agora client
    const agent = new Agent({ client })
      .withStt(/* configure your STT vendor */)
      .withLlm(/* configure your LLM vendor */)
      .withTts(new ElevenLabsTTS({
        key: 'your-elevenlabs-key',
        modelId: 'eleven_flash_v2_5',
        voiceId: 'pNInz6obpgDQGcFmaJgB',
        baseUrl: 'wss://api.elevenlabs.io/v1',
      }));
    ```
  </TabsContent>

  <TabsContent value="go">
    ```go
    import "github.com/AgoraIO/agora-agents-go/v2/agentkit/vendors"

    // client is your configured Agora client
    agent := agentkit.NewAgent(client).WithStt(/* configure your STT vendor */).
      WithLlm(/* configure your LLM vendor */).
      WithTts(
        vendors.NewElevenLabsTTS(vendors.ElevenLabsTTSOptions{
            Key:     "your-elevenlabs-key",
            ModelID: "eleven_flash_v2_5",
            VoiceID: "pNInz6obpgDQGcFmaJgB",
            BaseURL: "wss://api.elevenlabs.io/v1",
        }),
    )
    ```
  </TabsContent>

  <TabsContent value="rest-api">
    Use the following `tts` configuration in your request:

    ```json
    "tts": {
      "vendor": "elevenlabs",
      "params": {
        "base_url": "wss://api.elevenlabs.io/v1",
        "key": "<your_elevenlabs_key>",
        "model_id": "eleven_flash_v2_5",
        "voice_id": "pNInz6obpgDQGcFmaJgB",
        "sample_rate": 24000
      }
    }
    ```
  </TabsContent>
</Tabs>

<CalloutContainer type="warning">
  <CalloutTitle>
    Caution
  </CalloutTitle>

  <CalloutDescription>
    The parameters listed on this page are validated for use with Conversational AI Engine. Required parameters must be provided as documented. Any additional parameters are passed through directly to the underlying vendor without validation. For advanced configuration options, voice cloning, and detailed parameter descriptions, see the [ElevenLabs TTS documentation](https://elevenlabs.io/docs/capabilities/text-to-speech).
  </CalloutDescription>
</CalloutContainer>

### Key parameters [#key-parameters]

<ParameterList title="params" required="true">
  <Parameter name="base_url" type="string" required="true">
    The endpoint URL for the ElevenLabs TTS service. See [Data residency](https://elevenlabs.io/docs/product-guides/administration/data-residency).
  </Parameter>

  <Parameter name="key" type="string" required="true">
    The API key used for authentication. Get your API key from the [ElevenLabs Console](https://elevenlabs.io/).
  </Parameter>

  <Parameter name="model_id" type="string" required="true">
    Identifier of the model to be used. Popular options include `eleven_flash_v2_5` for speed or `eleven_multilingual_v2` for quality.
  </Parameter>

  <Parameter name="voice_id" type="string" required="true">
    The identifier for the selected voice for speech synthesis. Browse available voices in the [Voice Library](https://elevenlabs.io/voice-library).
  </Parameter>

  <Parameter name="sample_rate" type="number" defaultValue="24000" required="false">
    Audio sampling rate in Hz. Common values: `16000`, `22050`, `24000`, `44100`.
  </Parameter>

  <Parameter name="speed" type="number" defaultValue="1.0" required="false">
    Speed up or slow down the speed of the generated speech. Range `0.7` to `1.2` inclusive.
  </Parameter>

  <Parameter name="stability" type="number" required="false">
    Controls voice stability. Higher values `(0.8-1.0)` produce more consistent speech, lower values `(0.0-0.5)` add more variation.
  </Parameter>

  <Parameter name="similarity_boost" type="number" required="false">
    Enhances similarity to the original voice. Range: `0.0-1.0`. Higher values stick closer to the training voice.
  </Parameter>

  <Parameter name="style" type="number" required="false">
    Controls speaking style and expressiveness. Higher values increase emotional range and variation.
  </Parameter>

  <Parameter name="use_speaker_boost" type="boolean" required="false">
    Improves voice quality and similarity when enabled. Recommended for most use cases.
  </Parameter>
</ParameterList>
