> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pipecat.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Text-to-Speech

> Google Cloud TTS with GoogleTTSService (low-latency streaming), GoogleHttpTTSService, and GeminiTTSService for Gemini TTS models.

## 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.

> [card] [Google TTS API Reference](https://reference-server.pipecat.ai/en/latest/api/pipecat.services.google.tts.html)
>
> Pipecat's API methods for Google Cloud TTS integration

> [card] [Example Implementation](https://github.com/pipecat-ai/pipecat/blob/main/examples/voice/voice-google.py)
>
> Complete example with Chirp 3 HD voice

> [card] [Google Cloud Documentation](https://cloud.google.com/text-to-speech/docs)
>
> Official Google Cloud Text-to-Speech documentation

> [card] [Voice Gallery](https://cloud.google.com/text-to-speech/docs/voices)
>
> Browse available voices and languages

## Installation

To use Google services, install the required dependencies:

```bash theme={null}
uv add "pipecat-ai[google]"
```

## Prerequisites

### Google Cloud Setup

Before using Google Cloud TTS services, you need:

1. **Google Cloud Account**: Sign up at [Google Cloud Console](https://console.cloud.google.com/)
2. **Project Setup**: Create a project and enable the Text-to-Speech API
3. **Service Account**: Create a service account with TTS permissions
4. **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, for `GeminiTTSService` on the Gemini API backend

## Configuration

### GoogleTTSService

Streaming service optimized for Chirp 3 HD and Journey voices.

**credentials** `str` (default: None)

JSON string containing Google Cloud service account credentials.

**credentials\_path** `str` (default: None)

Path to Google Cloud service account JSON file.

**location** `str` (default: None)

Google Cloud location for regional endpoint (e.g., `"us-central1"`).

**voice\_id** `str` *deprecated* (default: None)

*Deprecated since 0.0.105, removed in 2.0.0.* Use
`settings=GoogleTTSService.Settings(voice=...)` instead.

**voice\_cloning\_key** `str` (default: None)

Voice cloning key for Chirp 3 custom voices. When set, the `voice` setting is
ignored.

**sample\_rate** `int` (default: None)

Output audio sample rate in Hz. When `None`, uses the pipeline's configured
sample rate.

**params** `InputParams` *deprecated* (default: None)

*Deprecated since 0.0.105, removed in 2.0.0.* Use
`settings=GoogleTTSService.Settings(...)` instead.

**settings** `GoogleTTSService.Settings` (default: None)

Runtime-configurable settings. See [GoogleTTSService
Settings](#googlettsservice-settings) below.

#### GoogleTTSService Settings

Runtime-configurable settings passed via the `settings` constructor argument using `GoogleTTSService.Settings(...)`. These can be updated mid-conversation with `TTSUpdateSettingsFrame`. See [Service Settings](https://docs.pipecat.ai/pipecat/fundamentals/service-settings.md) for details.

| Parameter | Type | Default | Description |
| - | - | - | - |
| `model` | `str` | `None` | Not sent by this service; reported only as the model name in metrics and traces. *(Inherited.)* |
| `voice` | `str` | `"en-US-Chirp3-HD-Charon"` | Voice identifier. *(Inherited.)* |
| `language` | `Language \| str` | `"en-US"` | Language for synthesis. *(Inherited.)* |
| `speaking_rate` | `float` | `None` | Speaking rate in the range \[0.25, 2.0]. |

### GoogleHttpTTSService

HTTP service that builds SSML from the prosody settings for voices other than Chirp and Journey.

**credentials** `str` (default: None)

JSON string containing Google Cloud service account credentials.

**credentials\_path** `str` (default: None)

Path to Google Cloud service account JSON file.

**location** `str` (default: None)

Google Cloud location for regional endpoint.

**voice\_id** `str` *deprecated* (default: None)

*Deprecated since 0.0.105, removed in 2.0.0.* Use
`settings=GoogleHttpTTSService.Settings(voice=...)` instead.

**sample\_rate** `int` (default: None)

Output audio sample rate in Hz.

**params** `InputParams` *deprecated* (default: None)

*Deprecated since 0.0.105, removed in 2.0.0.* Use
`settings=GoogleHttpTTSService.Settings(...)` instead.

**settings** `GoogleHttpTTSService.Settings` (default: None)

Runtime-configurable settings. See [GoogleHttpTTSService
Settings](#googlehttpttsservice-settings) below.

#### GoogleHttpTTSService Settings

Runtime-configurable settings passed via the `settings` constructor argument using `GoogleHttpTTSService.Settings(...)`. These can be updated mid-conversation with `TTSUpdateSettingsFrame`. See [Service Settings](https://docs.pipecat.ai/pipecat/fundamentals/service-settings.md) for details.

| Parameter | Type | Default | Description |
| - | - | - | - |
| `model` | `str` | `None` | Not sent by this service; reported only as the model name in metrics and traces. *(Inherited.)* |
| `voice` | `str` | `"en-US-Chirp3-HD-Charon"` | Voice identifier. *(Inherited.)* |
| `language` | `Language \| str` | `"en-US"` | Language for synthesis. *(Inherited.)* |
| `pitch` | `str` | `None` | Voice pitch adjustment (e.g., `"+2st"`, `"-50%"`). |
| `rate` | `str` | `None` | Speaking rate for SSML prosody (non-Chirp voices, e.g., `"slow"`, `"fast"`, `"125%"`). |
| `speaking_rate` | `float` | `None` | Speaking rate for AudioConfig (Chirp/Journey voices). Range \[0.25, 2.0]. |
| `volume` | `str` | `None` | Volume adjustment (e.g., `"loud"`, `"soft"`, `"+6dB"`). |
| `emphasis` | `Literal` | `None` | Emphasis level: `"strong"`, `"moderate"`, `"reduced"`, `"none"`. |
| `gender` | `Literal` | `None` | Voice gender preference: `"male"`, `"female"`, `"neutral"`. |
| `google_style` | `Literal` | `None` | Google-specific voice style: `"apologetic"`, `"calm"`, `"empathetic"`, `"firm"`, `"lively"`. |

### 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).

**model** `str` *deprecated* (default: None)

*Deprecated since 0.0.105, removed in 2.0.0.* Use
`settings=GeminiTTSService.Settings(model=...)` instead.

**api\_key** `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.

**credentials** `str` (default: None)

JSON string containing Google Cloud service account credentials for the Google
Cloud backend.

**credentials\_path** `str` (default: None)

Path to Google Cloud service account JSON file for the Google Cloud backend.

**location** `str` (default: None)

Google Cloud location for regional endpoint (Google Cloud backend only).

**voice\_id** `str` *deprecated* (default: None)

*Deprecated since 0.0.105, removed in 2.0.0.* Use
`settings=GeminiTTSService.Settings(voice=...)` instead.

**sample\_rate** `int` (default: None)

Output audio sample rate in Hz. Google TTS outputs at 24kHz; mismatched rates
will produce a warning.

**params** `InputParams` *deprecated* (default: None)

*Deprecated since 0.0.105, removed in 2.0.0.* Use
`settings=GeminiTTSService.Settings(...)` instead.

**settings** `GeminiTTSService.Settings` (default: None)

Runtime-configurable settings. See [GeminiTTSService
Settings](#geminittsservice-settings) below.

**use\_genai** `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.

**http\_options** `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 the `settings` constructor argument using `GeminiTTSService.Settings(...)`. These can be updated mid-conversation with `TTSUpdateSettingsFrame`. See [Service Settings](https://docs.pipecat.ai/pipecat/fundamentals/service-settings.md) for details.

| Parameter | Type | Default | Description |
| - | - | - | - |
| `model` | `str` | `"gemini-3.1-flash-tts-preview"` | Model identifier. *(Inherited.)* |
| `voice` | `str` | `"Kore"` | Voice identifier, or a custom voice ID from Voice design (starting with `voice_`). *(Inherited.)* |
| `language` | `Language \| str` | `"en-US"` | Language for synthesis. *(Inherited.)* |
| `prompt` | `str` | `None` | Style instructions for how to synthesize the content. Supported on the Google Cloud backend, and on the Gemini API backend by Gemini 3.8 TTS models (sent as `speech_metadata.style`); older models on the Gemini API backend ignore it with a warning. |
| `multi_speaker` | `bool` | `False` | Enable multi-speaker support (Google Cloud backend only). |
| `speaker_configs` | `list[dict]` | `None` | Speaker configurations for multi-speaker mode. Each dict should have `speaker_alias` and optionally `speaker_id`, which defaults to the `voice` setting. |

## Usage

### Basic Setup (Streaming)

```python theme={null}
from pipecat.services.google.tts import GoogleTTSService
from pipecat.transcriptions.language import Language

tts = GoogleTTSService(
    credentials_path="/path/to/service-account.json",
    settings=GoogleTTSService.Settings(
        voice="en-US-Chirp3-HD-Charon",
        language=Language.EN_US,
    )
)
```

### HTTP Service with SSML

```python theme={null}
from pipecat.services.google.tts import GoogleHttpTTSService
from pipecat.transcriptions.language import Language

tts = GoogleHttpTTSService(
    credentials_path="/path/to/service-account.json",
    settings=GoogleHttpTTSService.Settings(
        voice="en-US-Standard-A",
        language=Language.EN_US,
        rate="110%",
        pitch="+2st",
    ),
)
```

### Gemini TTS with GenAI Backend (API Key)

```python theme={null}
import os

from pipecat.services.google.tts import GeminiTTSService

tts = GeminiTTSService(
    api_key=os.getenv("GOOGLE_API_KEY"),
    settings=GeminiTTSService.Settings(
        model="gemini-3.1-flash-tts-preview",
        voice="Puck",
    )
)
```

### Gemini TTS with Google Cloud Backend (Style Prompt)

```python theme={null}
from pipecat.services.google.tts import GeminiTTSService
from pipecat.transcriptions.language import Language

tts = GeminiTTSService(
    credentials_path="/path/to/service-account.json",
    settings=GeminiTTSService.Settings(
        model="gemini-3.1-flash-tts-preview",
        voice="Kore",
        language=Language.EN_US,
        prompt="Say this in a friendly and helpful tone"
    )
)
```

## Notes

* **Streaming vs HTTP**: `GoogleTTSService` uses the streaming API for low latency and only supports Chirp 3 HD and Journey voices. `GoogleHttpTTSService` supports 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`, and `google_style` have 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) in `settings`. For other voices, use `rate` (string) for SSML prosody control.
* **Credentials**: Without `credentials` or `credentials_path`, the Google Cloud services use Application Default Credentials, and the constructor raises `ValueError` when 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**: `GeminiTTSService` supports two backends:
  * **GenAI backend** (google-genai): Simpler authentication with API key. Automatically selected when `api_key` is provided. Does not support `multi_speaker`. The `prompt` setting is supported by Gemini 3.8 TTS models (sent as `speech_metadata.style`); older models ignore it with a warning.
  * **Google Cloud backend**: Uses service account credentials. Supports `prompt` for style instructions and `multi_speaker` for multi-voice conversations.
* **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`, and `gemini-2.5-pro-tts`. The Gemini API accepts `gemini-3.8-flash-tts`, `gemini-3.8-flash-lite-tts`, and `gemini-3.1-flash-tts-preview`. The default (`gemini-3.1-flash-tts-preview`) works on both; the Gemini API shuts that preview model down on November 17, 2026 and names `gemini-3.8-flash-lite-tts` as its replacement.
* **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 the `prompt` setting. 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_key` to use the GenAI backend, or `credentials`/`credentials_path` for Google Cloud. Use `use_genai=True` to force the GenAI backend explicitly.
* **Gemini multi-speaker**: Use `multi_speaker=True` with `speaker_configs` to 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 the `voice` setting.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.