Voice
This page requires Python familiarity. It covers programmatic voice configuration from Python functions.
The PolyAI platform supports flexible voice selection for external providers such as ElevenLabs, Cartesia, Rime, PlayHT, Minimax, Hume, and Google TTS.
Provider classes
When picking models, adjusting stability, or accessing third-party providers – use provider-specific TTSVoice classes.
Example: ElevenLabs
Available ElevenLabs model IDs: eleven_monolingual_v1, eleven_multilingual_v1, eleven_turbo_v2, eleven_turbo_v2_5, eleven_flash_v2_5, and eleven_v3. The default is eleven_turbo_v2_5. See ElevenLabs for details on each model.
eleven_v3 limitations:
- Stability: The
eleven_v3model only supports discretestabilityvalues:0.0(Creative),0.5(Natural), and1.0(Robust). Values between these are not supported and may produce unexpected results. This differs from earlier models wherestabilityaccepts a continuous range. - Streaming latency: Do not set
optimize_streaming_latencywhen usingeleven_v3– this parameter is not supported by the v3 model and will cause an error.
Example: Cartesia
speed=0.0 before deploying, and adjust toward -1.0 if the output is too fast.Emotion options (legacy models):
EmotionKind:ANGER,POSITIVITY,SURPRISEEmotionIntensity:LOWEST,LOW,HIGH,HIGHEST
Sonic 3 and Sonic 3.5 parameters: When using a Sonic 3 or Sonic 3.5 model ID, the following additional parameters are supported:
volume(float, optional) – controls output volume (e.g. 0.5–2.0).emotion(str, optional) – emotion string (e.g."happy").language(str, optional) – language code (e.g."en").
Example: Rime
Example: Minimax
Example: Hume
Example: Google TTS
Example: Custom provider
Voice randomization
Use VoiceWeighting to randomly select a voice based on weighted probabilities:
- Weights must sum to 1.0.
- Voices without explicit weights share the remaining probability equally.
Cache behavior
- Changing
model_iddoes not automatically invalidate cached audio. - To reset cached audio:
- Go to Voice > Audio library and delete existing cache entries.
- Or, create a new voice entry with a different voice ID.
Prepend the model ID to the voice ID (e.g. eleven_turbo_v2_5/a1b2c3...) to isolate cache entries per model. This is the most reliable way to ensure the correct model is used after a switch.
Language codes
When configuring a voice, make sure the language code in the provider_voice_id matches your deployment’s locale. An incorrect language code (e.g. en-GB instead of en-IE) can cause the TTS provider to render a different accent or voice than expected, even when the correct voice ID is set.
Additional options
- stability – controls tone variability across runs (ElevenLabs).
- speed – adjusts speech rate (ElevenLabs:
0.7–1.2; PlayHT:0.1–5.0; other providers may differ). - randomize_voice() – supports external providers for weighted selection.

