Skip to main content

ElevenLabs integration guide

Using LiveKit's ElevenLabs integration for TTS.

Agents 1.0 available

This documentation is for v0.x of the LiveKit Agents framework.

For the latest documentation, see ElevenLabs integration.

Overview

ElevenLabs provides an AI text-to-speech (TTS) service with thousands of human-like voices across a number of different languages. With LiveKit's ElevenLabs integration and the Agents framework, you can build AI voice applications that sound realistic.

Quick reference

Environment variables

ELEVEN_API_KEY=<your-elevenlabs-api-key>

TTS

LiveKit's ElevenLabs integration provides a text-to-speech (TTS) interface. This can be used in a VoicePipelineAgent or as a standalone speech generator. For a complete reference of all available parameters, see the plugin reference.

Usage

from livekit.plugins.elevenlabs import tts
eleven_tts=elevenlabs.tts.TTS(
model="eleven_turbo_v2_5",
voice=elevenlabs.tts.Voice(
id="EXAVITQu4vr4xnSDxMaL",
name="Bella",
category="premade",
settings=elevenlabs.tts.VoiceSettings(
stability=0.71,
similarity_boost=0.5,
style=0.0,
use_speaker_boost=True
),
),
language="en",
streaming_latency=3,
enable_ssml_parsing=False,
chunk_length_schedule=[80, 120, 200, 260],
)

Parameters

modelstringOptionalDefault: eleven_turbo_v2_5

ID of the model to use for generation. To learn more, see the ElevenLabs documentation.

voiceVoiceOptionalDefault: DEFAULT_VOICE

Voice configuration. To learn more, see the ElevenLabs documentation.

  • idstringRequired

    ID of the voice to use for generation. To learn more, see the ElevenLabs documentation.

  • namestringRequired
  • categorystringRequired
  • settingsVoiceSettingsOptional
    • stabilityfloatRequired
    • similarity_boostfloatRequired
    • stylefloatOptional
    • use_speaker_boostboolOptional
languagestringOptionalDefault: en

Language of output audio in ISO-639-1 format. To learn more, see the ElevenLabs documentation.

streaming_latencyintOptionalDefault: 3

Latency in seconds for streaming.

enable_ssml_parsingboolOptionalDefault: false

Enable Speech Synthesis Markup Language (SSML) parsing for input text.

chunk_length_schedulelist[int]OptionalDefault: [80, 120, 200, 260]

Schedule for chunk lengths. Valid values range from 50 to 500.