Skip to main content

Overview

Google provides two STT service implementations:
  • GeminiSTTService for streaming transcription with a Gemini Live transcription model (e.g. gemini-3.5-transcribe-live) over the Gemini Live API, with automatic language detection, language hints, and adaptation phrases
  • GoogleSTTService for real-time speech recognition using Google Cloud’s Speech-to-Text V2 API with support for 125+ languages, multiple models, voice activity detection, and advanced features like automatic punctuation and word-level confidence scores
The two services authenticate differently: GeminiSTTService uses a Google AI (Gemini) API key, while GoogleSTTService uses Google Cloud service account credentials.

Gemini STT API Reference

Pipecat’s API methods for Gemini STT integration

Google STT API Reference

Pipecat’s API methods for Google Cloud STT integration

Gemini Voice Example

Complete voice bot example with Gemini services

Gemini Transcription Example

Transcription example with GeminiSTTService

Google Cloud STT Example

Complete example with Google Cloud services

Google AI Documentation

Official Google Gemini API documentation

Google Cloud Documentation

Official Google Cloud Speech-to-Text documentation

Google Cloud Console

Create service accounts and manage API access

Installation

To use either Google STT service, install the required dependency:
GeminiSTTService additionally requires google-genai >= 2.9.0 for transcription support. Upgrade with uv add "google-genai>=2.9.0" if you have an older version installed.

Prerequisites

Google AI Setup

Before using GeminiSTTService, you need:
  1. Google AI Account: Sign up at Google AI Studio
  2. API Key: Generate an API key from the AI Studio console
  3. Model Access: Ensure you have access to the gemini-3.5-transcribe-live model
Required environment variables:
  • GOOGLE_API_KEY: Your Google AI (Gemini) API key

Google Cloud Setup

Before using GoogleSTTService, you need:
  1. Google Cloud Account: Sign up at Google Cloud Console
  2. Project Setup: Create a project and enable the Speech-to-Text API
  3. Service Account: Create a service account with Speech-to-Text 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

GeminiSTTService

GeminiSTTService streams raw PCM audio to a Gemini Live transcription model (e.g. gemini-3.5-transcribe-live) over the Gemini Live API, delivering interim and final transcription frames as results arrive. The model detects utterance boundaries itself, and when the pipeline’s VAD signals end of speech the service sends an audio-stream-end signal to flush the utterance, so the final transcript is produced promptly instead of waiting for the model to decide the utterance ended. Without an upstream VAD the model finalizes on its own schedule. Audio is sent at the pipeline’s input sample rate; the model performs best with 16 kHz mono PCM.
str
required
Google AI (Gemini) API key for authentication.
HttpOptions
default:"None"
Optional HTTP options passed to the google-genai client.
int
default:"None"
Audio sample rate in Hz. When None, uses the pipeline’s configured sample rate. The model performs best with 16 kHz mono PCM.
GeminiSTTService.Settings
default:"None"
Runtime-configurable settings for the STT service. Defaults to the gemini-3.5-transcribe-live model with automatic language detection. See Settings below.
float
default:"GEMINI_TTFS_P99"
P99 latency from speech end to final transcript in seconds. Override for your deployment. See https://github.com/pipecat-ai/stt-benchmark

Settings

Runtime-configurable settings passed via the settings constructor argument using GeminiSTTService.Settings(...). These can be updated mid-conversation with STTUpdateSettingsFrame. See Service Settings for details. Language configuration maps to the Live API’s AudioTranscriptionConfig: when language or languages are set they are sent as language hints; otherwise the model detects the language automatically. Language hints and automatic detection are mutually exclusive — if both are configured, hints take precedence.

Usage

With Language Hints

With Adaptation Phrases

Use adaptation phrases to improve recognition accuracy for domain-specific terms:

Notes

  • Requires google-genai >= 2.9.0: The service will raise an ImportError if an older version is installed. Upgrade with uv add "google-genai>=2.9.0".
  • VAD Integration: When the pipeline’s VAD signals end of speech (via VADUserStoppedSpeakingFrame), the service flushes the utterance to receive the final transcript promptly. Without a VAD, the model finalizes on its own schedule.
  • Language configuration: Language hints (languages) and automatic detection (language_auto) are mutually exclusive. If both are configured, language hints take precedence.
  • Audio requirements: The model performs best with 16 kHz mono PCM audio. Audio is sent at the pipeline’s input sample rate.
  • Connection management: Settings changes (model, languages, adaptation phrases) require a reconnection. The service automatically handles reconnection on transient errors.
  • Authentication: Uses Google AI (Gemini) API keys, not Google Cloud service accounts. This is a different authentication method from GoogleSTTService.

Event Handlers

Supports the standard service connection events:

GoogleSTTService

str
default:"None"
JSON string containing Google Cloud service account credentials.
str
default:"None"
Path to service account credentials JSON file.
str
default:"global"
Google Cloud location (e.g., "global", "us-central1"). Non-global locations use regional endpoints.
int
default:"None"
Audio sample rate in Hz. When None, uses the pipeline’s configured sample rate.
GoogleSTTService.InputParams
default:"None"
deprecated
Configuration parameters for the STT service. Deprecated in v0.0.105. Use settings=GoogleSTTService.Settings(...) instead.
GoogleSTTService.Settings
default:"None"
Runtime-configurable settings for the STT service. See Settings below.
float
default:"GOOGLE_TTFS_P99"
P99 latency from speech end to final transcript in seconds. Override for your deployment.
You must provide either credentials (JSON string), credentials_path (file path), or have Application Default Credentials configured. At least one authentication method is required.

Settings

Runtime-configurable settings passed via the settings constructor argument using GoogleSTTService.Settings(...). These can be updated mid-conversation with STTUpdateSettingsFrame. See Service Settings for details.

Usage

With Credentials JSON String

With Custom Parameters

Speech Adaptation

Bias recognition toward domain-specific terms using inline phrase sets or references to pre-created phrase sets:

Updating Settings at Runtime

Google Cloud STT supports dynamic settings updates via STTUpdateSettingsFrame:

Notes

  • Streaming time limit: Google Cloud STT has a 5-minute streaming limit per connection. The service automatically handles stream reconnection at 4 minutes to provide seamless transcription without interruption.
  • Multi-language support: Pass a list of Language values to languages for multi-language recognition. The first language is the primary language.
  • Regional endpoints: Use the location parameter to route requests through regional endpoints (e.g., "us-central1", "europe-west1") for data residency requirements. The default "global" endpoint works for most use cases.
  • Stream abort on inactivity: If no audio is sent for ~10 seconds (e.g., when audio frames are blocked), Google automatically closes the stream. The service recovers by automatically reconnecting.
  • Authentication priority: The service checks for credentials in this order: credentials (JSON string), credentials_path (file), then Application Default Credentials.
  • Speech adaptation: Support varies by model and language — see Google’s language support documentation.
The InputParams / params= pattern is deprecated as of v0.0.105. Use Settings / settings= instead. See the Service Settings guide for migration details.

Event Handlers

Supports the standard service connection events: