Overview
PlayHT provides high-quality text-to-speech synthesis with two service implementations:PlayHTTTSService (WebSocket-based) for real-time streaming with ultra-low latency, and PlayHTHttpTTSService (HTTP-based) for simpler synthesis. PlayHTTTSService is recommended for interactive applications requiring low latency and advanced interruption handling.
PlayHT TTS API Reference
Pipecat’s API methods for PlayHT TTS integration
Example Implementation
Complete example with voice cloning
PlayHT Documentation
Official PlayHT WebSocket API documentation
Voice Cloning
Create and manage custom voices
Installation
To use PlayHT services, install the required dependencies:Prerequisites
PlayHT Account Setup
Before using PlayHT TTS services, you need:- PlayHT Account: Sign up at PlayHT Dashboard
- API Credentials: Get your User ID and API Key from the dashboard
- Voice Selection: Choose from standard voices or create custom cloned voices
Required Environment Variables
PLAY_HT_USER_ID: Your PlayHT user IDPLAY_HT_API_KEY: Your PlayHT API key for authentication
Configuration
PlayHTTTSService
PlayHT API key for authentication.
PlayHT user ID for authentication.
URL of the voice to use for synthesis.
Voice engine to use for synthesis.
Output audio sample rate in Hz. When
None, uses the pipeline’s configured sample rate.Audio output format.
Runtime-configurable voice and generation settings. See InputParams below.
PlayHTHttpTTSService
PlayHT API key for authentication.
PlayHT user ID for authentication.
URL of the voice to use for synthesis.
Voice engine to use for synthesis.
Audio output format.
Output audio sample rate in Hz. When
None, uses the pipeline’s configured sample rate.Runtime-configurable voice and generation settings. See InputParams below.
InputParams
Both WebSocket and HTTP services share the sameInputParams structure.
| Parameter | Type | Default | Description |
|---|---|---|---|
language | Language | Language.EN | Language for synthesis. Supports 30+ languages. |
speed | float | 1.0 | Speech speed multiplier. |
seed | int | None | Random seed for voice consistency. |
Usage
Basic Setup (WebSocket)
HTTP Service
Notes
- Deprecated: PlayHT shut down their API on December 31st, 2025. Both services are deprecated and will be removed in a future version.
- WebSocket vs HTTP: The WebSocket service handles persistent connections with interruption support. The HTTP service is simpler and creates a new request per TTS call.
Event Handlers
PlayHT WebSocket TTS supports the standard service connection events:| Event | Description |
|---|---|
on_connected | Connected to PlayHT WebSocket |
on_disconnected | Disconnected from PlayHT WebSocket |
on_connection_error | WebSocket connection error occurred |