STT WebSocket API
Real-time Speech-to-Text transcription via WebSocket streaming with support for 99+ languages and telephony integration.🚀 Quick Start (Copy & Paste)
- ✅ Authenticated
- ✅ Ready! Send audio now
- 📝 Hello world (transcribed text)
- ✅ Complete! Cost: $0.000043
📖 How It Works (5 Simple Steps)
- Connect with your API key
- Send
{ type: "start", ... }to begin session - Stream audio data (binary chunks)
- Receive text transcriptions in real-time
- Stop with
{ type: "stop" }when done
Endpoint
Authentication
Query parameter authentication: Example:Connection Details
Session Lifecycle
Client → Server Messages
start — Begin session
Sent once after connection is established. Must be sent before any audio.
audio — JSON audio chunk (browser mode)
Binary frame — raw μ-law audio (telephony mode)
Send a raw WebSocket binary frame with μ-law bytes, no JSON wrapper. The server auto-detects this as telephony mode on the first binary frame.config — Change language mid-session
languages and continuous_mode are optional; include only fields you want to change.
Send "languages": null to revert to auto-detect.
stop — End session
session_stopped, then closes.
test — Ping / latency check
test_response with the same timestamp for round-trip measurement.
Server → Client Messages
connecting — Authentication in progress
connection_established — Authentication successful
string
Service name:
"stt"integer
Your user ID
number
Available credits
string
Workspace name
connected — After start message is processed
speech_started — VAD detected voice activity
transcription — Transcription result
All results (interim and final) share the same transcription type — differentiate with flags.
Final result (is_final=true, speech_final=true):
text="", is_final=true, speech_final=true):
Sent when audio was detected but transcription was rejected (silence, hallucination, low confidence, wrong language).
Client should reset its state on this message and not treat it as an error.
is_final=false, speech_final=false) — only sent when interim_results_frequency is set:
is_final=true, speech_final=true will follow.
Response Fields:
string
Transcribed text. Empty string = speech-end-no-result signal.
number
0.0–1.0. Telephony typically 0.35–0.75; browser 0.55–0.95.
string
Detected language code e.g.
"en".string
Uppercase language code e.g.
"EN".boolean
true = complete utterance transcription or end-of-speech signal.boolean
true when speech segment fully processed. Always matches is_final for finals.boolean
true for interim results only.integer
Monotonically increasing counter per session.
number
Duration (seconds) of the audio segment transcribed.
number
Seconds from processing start to result ready (excludes queue time).
array
Word-level timestamps
[{word, start, end, probability}]. Present on finals when available.integer
Timestamp (ms) of last word in the utterance.
string
Internal mode string — useful for debugging.
language_changed — After config message changes language
mode_changed — After config message changes continuous_mode
session_stopped — After stop is processed
error — Processing error
test_response — Reply to test ping
Complete Example
Audio Requirements
Supported Languages
The service supports 99+ languages via Whisper auto-detection. Common languages include:Pricing
- Rate: $0.00000833 per second
- Minimum: $0.01 per session
- Billing: Per second of audio processed
Related
- TTS WebSocket - Text-to-Speech endpoint
- WebSocket Quick Start - Get started guide
- WebSocket Playground - Test in browser