Skip to main content

Overview

GladiaSTTService provides real-time speech recognition using Gladia’s WebSocket API with support for 99+ languages, custom vocabulary, translation, sentiment analysis, and advanced audio processing features for comprehensive transcription.

Gladia STT API Reference

Pipecat’s API methods for Gladia STT integration

Example Implementation

Complete example with interruption handling

Gladia Documentation

Official Gladia documentation and features

Gladia Platform

Access multilingual transcription and API keys

Installation

To use Gladia services, install the required dependency:

Prerequisites

Gladia Account Setup

Before using Gladia STT services, you need:
  1. Gladia Account: Sign up at Gladia
  2. API Key: Generate an API key from your account dashboard
  3. Region Selection: Choose your preferred region (EU-West or US-West)

Required Environment Variables

  • GLADIA_API_KEY: Your Gladia API key for authentication

Configuration

GladiaSTTService

str
required
Gladia API key for authentication.
Literal['us-west', 'eu-west']
default:"None"
Region used to process audio. Defaults to "eu-west" when None.
str
default:"https://api.gladia.io/v2/live"
Gladia API URL for session initialization.
str
default:"wav/pcm"
Audio encoding format.
int
default:"16"
Audio bit depth.
int
default:"1"
Number of audio channels.
int
default:"None"
Audio sample rate in Hz. When None, uses the pipeline’s configured sample rate.
str
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=GladiaSTTService.Settings(...) instead.
GladiaInputParams
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=GladiaSTTService.Settings(...) instead.
GladiaSTTService.Settings
default:"None"
Settings for the STT service. See Settings below.
int
default:"20971520"
Maximum size of audio buffer in bytes (default 20MB).
bool
default:"True"
Whether the bot should be interrupted when Gladia VAD detects user speech. See User Turn Strategies if you pass your own user_turn_strategies.
float
default:"1.49"
P99 latency from speech end to final transcript in seconds. Override for your deployment. See stt-benchmark.

Settings

Settings passed via the settings constructor argument using GladiaSTTService.Settings(...). Changes sent with STTUpdateSettingsFrame aren’t applied at runtime: the session keeps the settings it was opened with. See Service Settings for details.

Usage

Basic Setup

With Language Configuration

With Real-time Processing

Notes

  • Session-based connection: Gladia uses a two-step connection process: first an HTTP POST to initialize a session, then a WebSocket connection to the returned session URL. The session URL and ID are managed automatically.
  • Audio buffering: The service buffers audio data locally and sends it when connected. If the connection drops and reconnects, buffered audio is automatically re-sent to minimize transcript gaps.
  • Keepalive: Empty audio chunks are sent periodically to keep the Gladia connection alive (keepalive interval: 5s, timeout: 20s).
  • Built-in VAD: Set enable_vad=True in Settings to use Gladia’s server-side VAD. The service proposes each turn boundary and automatically requests ExternalUserTurnStrategies, which resolve those proposals into UserStartedSpeakingFrame and UserStoppedSpeakingFrame, so you don’t need to configure turn strategies manually. Pass your own user_turn_strategies only to override this. When using Gladia’s VAD, do not enable another VAD in your pipeline.
  • Translation: Gladia supports real-time translation to multiple target languages. Translation results are pushed as TranslationFrames.

Event Handlers

Gladia STT supports the standard service connection events: