Overview
Google Cloud Text-to-Speech provides high-quality speech synthesis with three service implementations:GoogleTTSService for streaming with the lowest latency, GoogleHttpTTSService (HTTP-based) for simpler integration, and GeminiTTSService for Gemini TTS models. GoogleTTSService is recommended for real-time applications.
Google TTS API Reference
Pipecat’s API methods for Google Cloud TTS integration
Example Implementation
Complete example with Chirp 3 HD voice
Google Cloud Documentation
Official Google Cloud Text-to-Speech documentation
Voice Gallery
Browse available voices and languages
Installation
To use Google services, install the required dependencies:Prerequisites
Google Cloud Setup
Before using Google Cloud TTS services, you need:- Google Cloud Account: Sign up at Google Cloud Console
- Project Setup: Create a project and enable the Text-to-Speech API
- Service Account: Create a service account with TTS permissions
- Authentication: Set up credentials via service account key or Application Default Credentials
Required Environment Variables
GOOGLE_APPLICATION_CREDENTIALS: Path to your service account key file (recommended)- Or use Application Default Credentials for cloud deployments
GOOGLE_API_KEY: Gemini API key, forGeminiTTSServiceon the Gemini API backend
Configuration
GoogleTTSService
Streaming service optimized for Chirp 3 HD and Journey voices.str
default:"None"
JSON string containing Google Cloud service account credentials.
str
default:"None"
Path to Google Cloud service account JSON file.
str
default:"None"
Google Cloud location for regional endpoint (e.g.,
"us-central1").str
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use
settings=GoogleTTSService.Settings(voice=...) instead.str
default:"None"
Voice cloning key for Chirp 3 custom voices. When set, the
voice setting is
ignored.int
default:"None"
Output audio sample rate in Hz. When
None, uses the pipeline’s configured
sample rate.InputParams
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use
settings=GoogleTTSService.Settings(...) instead.GoogleTTSService.Settings
default:"None"
Runtime-configurable settings. See GoogleTTSService
Settings below.
GoogleTTSService Settings
Runtime-configurable settings passed via thesettings constructor argument using GoogleTTSService.Settings(...). These can be updated mid-conversation with TTSUpdateSettingsFrame. See Service Settings for details.
GoogleHttpTTSService
HTTP service that builds SSML from the prosody settings for voices other than Chirp and Journey.str
default:"None"
JSON string containing Google Cloud service account credentials.
str
default:"None"
Path to Google Cloud service account JSON file.
str
default:"None"
Google Cloud location for regional endpoint.
str
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use
settings=GoogleHttpTTSService.Settings(voice=...) instead.int
default:"None"
Output audio sample rate in Hz.
InputParams
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use
settings=GoogleHttpTTSService.Settings(...) instead.GoogleHttpTTSService.Settings
default:"None"
Runtime-configurable settings. See GoogleHttpTTSService
Settings below.
GoogleHttpTTSService Settings
Runtime-configurable settings passed via thesettings constructor argument using GoogleHttpTTSService.Settings(...). These can be updated mid-conversation with TTSUpdateSettingsFrame. See Service Settings for details.
GeminiTTSService
Streaming service using Gemini’s TTS-specific models with natural voice control. Supports two backends: the Google Cloud backend (with prompts for style instructions and multi-speaker support) or the Gemini Developer API (google-genai) backend (simpler API key authentication).str
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use
settings=GeminiTTSService.Settings(model=...) instead.str
default:"None"
Google AI API key for authentication with the GenAI backend. When provided,
automatically selects the GenAI backend. With
use_genai=True and no
api_key, the GOOGLE_API_KEY environment variable is used.str
default:"None"
JSON string containing Google Cloud service account credentials for the Google
Cloud backend.
str
default:"None"
Path to Google Cloud service account JSON file for the Google Cloud backend.
str
default:"None"
Google Cloud location for regional endpoint (Google Cloud backend only).
str
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use
settings=GeminiTTSService.Settings(voice=...) instead.int
default:"None"
Output audio sample rate in Hz. Google TTS outputs at 24kHz; mismatched rates
will produce a warning.
InputParams
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use
settings=GeminiTTSService.Settings(...) instead.GeminiTTSService.Settings
default:"None"
Runtime-configurable settings. See GeminiTTSService
Settings below.
bool
default:"None"
Force use of the google-genai backend when
True, or the Google Cloud backend
when False. If not provided, backend is selected automatically based on
whether api_key is passed.HttpOptions
default:"None"
HTTP client options for the google-genai client. Only applicable when using
the GenAI backend.
GeminiTTSService Settings
Runtime-configurable settings passed via thesettings constructor argument using GeminiTTSService.Settings(...). These can be updated mid-conversation with TTSUpdateSettingsFrame. See Service Settings for details.
Usage
Basic Setup (Streaming)
HTTP Service with SSML
Gemini TTS with GenAI Backend (API Key)
Gemini TTS with Google Cloud Backend (Style Prompt)
Notes
- Streaming vs HTTP:
GoogleTTSServiceuses the streaming API for low latency and only supports Chirp 3 HD and Journey voices.GoogleHttpTTSServicesupports all Google voices including Standard and WaveNet. - Chirp/Journey voices and SSML: Chirp and Journey voices do not support SSML. The HTTP service automatically uses plain text input for these voices, so
pitch,rate,volume,emphasis,gender, andgoogle_stylehave no effect on them, including on the default voice. For other voices, the text is XML-escaped before it goes into the SSML, so&,<, and>in it are safe. - Speaking rate: For Chirp and Journey voices, use
speaking_rate(float, 0.25-2.0) insettings. For other voices, userate(string) for SSML prosody control. - Credentials: Without
credentialsorcredentials_path, the Google Cloud services use Application Default Credentials, and the constructor raisesValueErrorwhen none are found. - Gemini TTS sample rate: Google TTS always outputs at 24kHz. Setting a different sample rate will produce a warning and may cause audio issues.
- Gemini TTS backends:
GeminiTTSServicesupports two backends:- GenAI backend (google-genai): Simpler authentication with API key. Automatically selected when
api_keyis provided. Does not supportmulti_speaker. Thepromptsetting is supported by Gemini 3.8 TTS models (sent asspeech_metadata.style); older models ignore it with a warning. - Google Cloud backend: Uses service account credentials. Supports
promptfor style instructions andmulti_speakerfor multi-voice conversations.
- GenAI backend (google-genai): Simpler authentication with API key. Automatically selected when
- Gemini TTS model names: Model names differ by backend. Cloud Text-to-Speech accepts
gemini-3.1-flash-tts-preview,gemini-2.5-flash-tts,gemini-2.5-flash-lite-preview-tts, andgemini-2.5-pro-tts. The Gemini API acceptsgemini-3.8-flash-tts,gemini-3.8-flash-lite-tts,gemini-3.1-flash-tts-preview,gemini-2.5-flash-preview-tts, andgemini-2.5-pro-preview-tts. The default (gemini-3.1-flash-tts-preview) works on both. - Gemini 3.8 TTS models: Gemini 3.8 TTS models (
gemini-3.8-flash-tts,gemini-3.8-flash-lite-tts) treat the input text as a verbatim transcript. Momentary vocal events use angle-bracket tags inline (e.g.,<laugh>,<sigh>,<short pause>), while sustained delivery style belongs in thepromptsetting. Older Gemini models use square-bracket tags (e.g.,[sigh],[whispering]) in the text instead. Requires google-genai >= 2.25.0. - Backend selection: Pass
api_keyto use the GenAI backend, orcredentials/credentials_pathfor Google Cloud. Useuse_genai=Trueto force the GenAI backend explicitly. - Gemini multi-speaker: Use
multi_speaker=Truewithspeaker_configsto generate conversations between multiple voices (Google Cloud backend only). Markup text with speaker aliases to control which voice speaks. - Custom voices: Custom voices created in Voice design can be used by passing their
voice_...ID as thevoicesetting.