Read session status, voice responses, and task execution results.
Receive JSON events over the control WebSocket. When using WebRTC or AOQ, wait for
After the connection is established, the service returns default session information. After sending
The session configuration has taken effect. Use the returned configuration.
Input is muted.
Input is unmuted.
Receives the transcription of user speech.
Receives subtitles for the frontend voice reply. Subtitle timestamps are used to locate positions on the session timeline.
Receives an audio chunk from the frontend voice.
The frontend model dispatches a task. This event is received in both Client mode and Responses mode. When returning the task result, use the
Receives frontend function calls. Uses
Receives backend generation or task events. The inner
Service has accepted the task progress. For request
Service has accepted the follow-up content. For request
Service has accepted the result or text. For request
After session activation, the service reports cumulative billing duration every 5 seconds; reports are also sent during idle periods. The current value takes the latest
The session has ended. Stop sending events and release resources. To continue the conversation, establish a new connection and initialize a new session.
Check the request and session status based on the error code. After receiving a close event, reestablish the connection.
session.updated on that WebSocket. Once the media connection is ready, you can also receive server events over the WebRTC DataChannel or the AOQ data track.
Handle events according to type. The client_event_id in the acknowledgment corresponds to the event_id in the request. The event_id of each server-side event uniquely identifies that event.
session.created
After the connection is established, the service returns default session information. After sending session.update, wait for session.updated to confirm that the configuration has taken effect.
type (string, Required)
Event type; fixed value: session.created.
event_id (string, Required)
Server-side event ID.
session (object, Required)
Default session information.
View child fields
View child fields
id (string, Required)Business session ID. AOQ Relay uses an independent sid.object (string, Required)Compatible object name, e.g., realtime.session.model (string, Required)Deployed default frontend voice model.modalities (array, Returned per model)Output modality.voice (string, Returned per model)Default voice style.turn_detection (object, Returned per model)Default turn detection configuration. The detection settings below are returned when type is server_vad.View child fields
View child fields
type (string)Turn detection type.threshold (number)Voice activity detection threshold.prefix_padding_ms (integer)Length of audio retained before the detected speech start, in milliseconds.silence_duration_ms (integer)Duration of silence required to detect the end of speech, in milliseconds.create_response (boolean)Whether to generate a reply automatically when speech ends.interrupt_response (boolean)Whether to interrupt an ongoing reply when the user starts speaking.input_audio_transcription (object, Returned per model)Audio transcription capability and its default configuration.View child fields
View child fields
model (string)Model used to transcribe input audio.model_inference (boolean, Required)The service supports integration with models. Inference and interaction begin only after the session configuration takes effect.session.updated
The session configuration has taken effect. Use the returned configuration.
type (string, Required)
Event type; fixed value: session.updated.
event_id (string, Required)
Server-side event ID.
session (object, Required)
Effective session configuration, including session metadata and task mode.
View child fields
View child fields
id (string, Required)Business session ID.model (string, Required)Effective frontend voice model.object (string, Returned per configuration)Session object type.modalities (array, Returned per configuration)Effective output modality.delegation (object, Required)Task mode.View child fields
View child fields
type (string, Required)client or responses.transport (object, Returned per configuration)Returns connection information for the selected transmission method.View child fields
View child fields
type (string, Returned per configuration)When using WebRTC, the value is rtc.sdp (string, Returned per configuration)When using WebRTC, returns the Answer SDP. The client sets it as the remote description. For details, see WebRTC access.aoq (object, Returned per configuration)When using AOQ, returns temporary connection information. Use the returned sid and temporary credentials to initiate the AOQ connection within 5 minutes of receiving session.updated. For steps to connect, see AOQ access.View child fields
View child fields
sid (string)AOQ session ID.aoqTokenForClient (string)Temporary token that the client uses to connect to the Relay.clientRelayCertFingerprint (string)Fingerprint of the Relay’s TLS certificate.clientRelayEndpoints (array)List of Relay addresses for the connection.View child fields
View child fields
endpoint (string)Relay address.port (integer)Relay port.route_index (integer)Relay route index.extraInfo (object)Additional connection information.View child fields
View child fields
workspaceIdHash (string)Hash of the workspace.- WebSocket
- WebRTC (excerpt)
- AOQ (excerpt)
session.input_audio.muted
Input is muted.
type (string, Required)
Event type; fixed value: session.input_audio.muted.
event_id (string, Required)
Server-side event ID.
client_event_id (string, Optional)
Corresponds to the client’s requested event_id.
session.input_audio.unmuted
Input is unmuted.
type (string, Required)
Event type; fixed value: session.input_audio.unmuted.
event_id (string, Required)
Server-side event ID.
client_event_id (string, Optional)
Corresponds to the client’s requested event_id.
session.input_transcript.delta
Receives the transcription of user speech.
type (string, Required)
Event type; fixed value: session.input_transcript.delta.
event_id (string, Required)
Server-side event ID.
delta (string, Required)
The transcription text returned in this response.
start_ms (number, Required)
Start time on the session timeline, in milliseconds.
end_ms (number, Required)
End time on the session timeline, in milliseconds.
session.output_transcript.delta
Receives subtitles for the frontend voice reply. Subtitle timestamps are used to locate positions on the session timeline.
type (string, Required)
Event type; fixed value: session.output_transcript.delta.
event_id (string, Required)
Server-side event ID.
delta (string, Required)
The reply text returned in this response.
start_ms (number, Required)
Start time on the session timeline, in milliseconds.
end_ms (number, Required)
End time on the session timeline, in milliseconds.
session.output_audio.delta
Receives an audio chunk from the frontend voice.
type (string, Required)
Event type; fixed value: session.output_audio.delta.
event_id (string, Optional)
Server-side event ID.
delta (string, Required)
Base64-encoded 24 kHz mono PCM16LE raw audio. After decoding, the byte count is even. The audio has no WAV file header.
start_ms (number, Required)
Start time on the session timeline, in milliseconds.
end_ms (number, Required)
End time on the session timeline, in milliseconds.
session.delegation.created
The frontend model dispatches a task. This event is received in both Client mode and Responses mode. When returning the task result, use the delegation_id from the corresponding task event.
type (string, Required)
Event type; fixed value: session.delegation.created.
event_id (string, Required)
Server-side event ID.
offset_ms (number, Required)
The offset of this dispatch on the session timeline, in milliseconds.
delegation_id (string, Required)
The task ID associated with this dispatch.
task_id (string, Optional)
Task ID. Used in the return payload as delegation_id.
summary (string, Returned upon task dispatch)
Summary of the dispatched task in this response.
context (object, Returned upon task dispatch)
Context snapshot at the time the task is accepted.
View child fields
View child fields
summary (string, Required)Context summary.messages (array[object], Returned upon task dispatch)Context messages.View child fields
View child fields
seq (integer)Sequence number of the message in the context.item_id (string)Message item ID.role (string)Role of the message sender.source (string)Source of the message.audio_start_ms (integer)Start offset of the audio on the session timeline, in milliseconds.audio_end_ms (integer)End offset of the audio on the session timeline, in milliseconds.playback (string)Audio playback status.content (string)Message text.incomplete (boolean)Whether the context snapshot is incomplete.truncated (boolean)Whether the context snapshot was truncated.supplements (array, Returned per task)
Additional content accepted in this batch and their respective contexts.
View child fields
View child fields
summary (string, Required)Supplementary content summary.context (object, Returned upon task dispatch)Context snapshot at the time the task is accepted.View child fields
View child fields
summary (string, Required)Context summary.messages (array, Returned upon task dispatch)Context messages.arguments (string, Optional)
Compatible field. A JSON string that may contain summary.
session.event
Receives frontend function calls. Uses call_id to correlate results.
type (string, Required)
Event type; fixed value: session.event.
event_id (string, Required)
Server-side event ID.
client_event_id (string, Optional)
Corresponds to the client’s requested event_id.
event (object, Required)
Frontend model function call event.
View child fields
View child fields
type (string, Required)Inner event name.item (object, Returns per event.)Function call item.View child fields
View child fields
type (string, Required)The function call item is function_call.name (string, Required)Function name.call_id (string, Required)Call ID.arguments (string, Required)Function arguments in JSON string format.id (string, Returns per event.)Call item ID.status (string, Returns per event.)Call item status.output_index (number, Returns per event.)Output location of the call item.response_id (string, Returns per event.)Frontend response ID.response.event
Receives backend generation or task events. The inner response.completed indicates the end of backend generation. Frontend voice responses have their own subtitle and audio events.
type (string, Required)
Event type; fixed value: response.event.
event_id (string, Required)
Server-side event ID.
delegation_id (string, Returns per event.)
Associated task ID.
client_event_id (string, Optional)
Corresponds to the client’s requested event_id.
event (object, Required)
Backend native event or task event.
View child fields
View child fields
type (string, Required)Inner event name.response (object, Returns per event.)Backend response. Fields vary by event.View child fields
View child fields
id (string, Returns per event.)Backend response ID.usage (object, Optional)Backend model token usage.View child fields
View child fields
input_tokens (integer, Returns per event.)Number of input tokens consumed by the backend model.output_tokens (integer, Returns per event.)Number of output tokens generated by the backend model.total_tokens (integer, Returns per event.)Total number of input and output tokens.session.thinking.appended
Service has accepted the task progress. For request session.thinking.append, the acknowledgment can be matched using the associated field.
type (string, Required)
Event type; fixed value: session.thinking.appended.
event_id (string, Required)
Server-side event ID.
start_ms (number, Required)
Start time on the session timeline, in milliseconds.
end_ms (number, Required)
End time on the session timeline, in milliseconds.
client_event_id (string, Optional)
Corresponds to the client’s requested event_id.
session.instructions.appended
Service has accepted the follow-up content. For request session.instruction.append, the acknowledgment can be matched using the associated field.
type (string, Required)
Event type; fixed value: session.instructions.appended.
event_id (string, Required)
Server-side event ID.
start_ms (number, Required)
Start time on the session timeline, in milliseconds.
end_ms (number, Required)
End time on the session timeline, in milliseconds.
client_event_id (string, Optional)
Corresponds to the client’s requested event_id.
session.commentary.appended
Service has accepted the result or text. For request session.commentary.append, the acknowledgment can be matched using the associated field.
type (string, Required)
Event type; fixed value: session.commentary.appended.
event_id (string, Required)
Server-side event ID.
start_ms (number, Required)
Start time on the session timeline, in milliseconds.
end_ms (number, Required)
End time on the session timeline, in milliseconds.
client_event_id (string, Optional)
Corresponds to the client’s requested event_id.
session.usage.updated
After session activation, the service reports cumulative billing duration every 5 seconds; reports are also sent during idle periods. The current value takes the latest usage.seconds, and the final value is read from session.closed. Backend model token usage is available in response.event.
type (string, Required)
Event type; fixed value: session.usage.updated.
event_id (string, Required)
Server-side event ID.
usage (object, Required)
Session usage.
View child fields
View child fields
seconds (number, Required)Cumulative billing duration for the session (in seconds). This is the greater of 3 seconds and the elapsed session duration.context_window (object, Optional)
Context usage.
View child fields
View child fields
usage_ratio (number, Optional)Token usage divided by the context limit. Results may be delayed.session.closed
The session has ended. Stop sending events and release resources. To continue the conversation, establish a new connection and initialize a new session.
type (string, Required)
Event type; fixed value: session.closed.
event_id (string, Required)
Server-side event ID.
reason (string, Required)
Reason for closure. Possible values are close_requested, expired, content, remote_hangup, or connection_lost.
session (object, Required)
Configuration snapshot returned when the session closes.
View child fields
View child fields
id (string, Returned with the snapshot.)Business session ID.object (string, Returned with the snapshot.)Session object type.status (string, Returned with the snapshot.)The status in the snapshot may still show active. Use the session.closed event to determine that the session has closed.model (string, Returned with the snapshot.)Frontend speech model used for the session.usage (object, Required)
Final usage metrics at session termination.
View child fields
View child fields
seconds (number, Required)Cumulative billing duration for the session (in seconds). This is the greater of 3 seconds and the elapsed session duration.error
Check the request and session status based on the error code. After receiving a close event, reestablish the connection.
type (string, Required)
Event type; fixed value: error.
event_id (string, Required)
Server-side event ID.
error (object, Required)
Error details.
View child fields
View child fields
type (string, Required)invalid_request_error or server_error.code (string, Required)Error code. For example, invalid_session_configuration or invalid_event_state.message (string, Required)Error description.event_id (string, Optional)Corresponds to the client’s requested event_id.