Skip to main content

ElevenLabsTTS

ElevenLabs text-to-speech (TTS) provider.

Constructor

apiKey
string
ElevenLabs API key. Falls back to the ELEVENLABS_API_KEY environment variable when omitted.
voice
string
Voice ID to synthesize with. Default '21m00Tcm4TlvDq8ikWAM'.
model
ElevenLabsTTSModel | string
ElevenLabs model ID. Default 'eleven_turbo_v2'. Other common values include 'eleven_multilingual_v2' and 'eleven_flash_v2'.
sampleRate
number
Output audio sample rate in Hz. Default 24000.
stability
number
Voice consistency vs. expressiveness. Range 0-1. Default 0.5.
similarityBoost
number
How closely the output matches the original voice. Range 0-1. Default 0.75.
style
number
Style exaggeration. Range 0-1. Default 0.0.
useSpeakerBoost
boolean
Boosts similarity to the original speaker. Default true.
applyTextNormalization
string | null
Text normalization mode (e.g. expanding numbers and abbreviations). Typical values: 'auto', 'on', 'off'. Default null (provider default).
enableWordTimestamps
boolean
Request per-word timestamps alongside the audio. Default false.
speed
number | null
Speaking rate multiplier. Default null (provider default).
language
string | null
Language code hint for synthesis (e.g. 'en'). Default null (auto).
enableSsmlParsing
boolean | null
Whether to parse SSML markup in the input text. Default null (provider default).
stream
boolean
Stream audio as it is generated rather than waiting for the full result. Default true.
voiceSettings
ElevenLabsVoiceSettings | null
Native ElevenLabs voice settings object. Used to populate voice parameters (stability, similarityBoost, style, useSpeakerBoost) only where the corresponding top-level option was left at its default. Default null.

close

Release any resources held by the provider.

closeEmitter

Close the emitter: drop all handlers and stop emitting. Waits up to 2 seconds for in-flight async handlers to settle before returning.

emit

event
string
required

getRuntimeConfig

returns
Record<string, any>

interrupt

Stop the current synthesis.

listenerCount

event
string
required
returns
number

off

event
string
required
handler
EventHandler
required

on

event
string
required
handler
EventHandler
required
returns
EventHandler

once

event
string
required
handler
EventHandler
required
returns
EventHandler

onFirstAudioByte

Register a callback fired when the first synthesized audio byte is emitted.
callback
FirstAudioByteCallback
required

removeAllListeners

event
string

synthesize

Synthesize and speak text on the active session.
text
any
required

ElevenLabsTTSModel

Supported ElevenLabs TTS model names.

ElevenLabsVoiceSettings

ElevenLabs voice settings, mirroring ElevenLabs’ native voice_settings shape. Provided as an alternative to the top-level ElevenLabsTTSOptions fields (stability, similarityBoost, style, useSpeakerBoost). A value here is only applied when the corresponding top-level option is left at its default.

Fields

stability
number | null
Voice consistency vs. expressiveness. Range 0-1. Lower is more varied/expressive.
similarity_boost
number | null
How closely the output matches the original voice. Range 0-1.
style
number | null
Style exaggeration. Range 0-1. Higher amplifies the speaker’s style.
use_speaker_boost
boolean | null
Boosts similarity to the original speaker.