Voice agent realtime client events

These events are sent by the client on a voice-agent realtime connection.

These tables describe the event properties and link to their models.

Client events

conversation.item.create

Schema: OpenAI.RealtimeClientEventConversationItemCreate.

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. If successful, the server will emit a conversation.item.added event and, when the item is finalized, a conversation.item.done event. Otherwise, an error event will be sent.

All of: OpenAI.RealtimeClientEvent.

Property Type Required Description
event_id string No Optional client-generated ID used to identify this event. maxLength: 512.
type "conversation.item.create" Yes The event type, must be conversation.item.create.
previous_item_id string No 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. If set to root, the new item will be added to the beginning of the conversation. If set to an existing ID, it allows an item to be inserted mid-conversation. If the ID cannot be found, an error will be returned and the item will not be added.
item OpenAI.RealtimeConversationItem Yes

Example event:

{
  "type": "conversation.item.create",
  "item": {
    "type": "message",
    "role": "user",
    "content": [
      {
        "type": "input_text",
        "text": "hi"
      }
    ]
  }
}

conversation.item.delete

Schema: OpenAI.RealtimeClientEventConversationItemDelete.

Send this event when you want to remove any item from the conversation history. The server will respond with a conversation.item.deleted event, unless the item does not exist in the conversation history, in which case the server will respond with an error.

All of: OpenAI.RealtimeClientEvent.

Property Type Required Description
event_id string No Optional client-generated ID used to identify this event. maxLength: 512.
type "conversation.item.delete" Yes The event type, must be conversation.item.delete.
item_id string Yes The ID of the item to delete.

Example event:

{
  "event_id": "event_901",
  "type": "conversation.item.delete",
  "item_id": "item_003"
}

conversation.item.retrieve

Schema: OpenAI.RealtimeClientEventConversationItemRetrieve.

Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD. The server will respond with a conversation.item.retrieved event, unless the item does not exist in the conversation history, in which case the server will respond with an error.

All of: OpenAI.RealtimeClientEvent.

Property Type Required Description
event_id string No Optional client-generated ID used to identify this event. maxLength: 512.
type "conversation.item.retrieve" Yes The event type, must be conversation.item.retrieve.
item_id string Yes The ID of the item to retrieve.

Example event:

{
  "event_id": "event_901",
  "type": "conversation.item.retrieve",
  "item_id": "item_003"
}

conversation.item.truncate

Schema: OpenAI.RealtimeClientEventConversationItemTruncate.

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. This will synchronize the server's understanding of the audio with the client's playback. Truncating audio will delete the server-side text transcript to ensure there is not text in the context that hasn't been heard by the user. If successful, the server will respond with a conversation.item.truncated event.

All of: OpenAI.RealtimeClientEvent.

Property Type Required Description
event_id string No Optional client-generated ID used to identify this event. maxLength: 512.
type "conversation.item.truncate" Yes The event type, must be conversation.item.truncate.
item_id string Yes The ID of the assistant message item to truncate. Only assistant message items can be truncated.
content_index OpenAI.integer Yes The index of the content part to truncate. Set this to 0.
audio_end_ms OpenAI.integer Yes Inclusive duration up to which audio is truncated, in milliseconds. If the audio_end_ms is greater than the actual audio duration, the server will respond with an error.

Example event:

{
  "event_id": "event_678",
  "type": "conversation.item.truncate",
  "item_id": "item_002",
  "content_index": 0,
  "audio_end_ms": 1500
}

input_audio_buffer.append

Schema: OpenAI.RealtimeClientEventInputAudioBufferAppend.

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. A "commit" will create a new user message item in the conversation history from the buffer content and clear the buffer. Input audio transcription (if enabled) will be generated when the buffer is committed. If VAD is enabled 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. Input audio noise reduction operates on writes to the audio buffer. The client may choose how much audio to place in each event up to a maximum of 15 MiB, for example streaming smaller chunks from the client may allow the VAD to be more responsive. Unlike most other client events, the server will not send a confirmation response to this event.

All of: OpenAI.RealtimeClientEvent.

Property Type Required Description
event_id string No Optional client-generated ID used to identify this event. maxLength: 512.
type "input_audio_buffer.append" Yes The event type, must be input_audio_buffer.append.
audio string Yes Base64-encoded audio bytes. This must be in the format specified by the input_audio_format field in the session configuration.

Example event:

{
  "event_id": "event_456",
  "type": "input_audio_buffer.append",
  "audio": "Base64EncodedAudioData"
}

input_audio_buffer.clear

Schema: OpenAI.RealtimeClientEventInputAudioBufferClear.

Send this event to clear the audio bytes in the buffer. The server will respond with an input_audio_buffer.cleared event.

All of: OpenAI.RealtimeClientEvent.

Property Type Required Description
event_id string No Optional client-generated ID used to identify this event. maxLength: 512.
type "input_audio_buffer.clear" Yes The event type, must be input_audio_buffer.clear.

Example event:

{
  "event_id": "event_012",
  "type": "input_audio_buffer.clear"
}

output_audio_buffer.clear

Schema: OpenAI.RealtimeClientEventOutputAudioBufferClear.

WebRTC/SIP Only: Emit to cut off the current audio response. This will trigger the server to stop generating audio and emit a output_audio_buffer.cleared event. This event should be preceded by a response.cancel client event to stop the generation of the current response. Learn more.

All of: OpenAI.RealtimeClientEvent.

Property Type Required Description
event_id string No The unique ID of the client event used for error handling.
type "output_audio_buffer.clear" Yes The event type, must be output_audio_buffer.clear.

Example event:

{
  "event_id": "optional_client_event_id",
  "type": "output_audio_buffer.clear"
}

input_audio_buffer.commit

Schema: OpenAI.RealtimeClientEventInputAudioBufferCommit.

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, the server will commit the audio buffer automatically. Committing the input audio buffer will trigger input audio transcription (if enabled in session configuration), but it will not create a response from the model. The server will respond with an input_audio_buffer.committed event.

All of: OpenAI.RealtimeClientEvent.

Property Type Required Description
event_id string No Optional client-generated ID used to identify this event. maxLength: 512.
type "input_audio_buffer.commit" Yes The event type, must be input_audio_buffer.commit.

Example event:

{
  "event_id": "event_789",
  "type": "input_audio_buffer.commit"
}

response.cancel

Schema: OpenAI.RealtimeClientEventResponseCancel.

Send this event to cancel an in-progress response. The server will respond with a response.done event with a status of response.status=cancelled. If there is no response to cancel, the server will respond with an error. It's safe to call response.cancel even if no response is in progress, an error will be returned the session will remain unaffected.

All of: OpenAI.RealtimeClientEvent.

Property Type Required Description
event_id string No Optional client-generated ID used to identify this event. maxLength: 512.
type "response.cancel" Yes The event type, must be response.cancel.
response_id string No A specific response ID to cancel - if not provided, will cancel an in-progress response in the default conversation.

Example event:

{
  "type": "response.cancel",
  "response_id": "resp_12345"
}

response.create

Schema: OpenAI.RealtimeClientEventResponseCreate.

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. A Response will include at least one Item, and may have two, in which case the second will be a function call. These Items will be appended to the conversation history by default. The server will respond with a response.created event, events for Items and content created, and finally a response.done event to indicate the Response is complete. The response.create event includes inference configuration like instructions and tools. If these are set, they will override the Session's configuration for this Response only. Responses can be created out-of-band of the default Conversation, meaning that they can have arbitrary input, and it's possible to disable writing the output to the Conversation. Only one Response can write to the default Conversation at a time, but otherwise multiple Responses can be created in parallel. The metadata field is a good way to disambiguate multiple simultaneous Responses. Clients can set conversation to none to create a Response that does not write to the default Conversation. Arbitrary input can be provided with the input field, which is an array accepting raw Items and references to existing Items.

All of: OpenAI.RealtimeClientEvent.

Property Type Required Description
event_id string No Optional client-generated ID used to identify this event. maxLength: 512.
type "response.create" Yes The event type, must be response.create.
response VoiceAgentResponseCreateParams No

session.update

Schema: VoiceAgentClientEventSessionUpdate.

The session.update client event.

Property Type Required Description
event_id string No Optional client-generated ID used to identify this event. This is an arbitrary string that a client may assign. It will be passed back if there is an error with the event, but the corresponding session.updated event will not include it. maxLength: 512.
type "session.update" Yes The event type, must be session.update.
session VoiceAgentSessionUpdate Yes The voice-agent session settings to update.

session.avatar.connect

Schema: VoiceAgentClientEventSessionAvatarConnect.

The session.avatar.connect client event.

All of: OpenAI.RealtimeClientEvent.

Property Type Required Description
type "session.avatar.connect" Yes The event type. Always session.avatar.connect.
event_id string No An optional client-generated event identifier.
client_sdp string Yes The client's SDP offer for avatar media negotiation.

rtc.call.sdp.create

Schema: VoiceAgentClientEventRtcCallSdpCreate.

The rtc.call.sdp.create client event: begins WebRTC signaling with an SDP offer.

All of: OpenAI.RealtimeClientEvent.

Property Type Required Description
type "rtc.call.sdp.create" Yes The event type. Always rtc.call.sdp.create.
event_id string No An optional client-generated event identifier.
sdp_offer string Yes The client's SDP offer for the WebRTC connection.
session VoiceAgentSessionUpdateConfig No Optional session configuration. For an /agents endpoint the service rebuilds it authoritatively from the persisted agent definition.