Create TTS Model
Every TTS model takes a credential, a model name, and an optional provider-specificParameters object. The tabs below show the standard and realtime setups:
Additional arguments for
DashScopeRealtimeTTSModel and DashScopeCosyVoiceTTSModel (realtime mode):
Call TTS Model
Invoke the model by callingsynthesize() with the text to speak:
stream setting:
stream=False: returns a singleTTSResponsewith the complete audio.stream=True: returns anAsyncGenerator[TTSResponse, None]. Each chunk carries an incremental audio delta; the final chunk hasis_last=True.
TTSResponse carries:
Realtime TTS (Streaming Input)
For realtime models (DashScopeRealtimeTTSModel and DashScopeCosyVoiceTTSModel with realtime=True), text can be pushed incrementally as it arrives from a streaming LLM. Both share the same push() / synthesize() interface. The lifecycle is managed via async with or manual connect() / close():
DashScopeRealtimeTTSModel (Qwen3) produces audio at token-level granularity, so each push() call typically returns audio data. In contrast, DashScopeCosyVoiceTTSModel with realtime=True relies on the CosyVoice server which automatically segments text into sentences before synthesizing. Audio is only returned after a complete sentence boundary is detected, so push() may return empty responses for partial sentences. Calling synthesize() forces synthesis of all remaining text including incomplete sentences.Integrate with Agent
In the agent layer, TTS is integrated viaTTSMiddleware, which intercepts the agent’s text output and synthesizes speech automatically:
TTS Model Card
TTSModelCard describes a TTS model’s capabilities (available voices, streaming support, and parameter ranges) and follows the same schema and override mechanics as the general ModelCard. Each card is defined by a YAML file alongside the model implementation. The tabs below show one card per provider:
voices list is automatically injected into the parameter_schema as an enum constraint on the voice field, so the frontend renders a dropdown selector.
Retrieve TTS model cards via the credential:
Custom TTS Provider
To add a new TTS provider, implement aTTSModelBase subclass and register it on the credential: