Overview
GradiumSTTService provides real-time speech recognition using Gradium’s WebSocket API with support for multilingual transcription, semantic voice activity detection for smart turn-taking, and robust performance in noisy environments.
Transcribes English by default. Set settings.language to one of the other supported languages (German, Spanish, French, Portuguese), or to "any" to have Gradium detect the language.
By default the pipeline’s VAD closes each utterance. With enable_turn_detection=True the server’s end-pointing signal drives turns instead: the service broadcasts ProposedUserStartedSpeakingFrame and ProposedUserStoppedSpeakingFrame, and recommends ExternalUserTurnStrategies to resolve them.
Gradium STT API Reference
Pipecat’s API methods for Gradium STT integration
Example Implementation
Complete example with interruption handling
Turn Detection Example
Server-side turn detection example
Gradium Documentation
Official Gradium STT API documentation
Gradium Platform
Access API keys and speech models
Installation
To use Gradium services, install the required dependency:Prerequisites
Gradium Account Setup
Before using Gradium STT services, you need:- Gradium Account: Sign up at Gradium
- API Key: Generate an API key from your account dashboard
- Region Selection: Choose your preferred region (EU or US)
Required Environment Variables
GRADIUM_API_KEY: Your Gradium API key for authentication
Configuration
GradiumSTTService
str
required
Gradium API key for authentication.
str
default:"wss://api.gradium.ai/api/speech/asr"
WebSocket endpoint URL. Gradium automatically routes traffic to the nearest
endpoint. Override to pin to a specific region or custom deployment.
str
default:"pcm"
Base audio encoding type. One of
"pcm", "wav", or "opus". For PCM, the
sample rate is appended automatically to form the input format (e.g., "pcm"
becomes "pcm_16000"). PCM accepts 8000, 16000, and 24000 Hz sample rates.int | None
default:"None"
Audio sample rate in Hz. If
None, uses the pipeline’s audio sample rate.GradiumSTTService.InputParams
default:"None"
deprecated
Configuration parameters for language and delay settings. Deprecated in
v0.0.105. Use
settings=GradiumSTTService.Settings(...) instead.str
default:"None"
Optional JSON configuration string for additional model settings. Deprecated
in favor of
params.bool
default:"False"
Whether the server’s end-pointing signal decides when user turns start and
end, instead of the pipeline’s VAD. When on, the service proposes turn
boundaries (
ProposedUserStartedSpeakingFrame and
ProposedUserStoppedSpeakingFrame) and recommends
ExternalUserTurnStrategies to the user aggregator.GradiumSTTService.Settings
default:"None"
Runtime-configurable settings for the STT service. See Settings
below.
float
default:"GRADIUM_TTFS_P99"
P99 latency from speech end to final transcript in seconds. Override for your
deployment. See stt-benchmark.
Settings
Runtime-configurable settings passed via thesettings constructor argument using GradiumSTTService.Settings(...). These can be updated mid-conversation with STTUpdateSettingsFrame. See Service Settings for details.
The turn detection settings (eot_horizon_s, eot_threshold, post_flush_cooldown_frames) are None unless the service is constructed with enable_turn_detection=True, which gives them their defaults.
Usage
Basic Setup
With Language and Delay Configuration
With Server-Side Turn Detection
Notes
- Supported languages: German, English, Spanish, French, and Portuguese.
- Audio format: Configurable via
encodingandsample_rateparameters. Defaults to PCM with the pipeline’s sample rate. Supported PCM rates: 8000, 16000, and 24000 Hz. Audio is sent in 80ms chunks. - Turn detection: With
enable_turn_detection=True, the server’s end-pointing signal decides when user turns start and end. The service broadcastsProposedUserStartedSpeakingFramewhen a turn opens andProposedUserStoppedSpeakingFramewhen it closes, then flushes the server. The finalTranscriptionFramefollows once the flush is acknowledged. Local VAD frames are ignored. The service recommendsExternalUserTurnStrategies, which resolve the proposals into user turn frames and hold the turn open until the transcript arrives.