Skip to main content

STT WebSocket

Real-time Speech-to-Text transcription via WebSocket streaming with support for 99+ languages and telephony integration.

Endpoint

Authentication

Query parameter authentication: Example:

Connection Details

The same port accepts plain HTTP GET requests and responds 200 ok — safe for load-balancer health checks.

Session Lifecycle

Client → Server Messages

start — Begin session

Sent once after connection is established. Must be sent before any audio.
Parameters:

audio — JSON audio chunk (browser mode)

Fields:

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

Both languages and continuous_mode are optional; include only fields you want to change. Send "languages": null to revert to auto-detect.

stop — End session

Server processes any remaining audio buffer, sends session_stopped, then closes.

test — Ping / latency check

Server echoes test_response with the same timestamp for round-trip measurement.

Server → Client Messages

connecting — Authentication in progress

connection_established — Authentication successful

Fields:
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

Use this for barge-in: interrupt TTS playback when this arrives. Fired after 2 consecutive VAD-positive chunks (~64ms of confirmed speech).

transcription — Transcription result

All results (interim and final) share the same transcription type — differentiate with flags. Final result (is_final=true, speech_final=true):
Empty speech_final signal (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.
Interim result (is_final=false, speech_final=false) — only sent when interim_results_frequency is set:
Use interims only for barge-in word-count checks. Never send interim text to the LLM — a final with 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: Mixed-language text is supported. Language aliasing: Urdu (ur) is treated as Hindi (hi), Malay (ms) as Indonesian (id).

    Limitations and Best Practices

    utterance_end_ms Values below 300ms are silently clamped to 300ms. Recommended 500ms for voicebots. Lower values cause premature sentence cuts and fragmented transcriptions. Language count Max 2 languages recommended. More languages = proportionally more latency per utterance. Telephony confidence 8kHz μ-law → 16kHz resampling reduces Whisper confidence by ~0.10–0.15 compared to browser audio. Apply a client-side threshold of 0.35 for telephony (vs 0.45–0.55 for browser). Buffer limits
    • Minimum buffer to trigger transcription: 0.8s of audio
    • Maximum buffer before force-processing: 5.0s
    • Pre-speech ring buffer: 1.0s (captures first word before VAD fires)
    VAD thresholds
    • Speech start: Silero probability > 0.50 (requires 2 consecutive frames, ~64ms)
    • Speech continuation: probability > 0.40
    • Grace period: 6 chunks (192ms) of sub-threshold audio before speech_end is declared
    Model Whisper large-v3, int8_float16 quantization, CTranslate2 backend. Expected latency: 300–600ms from speech_end to final result (GPU), 1–3s (CPU).

    Pricing

    • Rate: $0.00000833 per second
    • Minimum: $0.01 per session
    • Billing: Per second of audio processed

    Error Codes

    Testing

    Then send: