Skip to main content

STT WebSocket API

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

🚀 Quick Start (Copy & Paste)

That’s it! You’ll see:
  • ✅ Authenticated
  • ✅ Ready! Send audio now
  • 📝 Hello world (transcribed text)
  • ✅ Complete! Cost: $0.000043

📖 How It Works (5 Simple Steps)

  1. Connect with your API key
  2. Send { type: "start", ... } to begin session
  3. Stream audio data (binary chunks)
  4. Receive text transcriptions in real-time
  5. 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.
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:

    Pricing

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