Overview
PiperTTSService runs Piper neural text-to-speech in-process, and PiperHttpTTSService connects to a self-hosted Piper HTTP server. Both offer complete privacy and control with no external API dependencies, making them ideal for on-premise deployments and applications requiring data sovereignty.
Piper TTS API Reference
Pipecat’s API methods for Piper TTS integration
Example Implementation
Browse examples using Piper TTS
Piper Documentation
Official Piper TTS documentation and setup
HTTP Server Setup
Configure Piper HTTP server for Pipecat
Installation
Both services are imported frompipecat.services.piper.tts, which requires the piper extra:
Prerequisites
Piper Server Setup
Before usingPiperHttpTTSService, you need:
- Piper TTS Server: Set up a running Piper TTS server following the HTTP server documentation
- Voice Models: Download and configure voice models for your target languages
- Server Configuration: Configure server endpoint and voice selection
Required Configuration
- Server URL: Configure the Piper server endpoint in your service initialization
- Voice Models: Ensure required voice models are available on the server
Configuration
Piper offers two service implementations:PiperTTSService for local inference and PiperHttpTTSService for HTTP server-based synthesis.
PiperTTSService
Runs Piper locally, automatically downloading voice models as needed.str
default:"None"
deprecated
Piper voice model identifier (e.g.
en_US-ryan-high). Deprecated in
v0.0.105. Use settings=PiperTTSService.Settings(voice=...) instead.PiperTTSService.Settings
default:"None"
Service settings. See PiperTTSService Settings
below.
Path
default:"None"
Directory for storing voice model files. Defaults to Pipecat’s cache directory
(
~/.cache/pipecat/piper).bool
default:"False"
Re-download the voice model even if it already exists locally.
bool
default:"False"
Use CUDA for GPU-accelerated inference.
PiperTTSService Settings
Settings passed via thesettings constructor argument using PiperTTSService.Settings(...). The voice model is loaded once when the service is created, so updates sent with TTSUpdateSettingsFrame are not applied: the service logs a warning and keeps the original voice. See Service Settings for details.
PiperHttpTTSService
Connects to a running Piper HTTP TTS server.str
required
Base URL for the Piper TTS HTTP server.
aiohttp.ClientSession
required
An aiohttp session for HTTP requests.
str
default:"None"
deprecated
Piper voice model identifier (e.g.
en_US-ryan-high). Deprecated in
v0.0.105. Use settings=PiperHttpTTSService.Settings(voice=...) instead.PiperHttpTTSService.Settings
default:"None"
Runtime-configurable settings. See PiperHttpTTSService
Settings below.
PiperHttpTTSService Settings
Runtime-configurable settings passed via thesettings constructor argument using PiperHttpTTSService.Settings(...). These can be updated mid-conversation with TTSUpdateSettingsFrame. See Service Settings for details.
Usage
Local Inference
HTTP Server
Start the Piper HTTP server first:Notes
- Local execution:
PiperTTSServiceruns inference locally. If the voice model isn’t already indownload_dir, it is downloaded when the service is created. - GPU acceleration: Set
use_cuda=Truefor GPU-accelerated inference withPiperTTSService(requires CUDA-compatible hardware). - Audio resampling: Audio output is automatically resampled to match the pipeline’s configured sample rate.
- No API key required: Piper is open-source and runs locally, so no API credentials are needed.
- GPL-3.0 license: Both services import the
piper-ttspackage (thepiperextra), which is GPL-3.0 licensed, andPiperTTSServiceruns it in-process. Distributing an application that includes it may subject the application to the GPL’s source-disclosure terms.