Skip to main content

Connection and session

WebSocket endpoint:
The server accepts the optional realtime WebSocket subprotocol.

Session configuration

Configure the session with session.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 as bai-client-secret.<EPHEMERAL_KEY>. Ephemeral keys start with bai-eph-.

Minting an ephemeral key

Ephemeral keys let browser and mobile clients connect directly without ever seeing your real API key. From your backend, call POST /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):
Response:
Hand the 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, set audio.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 is billed as usage of the specified model. When 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: Server → Client: See the complete event catalog and payload schemas in the Realtime API reference: client events and server events.

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.