Skip to content
denthub STTDeveloper Platform

API Reference

Connection

FieldValue
Endpointwss://api.denthub.ai/stt/realtime/stream
Query?key=<key>
AudioPCM16LE · 16000 Hz · mono · binary frames
Max conns/pod200 (HTTP 503 when exceeded)

start↑ first frame (text)

FieldTypeRequiredValue
typestringyes"start"
sample_rateintyes16000
codecstringyes"pcm_s16le"
channelsintyes1

audio↑ binary frames

Send raw PCM16LE bytes as binary WebSocket frames — no WAV header, no base64, no JSON wrapping. Any frame size works; send continuously, without gating on silence yourself.

The gateway re-frames your stream internally into 32 ms VAD windows and detects utterance boundaries server-side, so you never need to run your own voice-activity detection.

end↑ graceful close (text)

Send this text frame to flush any pending utterance and close cleanly. After sending it, you may close the WebSocket yourself, or wait for the server to close it once flushing finishes.

{ "type": "end" }

result↓ one per utterance

{
  "type": "result",
  "utt_index": 0,
  "session_id": "b1f7…",
  "abs_start_utc": "2026-07-10T05:12:01.80Z",
  "abs_end_utc":   "2026-07-10T05:12:05.20Z",
  "duration_ms": 3400,
  "text": "Patient presents with sensitivity on the upper right quadrant.",
  "segments": [
    { "start_ms": 800, "end_ms": 4200,
      "text": "Patient presents with sensitivity…", "language": "en" }
  ],
  "words": [ { "word": "Patient", "start_ms": 800, "end_ms": 1180 }, … ],
  "status": "ok",
  "forced_cut": false,
  "continues": false
}
FieldTypeDescription
utt_indexint0-based, monotonic per connection
session_iduuidConnection session ID
abs_start_utc / abs_end_utcstring (ISO 8601)Absolute utterance start/end (UTC)
duration_msintUtterance duration (sample-derived)
textstringFull transcription text
segments[]arraystart_ms / end_ms / text / language, recording-relative
words[]arrayword / start_ms / end_ms, recording-relative
statusstring"ok" · "empty" · "failed"
forced_cutbooltrue if the utterance was force-split at max length
continuesbooltrue if the next utt_index continues this utterance
Every timestamp here — abs_*_utc, and each start_ms/end_ms inside segments[] and words[] — is recording-relative, derived from a sample-count clock, not message-arrival time. Use these to line results up against the audio you sent, even under network jitter.

↓ session · warning · error

{"type":"session","event":"started","session_id":"…"}   // started · ended
{"type":"warning","code":"SLOW_CONSUMER"}                  // backpressure
{"type":"utterance_dropped","utt_index":8,"code":"STT_OVERLOAD"}
{"type":"error","utt_index":9,"code":"STT_TIMEOUT","message":"…","retryable":true}
  • session — connection lifecycle: started and ended.
  • warning — backpressure signal (SLOW_CONSUMER): you're sending audio faster than the gateway can process; slow down or check your network.
  • utterance_dropped — the STT backend was overloaded and this utterance was skipped; the gap in utt_index tells you which one.
  • error — a per-utterance failure; check retryable to decide whether to wait or move on.

Close codes

CodeMeaning
1000Normal close, after you sent end
1001Going away — server is draining; reconnect to a new session
1011Internal error — log it and reconnect