Connection
- Server-side (bearer token):
Authorization: Bearer <project-scoped runtime API key>. - Browser (ephemeral ticket):
Sec-WebSocket-Protocol: opper-ticket.<value>subprotocol header (recommended), or?ticket=<value>query parameter (fallback — bearer credentials in URLs end up in access logs). Tickets are minted byPOST /v3/realtime-sessionsand are single-use.
101 Switching Protocols. The first frame the client sends must be session.start.
Client → server events
session.start config
Server → client events
Termination codes
session.terminating.error.code is a closed set; you can enumerate against it:
Sample payloads
Every event is a JSON object over a text WebSocket frame. Field shapes below are the source of truth for client implementations and agent code generation — match these exactly.Client → server
session.start
session.update
audio.append
text.input
tool.result
Server → client
session.started
audio.delta
text.delta
transcript.committed
speech.started
response.started
tool.call
session.terminating
error
Preflight rejections
Before the WebSocket upgrade, the endpoint returns standard HTTP status codes:See also
- Realtime voice guide — full journey including authentication, session lifecycle, tool flow, billing, per-provider notes, and a working TypeScript example.
- brainstorm-time cookbook — complete end-to-end voice app.