Usage guide
Setup, environment variables, and Python/JavaScript/Go usage examples.
ElevenLabsTTS
Expressive streaming text-to-speech via ElevenLabs. Multilingual neural voices with fine-grained control over stability, similarity, style and speaker boost.Constructor
ElevenLabs API key. Falls back to
ELEVENLABS_API_KEY.Voice id. Default
"21m00Tcm4TlvDq8ikWAM" (the “Rachel” voice).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".Output rate in Hz. Default 24000.
Voice consistency, 0.0–1.0 (higher is steadier). Default 0.5.
Adherence to the original voice, 0.0–1.0. Default 0.75.
Style exaggeration, 0.0–1.0 (0 disables, adds latency). Default 0.0.
Boost similarity to the speaker. Default True.
Normalization mode (
"auto"/"on"/"off").Return per-word timing metadata. Default False.
Speaking-rate multiplier (~0.7–1.2). Default None (provider default).
ISO-639-1 language hint for supported models.
Interpret SSML tags in the input text.
Stream audio as it is synthesized. Default True.
aclose
emit
The event to emit.
interrupt
off
The event the handler was registered for.
The handler to remove.
on
callback is omitted.
The event to listen for.
The handler to invoke when the event is emitted. If
None, a decorator is returned that registers the decorated function.The registered callback when
callback is provided, otherwise a decorator that registers and returns the function it wraps.on_first_audio_byte
A callable, optionally async, invoked with synthesis timing information when the first audio byte is emitted.
synthesize
The text to synthesize; coerced to a string if needed.