Client Events
These are the events that Realtime servers accept from the client
Overview
These events are accepted by the Realtime servers via WebRTC datachannel from the client. Each event has a specific structure and purpose for managing realtime interactions.
session.update
Send this event to update the session’s default configuration. The client may send this event at any time to update any field, except for voice. Note that once a session has been initialized with a particular model, it can’t be changed to another model using session.update
.
When the server receives a session.update
, it will respond with a session.updated
event showing the full, effective configuration. Only the fields that are present are updated. To clear a field like instructions, pass an empty string.
Properties
Client-generated ID used to identify this event.
The event type, must be session.update
.
Realtime session object configuration.
input_audio_buffer.append
Send this event to append audio bytes to the input audio buffer. The audio buffer is temporary storage you can write to and later commit. In Server VAD mode, the audio buffer is used to detect speech and the server will decide when to commit. When Server VAD is disabled, you must commit the audio buffer manually.
The client may choose how much audio to place in each event up to a maximum of 15 MiB. Unlike many other client events, the server will not send a confirmation response to this event.
Properties
Client-generated ID used to identify this event.
The event type, must be input_audio_buffer.append
.
Base64-encoded audio bytes. This must be in the format specified by the input_audio_format field in the session configuration.
input_audio_buffer.commit
Send this event to commit the user input audio buffer, which will create a new user message item in the conversation. This event will produce an error if the input audio buffer is empty. When in Server VAD mode, the client does not need to send this event, as the server will commit the audio buffer automatically.
Properties
Client-generated ID used to identify this event.
The event type, must be input_audio_buffer.commit
.
input_audio_buffer.clear
Send this event to clear the audio bytes in the buffer. The server will respond with an input_audio_buffer.cleared
event.
Properties
Client-generated ID used to identify this event.
The event type, must be input_audio_buffer.clear
.
conversation.item.create
Add a new Item to the Conversation’s context, including messages, function calls, and function call responses. This event can be used both to populate a “history” of the conversation and to add new items mid-stream, but has the current limitation that it cannot populate assistant audio messages.
Properties
Client-generated ID used to identify this event.
The event type, must be conversation.item.create
.
The ID of the preceding item after which the new item will be inserted. If not set, the new item will be appended to the end of the conversation.
The item to add to the conversation.
conversation.item.truncate
Send this event to truncate a previous assistant message’s audio. The server will produce audio faster than realtime, so this event is useful when the user interrupts to truncate audio that has already been sent to the client but not yet played.
Properties
Client-generated ID used to identify this event.
The event type, must be conversation.item.truncate
.
The ID of the assistant message item to truncate.
The index of the content part to truncate. Set this to 0.
Inclusive duration up to which audio is truncated, in milliseconds.
conversation.item.delete
Send this event when you want to remove any item from the conversation history. The server will respond with a conversation.item.deleted
event.
Properties
Client-generated ID used to identify this event.
The event type, must be conversation.item.delete
.
The ID of the item to delete.
response.create
This event instructs the server to create a Response, which means triggering model inference. When in Server VAD mode, the server will create Responses automatically.
Properties
Client-generated ID used to identify this event.
The event type, must be response.create
.
Create a new Realtime response with these parameters.
response.cancel
Send this event to cancel an in-progress response. The server will respond with a response.cancelled
event or an error if there is no response to cancel.
Properties
Client-generated ID used to identify this event.
The event type, must be response.cancel
.
A specific response ID to cancel - if not provided, will cancel an in-progress response in the default conversation.
Was this page helpful?