WebSocket events
Send client events and receive server events over a persistent Responses API WebSocket connection. Learn more about WebSocket mode.
Events sent by the client over a Responses API WebSocket connection.
Client event for creating a response over a persistent WebSocket connection.
This payload uses the same top-level fields as POST /v1/responses, plus
WebSocket-only envelope metadata.
Notes:
streamis implicit over WebSocket and should not be sent.backgroundis not supported over WebSocket.stream_idis WebSocket-only and is not part ofPOST /v1/responses.
Whether to run the model response in the background. Learn more.
A system (or developer) message inserted into the model's context.
When using along with previous_response_id, the instructions from a previous
response will not be carried over to the next response. This makes it simple
to swap out system (or developer) messages in new responses.
An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.
The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
Model ID used to generate the response, like gpt-6-astra. OpenAI
offers a wide range of models with different capabilities, performance
characteristics, and price points. Refer to the model guide
to browse and compare available models.
Whether to allow the model to run tool calls in parallel.
The unique ID of the previous response to the model. Use this to
create multi-turn conversations. Learn more about
conversation state. Cannot be used in conjunction with conversation.
Reference to a prompt template and its variables. Learn more.
Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the user field. Learn more.
Configuration options for reasoning models.
A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. Learn more.
Specifies the processing type used for serving the request.
- If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
- If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
- If set to 'flex', then the request will be processed with the Flex Processing service tier.
- To opt-in to Fast mode at the request level, include the
service_tier=fastorservice_tier=priorityparameter for Responses or Chat Completions. The response will showservice_tier=priorityregardless of if you specifyservice_tier=fastorpriorityin your request. - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for
gpt-5.6-sol; a response served through it will showservice_tier=ultrafast. - When not set, the default behavior is 'auto'.
When the service_tier parameter is set, the response body will include the service_tier value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.
Whether to store the generated model response for later retrieval via API. Defaults to true when omitted. If set to true, response data will be stored for at least 30 days, subject to the data retention exceptions.
If set to true, the model response data will be streamed to the client as it is generated using server-sent events. See the Streaming section below for more information.
The WebSocket lane for this response. Requests with the same
stream_id are processed FIFO, and events for the response echo the
same stream_id.
stream_id controls routing; previous_response_id controls
conversation lineage, so a new lane can fork from a response created
on another lane.
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
We generally recommend altering this or top_p but not both.
Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
An integer between 0 and 20 specifying the maximum number of most likely tokens to return at each token position, each with an associated log probability. In some cases, the number of returned tokens may be fewer than requested.
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
We generally recommend altering this or temperature but not both.
This field is being replaced by safety_identifier and prompt_cache_key. Use prompt_cache_key instead to maintain caching optimizations.
A stable identifier for your end-users.
Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. Learn more.
Queues user input to steer a response on this WebSocket connection. Input can contain text, images, and files. Steering is supported only for single-agent responses on models and execution modes that support steering. Responses bound to a conversation or using automatic compaction do not support steering.
A response.steer.accepted event acknowledges that the server owns the
queued input, not that it has been applied. The successor's response.created
event is the commit point. Input that cannot be committed is returned in
response.steer.failed.
Steering may cause the active response to finish at a safe output boundary
with response.incomplete and incomplete_details.reason set to steered,
followed automatically by a successor response.created. Normal completion
can also be followed by an automatic successor. Automatic successors inherit
the previous response's settings and continue from it with the queued input.
If the response stops for client-owned tool output or approval, accepted
steering input remains queued and response.steer.pending is emitted after
response.completed. Fill the required_input stubs from that event with
saved tool results or approval decisions, and send one explicit
response.create per parent with the same previous_response_id and
WebSocket lane. Do not rerun tools or resend accepted steering input. The
queued input is prepended in submission order to that request's input, and
the explicit request retains its own settings.
This event accepts only type, previous_response_id, and input. Do not
send stream_id; the target response determines the WebSocket lane.
Input to queue for a continuation of the response. Uses the same string or
input-item shape as response.create.input, with a non-empty array when
supplying input items.
Steering accepts only messages with the user role. Each message may
contain only type, role, and content, with content as a string or an
array of input_text, input_image, and input_file parts. The optional
type must be message. Other roles, tool outputs, and item types are not
supported for steering.
Events emitted only over a Responses API WebSocket connection.
Emitted when steering input has been validated and queued. Acceptance means
the server owns the input, not that it has been applied. The successor's
response.created event is the commit point. If accepted input cannot be
committed, response.steer.failed returns it with the same steering ID.
When the response stops for client-owned tool output or approval, the input
remains queued and response.steer.pending is emitted after
response.completed. Fill the pending event's required_input stubs with
saved results and send one matching explicit response.create per parent.
Do not resend accepted input while it is still queued.
Emitted when accepted steering input remains queued after the target
response completes. The server still owns the input. Do not resend it.
The successor's response.created event is the commit point.
When reason is waiting_for_required_input, this event follows
response.completed while the response waits for the tool results or
approval decisions identified by required_input. Copy those stubs, fill
their result fields using the ordinary response.create input schemas,
and submit one continuation per parent with the same previous_response_id
and WebSocket lane. Use saved results without rerunning tools. The queued
steering input is prepended in submission order to the continuation's
input. That explicit request retains its own settings.
This notification is emitted at most once per steering submission. Multiple submissions for the same parent can report the same required inputs; they do not each require a separate continuation.
An extensible enum describing why accepted steering input is still queued. Clients should handle unknown values because additional reasons may be introduced. Known values include:
waiting_for_required_input: The response is waiting for the tool results or approval decisions identified byrequired_input.
Emitted when steering input is rejected or cannot be committed to a
successor response. Returns the original, uncommitted input so the client
can carry it into response.create when appropriate. Invalid input must
be corrected before retrying.
Failures after acceptance include the same steering ID. Failures before an
ID is allocated omit steer.id. A lost connection or missing acknowledgement
leaves the outcome unknown; it is not proof that the input was rejected.
Emitted when an error occurs while processing a Responses WebSocket request.
These events use the same payloads over WebSocket and HTTP streaming. Compaction progress follows the same cadence and output-item lifecycle described in HTTP streaming.
Emitted when a new content part is added.
Emitted when a content part is done.
Emitted when there is an additional text delta.
Emitted when text content is finalized.
Emitted when there is a partial refusal text.
Emitted when refusal text is finalized.
Emitted when function-call arguments are finalized.
Emitted when a reasoning summary part is completed.
Emitted when a delta is added to a reasoning text.
Emitted when a reasoning text is completed.
Emitted when a partial image is available during image generation streaming.
Emitted when an MCP tool call has completed successfully.
Emitted when an MCP tool call has failed.
Emitted when an MCP tool call is in progress.
Emitted when the code interpreter is actively interpreting the code snippet.
Event representing a delta (partial update) to the input of a custom tool call.
Event indicating that input for a custom tool call is complete.
Emitted when there is a partial audio response.
Emitted when the audio response is complete.
Emitted when the full audio transcript is completed.
Emitted when new summary content is sampled for a compaction trigger. Contains no summary content.