wss://api.aircaps.com/v1/realtime
Requires access to A5S Small V2 Streaming. For a walkthrough, see Live streaming.
Connection
string
required
Bearer aircaps_sk_..., sent with the WebSocket handshake.start, wait for ready, stream binary audio, send finish, then receive finished. The server then closes with 1000.
Client messages
start
The first message, as a JSON text frame, within 45 seconds of connecting. Unknown fields are rejected.string
required
"start"string
default:"en"
Language of the audio. English only today:
en. Multilingual support is planned.string
default:"pcm_s16le"
Only
pcm_s16le (signed 16-bit little-endian PCM).integer
default:"16000"
Only
16000.integer
default:"1"
Only
1 (mono).string[]
default:"[\"a5sv2\"]"
The streaming engine. Only
"a5sv2".boolean
default:"false"
Turns on key terms: biases recognition toward the entries in
custom_vocabulary.boolean
default:"false"
Label who said what. Each
transcript then also carries utterances with a speaker on every utterance and word, and speakers. See Speaker labels.string
default:"full"
"full": every transcript carries the complete transcript so far in text. "incremental": every transcript instead carries an edit of the text you have: text_delete and text_append (below). Use "incremental" for long sessions: in "full" mode each message grows with the transcript.boolean | object
default:"false"
Put names on the speakers with AirCaps Speaker ID-v1 (requires access to that model, and
"diarization": true). true uses the defaults. Sends a speaker_identification message (below) for each stretch of a speaker’s speech, and adds speaker_id and speaker_name to utterances. See Speaker names.Example
Audio
Binary frames of raw PCM in thestart format: non-empty, an even number of bytes, at most 64 KB (larger frames end the session with frame_too_large; frames over 1 MB close the connection without a message). Send them after ready, in real time; a 2-second burst is allowed. 20 ms frames (640 bytes) are recommended.
ping
{"type": "ping"}. The server answers pong. Any message, audio or ping, resets the 45-second idle timer.
finish
{"type": "finish"}. The server flushes the final transcript, sends finished, and closes.
Server messages
Each is a JSON text frame with atype.
provider_status
Startup progress while the session starts.string
For example
"Getting things ready, please hold on".ready
Start sending audio.integer
Maximum audio for this session: your session length (30 minutes unless your account has a longer one, up to 4 hours), or less if little free usage and credit remain.
string
"full" or "incremental", as requested in start.integer
The account’s free usage, in milliseconds.
integer
Free usage used so far, in milliseconds.
string
"en-US"integer
16000string
"pcm_s16le"boolean
Whether speaker labels are on for this session.
object
Only with
speaker_identification: model ("aircaps-speaker-id-v1"), threshold, speaker_ids (null for every enrolled speaker) and speakers_compared.object[]
Only when
start named a deprecated model id (a5s-v2-streaming, now a5s-small-v2-streaming): {code, message} with code "model_deprecated". The session runs normally.transcript
string
With
transcript_text "full" (the default): the complete transcript so far, punctuated and cased. Replace what you display instead of appending.integer
With
transcript_text "incremental": remove this many characters from the end of the text you have (recent words the engine revised; often 0).string
With
"incremental": then append this. The result is the complete transcript so far, as text would have been.boolean
true when the current segment is settled.string
"a5sv2"object[]
Only with
diarization. The utterances that became final since the previous transcript (is_final: true; each is sent once and never changes), followed by every pending utterance (is_final: false; these may still change, so replace the previous pending ones). Keep the final ones and show them with the latest pending ones, ordered by start.string[]
Only with
diarization. The speaker labels used so far in final utterances.Example
Example with diarization
speaker_identification
Only withspeaker_identification. One decision for a stretch of one speaker’s speech, usually sent about a second after it ends, named or not.
string
The speaker label, as in utterances.
number
Start of the stretch, in seconds from the start of the session.
number
End of the stretch, in seconds from the start of the session.
string | null
The enrolled speaker it was named as, or
null.string | null
That speaker’s name, or
null.number | null
The best match’s similarity score, -1 to 1.
number | null
How far the best score is above the next-best;
null with one enrolled speaker.object[]
Up to 3 closest enrolled speakers, best first:
{speaker_id, name, score}.number
Seconds of speech compared.
string
accepted, score (best score not above threshold), margin (too close to the next-best), or error (this stretch could not be compared; the session goes on).Example
session_limit
The session reached its session length (30 minutes unless your account has a longer one) or the account’s usage limit. The final transcript andfinished follow, then close code 1000.
string
Why the session ended.
finished
integer
Audio received.
integer
Audio counted toward usage.
integer
Free usage used after this session.
integer
The account’s free usage.
provider_error
Streaming failed during the session. Anerror follows.
string
What failed.
error
Sent before the server ends the session abnormally; the connection then closes with the matching close code.string
One of the codes below.
string
Human-readable detail.
pong
The reply toping.

