Text To Speech (TTS)
This section describes the built-in text-to-speech (TTS) integrations for Voice Stream channels. All built-in TTS engines support streamed text input, so Rasa can send generated response text to the provider as it arrives. Every engine acceptstimeout (seconds, default 30) and language_map. Each map key must match a language configured in config.yml; entries can contain provider-specific language, voice, and model values. The top-level language, voice, and model options are deprecated and cannot be combined with language_map.
Azure TTS
The API Key can be set with the environment variableAZURE_SPEECH_API_KEY. Sample configuration looks as follow:
credentials.yml
Configuration parameters
speech_region: Optional, defaults toeastus- The region identifier for Azure Speech. Ensure that it matches your subscription.endpoint: Optional - A custom Azure Speech REST endpoint. By default, Rasa builds the endpoint fromspeech_region.ws_endpoint: Optional - A custom Azure Speech WebSocket endpoint for streamed text input.language_map: Optional. By default, Rasa maps the assistant language toen-USand voiceen-US-JennyNeural. Each entry supportslanguageandvoice.
Azure TTS Multilingual Support
New in Rasa 3.16.0
language_map property. Keys listed in the map
must match languages (language and additional_languages) mentioned in config.yml.
Azure TTS supports language and voice as configuration parameters inside language_map.
config.yml
credentials.yml
Cartesia TTS
Use the environment variableCARTESIA_API_KEY for Cartesia API Key. The API Key
requires a Cartesia account. It can be configured in a Voice Stream channel as follows,
credentials.yml
Configuration parameters
timeout: Defaults to30seconds. See the shared TTS options above.model_id: Optional, defaults tosonic-3.6- The model ID to be used for the text-to-speech conversion.version: Optional, defaults to2026-03-01- The version of the model to be used for the text-to-speech conversion.endpoint: Optional, defaults towss://api.cartesia.ai/tts/websocket- The WebSocket endpoint for the Cartesia API.language_map: Optional. By default, Rasa maps the assistant language to Cartesia languageenand its default voice. Each entry supportslanguageandvoice.
Cartesia Multilingual Support
New in Rasa 3.16.0
language_map property. Keys listed in the map
must match languages (language and additional_languages) mentioned in config.yml.
Cartesia supports language as configuration parameter inside language_map.
config.yml
credentials.yml
Deepgram TTS
Use the environment variableDEEPGRAM_API_KEY for Deepgram API Key. You can
request a key from Deepgram. It can be configured in a Voice Stream channel
as follows:
credentials.yml
Configuration parameters
Deepgram uses themodel value in each language_map entry to select a voice model. The default model is aura-2-thalia-en; see Deepgram documentation for available models.
endpoint: Optional, defaults towss://api.deepgram.com/v1/speak- The endpoint URL for the Deepgram API.timeout: Defaults to30seconds. See the shared TTS options above.language_map: Optional. By default, Rasa maps the assistant language to modelaura-2-thalia-en. Setmodelfor each language to select another Deepgram voice model.
model_id field, but the engine does not use it to select a model. Use language_map.<language>.model instead.
Deepgram TTS Multilingual Support
New in Rasa 3.16.0
language_map property. Keys listed in the map
must match languages (language and additional_languages) mentioned in config.yml.
Deepgram TTS supports model as configuration parameter inside language_map.
config.yml
credentials.yml
Deepgram Flux TTS
Deepgram Flux TTS uses thedeepgram_flux engine and the DEEPGRAM_API_KEY environment variable. Its default endpoint is wss://api.deepgram.com/v2/speak.
credentials.yml
Configuration parameters
endpoint: Optional, defaults towss://api.deepgram.com/v2/speak.speed: Optional. Set a value from0.5to1.5in increments of0.05.expressivity: Optional, defaults to0. Set an integer from-2to2.mip_opt_out: Optional, defaults tofalse. Controls the provider’s MIP setting.tag: Optional. Adds a request tag.language_map: Optional. By default, Rasa maps the assistant language to modelflux-alexis-en. Each entry must include amodelwhose name starts withflux-.
ElevenLabs TTS
Set theELEVENLABS_API_KEY environment variable. The default model is eleven_multilingual_v2 and the default endpoint is wss://api.elevenlabs.io/v1/text-to-speech.
credentials.yml
Configuration parameters
endpoint: Optional. The ElevenLabs WebSocket endpoint.model_id: Optional. The default model ID iseleven_multilingual_v2. You can also set a model for an individual language underlanguage_mapwithmodel.stability: Optional float from0to1. Sets voice stability.similarity_boost: Optional float from0to1. Sets voice similarity boost.language_map: Required for ElevenLabs TTS. Each entry must include avoiceID and may include amodel.
ElevenLabs v3 and v4 models are not supported by this streaming integration.
Rime TTS
Use the environment variableRIME_API_KEY for Rime API Key. You can
request a key from Rime. It can be configured in a Voice Stream channel
as follows:
credentials.yml
Configuration parameters
Rasa uses the Rime Websockets JSON API,model_id: Optional, defaults tocoda- The model ID to be used for text-to-speech conversion.endpoint: Optional, defaults towss://users-ws.rime.ai/ws3- The endpoint URL for the Rime API.speed_alpha: Optional, defaults to1.0- Controls the speed of speech synthesis.segment: Optional, defaults toimmediate- Segment mode for synthesis. Use “immediate” for low latency.no_text_normalization: Optional, defaults toFalse- Turns off text normalization to reduce the amount of computation needed to prepare input text for TTS inference. Rime recommends enabling it to reduce response latency.language_map: Optional. By default, Rasa maps the assistant language to languageenand voiceastra. Each entry supportslanguageandvoice.timeout: Defaults to30seconds. See the shared TTS options above.
Rime TTS Multilingual Support
New in Rasa 3.16.0
language_map property. Keys listed in the map
must match languages (language and additional_languages) mentioned in config.yml.
Rime TTS supports language and voice as configuration parameters inside language_map.
config.yml
credentials.yml
Others
Looking for integration with a different TTS service? You can create your own custom TTS component.Custom TTS
You can implement your own custom TTS component as a Python class to integrate with any third-party text-to-speech service. A custom TTS component must subclass theTTSEngine class from
rasa.core.channels.voice_stream.tts.tts_engine.
Your custom TTS component must output audio in the RasaAudioBytes format
and convert it using the engine_bytes_to_rasa_audio_bytes method.
Required Methods
Your custom TTS component must implement the following methods:synthesize(text: str, config: Optional[T]): Generate speech from text, returning an async iterator ofRasaAudioByteschunksengine_bytes_to_rasa_audio_bytes(chunk: bytes): Convert your engine’s audio format to Rasa’s audio formatfrom_config_dict(config: Dict): Class method to create an instance from configuration dictionaryget_default_config(): Static method that returns the default configuration for your component
Optional Methods
You may also override these methods as needed:connect(config: Optional[T]): Establish connection to the TTS engine if necessary. Default implementation does nothing.close_connection(): Custom cleanup when closing connections (e.g., closing websockets or HTTP sessions). Default implementation does nothing.send_text_chunk(text: str): Send text chunks to the TTS system for streaming synthesis. Used withstream_audio()for real-time streaming.signal_text_done(): Signal TTS engine to process any remaining buffered text and prepare to end the stream.stream_audio(): Stream audio output from the TTS engine. Continuously yields audio chunks as they are produced by the engine.
Streaming vs Non-Streaming TTS
The TTSEngine supports both streaming and non-streaming modes:- Non-streaming: Implement only
synthesize()method for simple request-response synthesis - Streaming: Set
streaming_input = Trueand implementsend_text_chunk(),signal_text_done(), andstream_audio()methods for real-time streaming synthesis
Required Class Attributes
You can optionally define these class attributes:required_env_vars: Tuple of required environment variable namesrequired_packages: Tuple of required Python package namesstreaming_input: Boolean indicating if the engine supports streaming input (defaults toFalse)
Example Implementation
Here’s an example of an implementation for TTS streaming:custom_tts.py
Configure a custom TTS component
To use a custom TTS component, configure its module path and settings in yourcredentials.yml file. The module path follows the format path.to.module.ClassName. For example, a class MyTTS in addons/custom_tts.py has module path addons.custom_tts.MyTTS.
Custom TTS Configuration Example
credentials.yml
MyASRConfig or MyTTSConfig) can be passed through the credentials file and will be available in your component via self.config.