Skip to main content

Overview

GoogleSTTService provides 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.

Google STT API Reference

Pipecat’s API methods for Google Cloud STT integration

Example Implementation

Complete example with Google Cloud services

Google Cloud Documentation

Official Google Cloud Speech-to-Text documentation

Google Cloud Console

Create service accounts and manage API access

Installation

To use Google Cloud Speech services, install the required dependency:

Prerequisites

Google Cloud Setup

Before using Google Cloud STT services, 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

Configuration

GoogleSTTService

credentials
str
default:"None"
JSON string containing Google Cloud service account credentials.
credentials_path
str
default:"None"
Path to service account credentials JSON file.
location
str
default:"global"
Google Cloud location (e.g., "global", "us-central1"). Non-global locations use regional endpoints.
sample_rate
int
default:"None"
Audio sample rate in Hz. When None, uses the pipeline’s configured sample rate.
params
GoogleSTTService.InputParams
default:"None"
deprecated
Configuration parameters for the STT service. Deprecated in v0.0.105. Use settings=GoogleSTTService.Settings(...) instead.
settings
GoogleSTTService.Settings
default:"None"
Runtime-configurable settings for the STT service. See Settings below.
ttfs_p99_latency
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

Basic Setup

With Credentials JSON String

With Custom Parameters

Updating Settings at Runtime

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

Google STT supports the standard service connection events: