Early access. A5S Streaming v1 is available on request to select organizations. Accounts without access get
model_access_denied (close code 4403). To request access, talk to sales.wss://api.aircaps.com/v1/realtime · Model id: a5s-streaming-v1
Protocol
1
Connect
Open the WebSocket with your key in the handshake header:
Authorization: Bearer aircaps_sk_...2
Send start
The first message is JSON.
model is optional: it defaults to a5s-streaming-v1.3
Wait for ready
The server may send
provider_status messages while the session starts, then ready. Do not send audio before ready.4
Stream audio
Send binary frames of mono 16 kHz signed 16-bit little-endian PCM, in real time. 20 ms frames (640 bytes) are recommended; frames may be at most 64 KB. Send
{"type": "ping"} to keep the connection open while you have no audio to send.5
Finish
Send
{"type": "finish"}. The server sends the final transcript, then a finished message, and closes.ready confirms the model and the language the session runs in:
Messages from the server
text is always the complete transcript so far; replace what you display rather than appending.
For long sessions, set "transcript_text": "incremental" in start so messages stay small. Each transcript then carries an edit instead of text: remove text_delete characters from the end of the text you have, then append text_append. The result is always the complete transcript so far.
The server sends a
transcript only when the text changes. During silence, music or other audio without speech, nothing arrives, for as long as it lasts: minutes, if the audio is quiet that long. Keep streaming audio; to check that the connection is still alive, use ping (see Retrying), not the time since the last transcript.
Languages
- A region on another language’s code decodes as that language:
es-MXises,pt-BRispt. - Any other value ends the session with
unsupported_language(close code 4400). - Each utterance carries the
languageit was transcribed in.
Speaker labels
A5S Streaming v1 always tracks who is speaking: its transcript is built speaker by speaker. Always set"diarization": true. It costs no extra usage or latency, and every transcript then carries utterances and speakers alongside the complete text. Without it, you get only text.
- Utterances with
is_final: truebecame final since the previous message. Each is sent once and never changes: keep it. - Utterances with
is_final: falseare pending and may still change. Replace the previous pending ones each time. - Show the kept final utterances and the latest pending ones, ordered by
start.
Utterances become final at natural pauses and at turn changes. A single turn becomes final after at most 30 seconds. Per-word timestamps and speaker names are not included yet: names from enrolled voices are only on A5S Async v1 transcripts.
Written forms
Set"smart_format": true to write numbers, dates, times, money and percentages the way people write them in final English text: in English sessions. For example, “twenty five dollars” becomes “$25”, and “ten percent” becomes “10%”.
Interim (pending) text, and other languages, keep the model’s standard written forms.
Key terms
Key terms help the model recognize names and jargon. Send up to 40 incustom_vocabulary:
- Key terms work in English sessions. A session in another language that sends key terms ends with
invalid_start(close code 4400). - More than 40 entries ends the session with
invalid_start(close code 4400). - Each entry is a
textof up to 100 characters.strengthis optional and ignored: every term weighs the same.
Rules
- Send the
startmessage within 45 seconds of connecting. It accepts only the documented fields. - Audio must arrive in real time; sending faster (beyond a 2-second burst) ends the session with
realtime_rate_exceeded. - A session can last up to 30 minutes (
session_limit); open a new one to continue. Longer sessions, up to 1 hour, are available on request (talk to sales). Your account’s session length ismax_session_secondsinGET /v1/account. - No messages (audio or
ping) for 45 seconds ends the session withidle_timeout. - At most 5 live sessions per account at once.
Errors
Every session that ends abnormally sends anerror message with a code, then closes with the matching WebSocket close code.
A normal session ends with
finished and close code 1000.
Retrying
Close code 1013 means try again, whether the session was starting or already streaming: open a new session, waiting longer between attempts (for example 1 s, 2 s, 4 s … up to 30 s, with some jitter). Do the same if the connection can’t be opened (for example a handshake timeout, or a refused or reset connection) or drops without a close message. A session that ends early counts only the audio you streamed. A connection can also go quiet without closing. Silent audio gives no transcripts either, so check withping rather than a timer on transcripts: if nothing arrives from the server for 30 seconds, send {"type": "ping"}; if no pong arrives within 10 seconds, close the connection and open a new session as above.
