Overview
Async provides high-quality text-to-speech synthesis with two service implementations:AsyncAITTSService (WebSocket-based) for real-time streaming with interruption support, and AsyncAIHttpTTSService (HTTP-based) for simpler synthesis. AsyncAITTSService is recommended for interactive applications requiring low latency.
AsyncAI TTS API Reference
Pipecat’s API methods for AsyncAI TTS integration
Example Implementation
Complete example with WebSocket streaming
Async Documentation
Official Async API documentation
Voice Models
Explore available voice models and features
Installation
To use Async services, install the required dependencies:Prerequisites
Async Account Setup
Before using Async TTS services, you need:- Async Account: Sign up at Async
- API Key: Generate an API key from your account dashboard
- Voice Selection: Choose from available voice models
Required Environment Variables
ASYNCAI_API_KEY: Your Async API key for authentication
Configuration
AsyncAITTSService
Async API key.
UUID of the voice to use for synthesis. Deprecated in v0.0.105. Use
settings=AsyncAITTSService.Settings(voice=...) instead.TTS model to use. Deprecated in v0.0.105. Use
settings=AsyncAITTSService.Settings(model=...) instead.Async API version.
WebSocket endpoint URL.
Output audio sample rate in Hz. When
None, uses the pipeline’s configured
sample rate.Audio encoding format.
Audio container format.
Controls how incoming text is aggregated before synthesis.
SENTENCE
(default) buffers text until sentence boundaries, producing more natural
speech. TOKEN streams tokens directly for lower latency. Import from
pipecat.services.tts_service.Deprecated in v0.0.104. Use
text_aggregation_mode instead.Deprecated in v0.0.105. Use
settings=AsyncAITTSService.Settings(...)
instead.AsyncAIHttpTTSService
The HTTP service accepts similar parameters to the WebSocket service, with these differences:An aiohttp session for HTTP requests. You must create and manage this
yourself.
HTTP API base URL (instead of WebSocket URL).
Settings
Runtime-configurable settings passed via thesettings constructor argument using AsyncAITTSService.Settings(...). These can be updated mid-conversation with TTSUpdateSettingsFrame. See Service Settings for details.
| Parameter | Type | Default | Description |
|---|---|---|---|
model | str | None | Model identifier. (Inherited.) |
voice | str | None | Voice identifier. (Inherited.) |
language | Language | str | None | Language for synthesis. (Inherited.) |
Usage
Basic Setup
With Language Customization
HTTP Service
Event Handlers
Async TTS supports the standard service connection events:| Event | Description |
|---|---|
on_connected | Connected to Async WebSocket |
on_disconnected | Disconnected from Async WebSocket |
on_connection_error | WebSocket connection error occurred |