Skip to content

API reference

Streaming WebSocket

wss://api.shihab.co.uk/v1/listen/stream reference.

WSS /v1/listen/stream

WSSwss://api.shihab.co.uk/v1/listen/stream

Real-time transcription over WebSocket. Scope: stream. Guide with examples: Real-time streaming.

Query parameters

  • modelstringOptionalDefault: shihab-asr-v1
    The model: shihab-asr-v1, the only one (you can leave it out).
  • languagestringOptionalDefault: ar
    ar, or ar-XX for any Arab country (ar-PS, ar-EG, ar-MA ...).
  • encoding"linear16" | "mulaw" | "alaw" | "opus"OptionalDefault: linear16
    linear16: 16-bit little-endian PCM. mulaw, alaw: telephony (usually 8 kHz). opus: Ogg or WebM container from a browser MediaRecorder.
  • sample_rateintegerOptionalDefault: 16000
    8000 to 48000. Ignored for opus.
  • channelsintegerOptionalDefault: 1
    1, or 2 to have us downmix interleaved stereo.
  • interim_resultsbooleanOptionalDefault: true
    Send partial transcripts while someone is still speaking.
  • endpointinginteger (ms)OptionalDefault: 800
    300 to 3000. Milliseconds of silence that end an utterance (speech_final). Lower is snappier for voice agents; higher suits dictation.
  • vad_eventsbooleanOptionalDefault: false
    Send SpeechStarted when speech begins.
  • numeralsbooleanOptionalDefault: false
    Digits instead of number words.
  • tagstring (repeatable)Optional
    Up to 5 tags for your logs.
  • tokenstringOptional
    A temporary token (sht_...) for browsers, instead of a header.
Parameter

Messages

Client to server

MessageMeaning
binaryAudio frames.
{"type":"KeepAlive"}Keep the stream open without audio.
{"type":"Finalize"}Flush the current utterance as final.
{"type":"CloseStream"}End of audio; Finished follows.

Server to client

JSON
{"type":"Metadata","request_id":"req_01JA...","model":"shihab-asr-v1","model_version":"1.1.0","created":"2026-10-12T12:00:00Z"}
{"type":"SpeechStarted","timestamp":3.12}
{"type":"Results","is_final":false,"speech_final":false,"start":3.1,"duration":1.4,"transcript":"مرحبا بدي"}
{"type":"Results","is_final":true,"speech_final":true,"start":3.1,"duration":2.9,"transcript":"مرحبا، بدي أسأل عن طلبيتي."}
{"type":"UtteranceEnd","last_word_end":6.0}
{"type":"Finished","request_id":"req_01JA...","audio_seconds":61.2,"billed_seconds":62,"cost_usd":"0.0186"}

Close codes

CodeMeaning
1000Normal close after CloseStream (or by you).
1011Server error. Reconnect with backoff.
4001Authentication failed: missing, invalid or expired key or token.
4002Out of credit (an Error message with insufficient_credits comes first).
4008Idle: no audio and no KeepAlive for 15 seconds.
4013Stream longer than 3 hours.
4029Too many concurrent streams or requests.
4400Invalid query parameters.

Need help? Email [email protected] or message us on WhatsApp.