Realtime requires a channel configured with a Realtime-capable provider (OpenAI or Azure OpenAI). Contact your Anyone administrator if the WebSocket connection is rejected.
Connecting
Endpoint:GET /v1/realtime
Upgrade an HTTP GET request to a WebSocket connection. You can pass your API key as a query parameter or as an Authorization header in the WebSocket handshake.
Authentication
Pass your API key in one of the following ways:- Query parameter:
?token=YOUR_TOKEN - Authorization header:
Authorization: Bearer YOUR_TOKEN(set during the HTTP upgrade handshake)
Event types
Once connected, you exchange JSON event messages. Each message has atype field that identifies its purpose. The following are the core event types.
Client → server
Server → client
Session configuration
After connecting, send asession.update event to configure the session:
string[]
The interaction modes to enable. For example,
["text", "audio"].string
System-level instructions that guide the model’s behavior for the session.
string
The voice to use for audio output. For example,
alloy, echo, nova, or shimmer.string
Format of the audio you send. For example,
pcm16, g711_ulaw, or g711_alaw.string
Format of the audio the model returns. For example,
pcm16.object
Configuration for transcribing your audio input.
object | null
Controls how the server detects end-of-turn in audio input. Set to
null to disable automatic turn detection and manage it manually.object[]
A list of tool definitions available to the model during this session, following the OpenAI function-calling schema.
string
Controls when the model uses tools.
auto, none, or a specific tool name.number
Sampling temperature for the model. Defaults to
0.8.Usage tracking
When the model finishes a response, theresponse.done event includes a usage object:
integer
Total tokens consumed by this response turn.
integer
Tokens in the input (audio + text).
integer
Tokens in the model’s output (audio + text).
object
Breakdown of input token types (e.g., cached, audio).
object
Breakdown of output token types (e.g., audio, text).
Example
The following JavaScript example connects to the Realtime endpoint, configures a session, and logs events as they arrive.javascript

