Connection and session
WebSocket endpoint:realtime WebSocket subprotocol.
Session configuration
Configure the session withsession.update (field paths relative to session):
Authentication
Authentication supports two methods:- API key (server-side): pass an
Authorization: Bearer <API_KEY>header when opening the WebSocket. - Ephemeral key (client-side, recommended for browsers): mint a short-lived key server-side via
POST /v1/realtime/client_secrets, then pass it from the browser in the WebSocket subprotocol list asbai-client-secret.<EPHEMERAL_KEY>. Ephemeral keys start withbai-eph-.
Minting an ephemeral key
Ephemeral keys let browser and mobile clients connect directly without ever seeing your real API key. From your backend, callPOST /v1/realtime/client_secrets with your API key. The body is optional — expires_after.seconds sets the key’s TTL (10–7200 seconds, default 600):
value to your client, which uses it in the bai-client-secret.<value> subprotocol as shown above. The key expires at expires_at (Unix seconds) — mint a fresh one per connection. If the key is invalid or expired, the WebSocket closes with code 3000.
Model selection
Session model
higgs-realtime is currently the only supported session model. Set it with the ?model= query parameter when connecting (wss://api.boson.ai/v1/realtime?model=higgs-realtime), or in session.update (which overrides the URL):
Input transcription model
The session works entirely in audio — you do not need a transcription model to converse. Optionally, setaudio.input.transcription.model to higgs-stt-3.1 to receive text transcripts of the user’s audio as conversation.item.input_audio_transcription.completed events (useful for captions, logging, or moderation):
transcription.model is unset, no transcription events are emitted and no transcription charges apply.
An optional transcription.language hint biases the transcript toward a language — pass an ISO-639-1 code ("ja", "ko"); unrecognized values are ignored. This is a transcription hint only, not a conversation-language setting: the model detects the spoken language automatically and replies in kind, and after the first reply the transcription language follows the conversation automatically.
WebSocket events
Communication uses JSON-encoded events. Key event types: Client → Server:session.update– Configure the session (model, voice, instructions, audio formats, tools, turn detection)input_audio_buffer.append– Stream base64 audio chunks (max ~1 MiB base64 per append, ≈15 s of 24 kHz PCM)input_audio_buffer.commit/input_audio_buffer.clear– Manual turn controlconversation.item.create– Inject user or assistant text messages, or function-call resultsresponse.create– Request a model responseresponse.cancel– Cancel an in-flight response
session.created/session.updated– Session initialization and config acksinput_audio_buffer.speech_started/speech_stopped– Server VAD eventsresponse.output_audio.delta– Streaming audio chunks (base64)response.output_audio_transcript.delta– Streaming transcript of the spoken responseresponse.function_call_arguments.done– Tool invocation readyresponse.done– Turn completionerror– Session errors
Client events
Every event you send: fields, types, and the full session configuration object.
Server events
Every event you receive: session, audio, response lifecycle, tool calls, and errors.