Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Responses

Cancel a response
client.beta.responses.cancel(stringresponseID, ResponseCancelParams { betas } params?, RequestOptionsoptions?): BetaResponse { id, created_at, error, 31 more }
POST/responses/{response_id}/cancel
Compact a response
client.beta.responses.compact(ResponseCompactParams { model, input, instructions, 6 more } params, RequestOptionsoptions?): BetaCompactedResponse { id, created_at, object, 2 more }
POST/responses/compact
Connect
client.beta.responses.connect(RequestOptionsoptions?): void
Function
Create a model response
client.beta.responses.create(ResponseCreateParamsparams, RequestOptionsoptions?): BetaResponse { id, created_at, error, 31 more } | Stream<BetaResponseStreamEvent>
POST/responses
Delete a model response
client.beta.responses.delete(stringresponseID, ResponseDeleteParams { betas } params?, RequestOptionsoptions?): void
DELETE/responses/{response_id}
Get a model response
client.beta.responses.retrieve(stringresponseID, ResponseRetrieveParamsparams?, RequestOptionsoptions?): BetaResponse { id, created_at, error, 31 more } | Stream<BetaResponseStreamEvent>
GET/responses/{response_id}
ModelsExpand Collapse
BetaApplyPatchTool { type, allowed_callers }

Allows the assistant to create, delete, or update files using unified diffs.

BetaCompactedResponse { id, created_at, object, 2 more }
BetaComputerAction = Click { button, type, x, 2 more } | DoubleClick { keys, type, x, y } | Drag { path, type, keys } | 6 more

A click action.

BetaComputerActionList = Array<BetaComputerAction>

Flattened batched actions for computer_use. Each action includes an type discriminator and action-specific fields.

BetaComputerTool { type }

A tool that controls a virtual computer. Learn more about the computer tool.

BetaComputerUsePreviewTool { display_height, display_width, environment, type }

A tool that controls a virtual computer. Learn more about the computer tool.

BetaContainerAuto { type, file_ids, memory_limit, 2 more }
BetaContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
BetaContainerNetworkPolicyDisabled { type }
BetaContainerNetworkPolicyDomainSecret { domain, name, value }
BetaContainerReference { container_id, type }
BetaCustomTool { name, type, allowed_callers, 3 more }

A custom tool that processes input using a specified format. Learn more about custom tools

BetaEasyInputMessage { content, role, phase, type }

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the developer or system role take precedence over instructions given with the user role. Messages with the assistant role are presumed to have been generated by the model in previous interactions.

BetaFileSearchTool { type, vector_store_ids, filters, 2 more }

A tool that searches for relevant content from uploaded files. Learn more about the file search tool.

BetaFunctionShellTool { type, allowed_callers, environment }

A tool that allows the model to execute shell commands.

BetaFunctionTool { name, parameters, strict, 5 more }

Defines a function in your own code the model can choose to call. Learn more about function calling.

BetaImageDetail = "low" | "high" | "auto" | "original"
BetaInlineSkill { description, name, source, type }
BetaInlineSkillSource { data, media_type, type }

Inline skill payload

BetaLocalEnvironment { type, skills }
BetaLocalSkill { description, name, path }
BetaMcpToolCallError = McpProtocolError { code, message, type } | McpToolExecutionError { content, type } | HTTPError { code, message, type }
BetaNamespaceTool { description, name, tools, type }

Groups function/custom tools under a shared namespace.

BetaResponse { id, created_at, error, 31 more }
BetaResponseApplyPatchToolCall { id, call_id, operation, 5 more }

A tool call that applies file diffs by creating, deleting, or updating files.

BetaResponseApplyPatchToolCallOutput { id, call_id, status, 5 more }

The output emitted by an apply patch tool call.

BetaResponseAudioDeltaEvent { delta, sequence_number, type, agent }

Emitted when there is a partial audio response.

BetaResponseAudioDoneEvent { sequence_number, type, agent }

Emitted when the audio response is complete.

BetaResponseAudioTranscriptDeltaEvent { delta, sequence_number, type, agent }

Emitted when there is a partial transcript of audio.

BetaResponseAudioTranscriptDoneEvent { sequence_number, type, agent }

Emitted when the full audio transcript is completed.

BetaResponseCodeInterpreterCallCodeDeltaEvent { delta, item_id, output_index, 3 more }

Emitted when a partial code snippet is streamed by the code interpreter.

BetaResponseCodeInterpreterCallCodeDoneEvent { code, item_id, output_index, 3 more }

Emitted when the code snippet is finalized by the code interpreter.

BetaResponseCodeInterpreterCallCompletedEvent { item_id, output_index, sequence_number, 2 more }

Emitted when the code interpreter call is completed.

BetaResponseCodeInterpreterCallInProgressEvent { item_id, output_index, sequence_number, 2 more }

Emitted when a code interpreter call is in progress.

BetaResponseCodeInterpreterCallInterpretingEvent { item_id, output_index, sequence_number, 2 more }

Emitted when the code interpreter is actively interpreting the code snippet.

BetaResponseCodeInterpreterToolCall { id, code, container_id, 4 more }

A tool call to run code.

BetaResponseCompactionItem { id, encrypted_content, type, 2 more }

A compaction item generated by the v1/responses/compact API.

BetaResponseCompactionItemParam { encrypted_content, type, id, agent }

A compaction item generated by the v1/responses/compact API.

BetaResponseCompletedEvent { response, sequence_number, type, agent }

Emitted when the model response is complete.

BetaResponseComputerToolCall { id, call_id, pending_safety_checks, 5 more }

A tool call to a computer use tool. See the computer use guide for more information.

BetaResponseComputerToolCallOutputItem { id, call_id, output, 5 more }
BetaResponseComputerToolCallOutputScreenshot { type, file_id, image_url }

A computer screenshot image used with the computer use tool.

BetaResponseContainerReference { container_id, type }

Represents a container created with /v1/containers.

BetaResponseContent = BetaResponseInputText { text, type, prompt_cache_breakpoint } | BetaResponseInputImage { detail, type, file_id, 2 more } | BetaResponseInputFile { type, detail, file_data, 4 more } | 3 more

Multi-modal input and output contents.

BetaResponseContentPartAddedEvent { content_index, item_id, output_index, 4 more }

Emitted when a new content part is added.

BetaResponseContentPartDoneEvent { content_index, item_id, output_index, 4 more }

Emitted when a content part is done.

BetaResponseConversationParam { id }

The conversation that this response belongs to.

BetaResponseCreatedEvent { response, sequence_number, type, agent }

An event that is emitted when a response is created.

BetaResponseCustomToolCall { call_id, input, name, 5 more }

A call to a custom tool created by the model.

BetaResponseCustomToolCallInputDeltaEvent { delta, item_id, output_index, 3 more }

Event representing a delta (partial update) to the input of a custom tool call.

BetaResponseCustomToolCallInputDoneEvent { input, item_id, output_index, 3 more }

Event indicating that input for a custom tool call is complete.

BetaResponseCustomToolCallItem extends BetaResponseCustomToolCall { call_id, input, name, 5 more } { id, status, created_by }

A call to a custom tool created by the model.

BetaResponseCustomToolCallOutput { call_id, output, type, 3 more }

The output of a custom tool call from your code, being sent back to the model.

BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput { call_id, output, type, 3 more } { id, status, created_by }

The output of a custom tool call from your code, being sent back to the model.

BetaResponseError { code, message }

An error object returned when the model fails to generate a Response.

BetaResponseErrorEvent { code, message, param, 3 more }

Emitted when an error occurs.

BetaResponseFailedEvent { response, sequence_number, type, agent }

An event that is emitted when a response fails.

BetaResponseFileSearchCallCompletedEvent { item_id, output_index, sequence_number, 2 more }

Emitted when a file search call is completed (results found).

BetaResponseFileSearchCallInProgressEvent { item_id, output_index, sequence_number, 2 more }

Emitted when a file search call is initiated.

BetaResponseFileSearchCallSearchingEvent { item_id, output_index, sequence_number, 2 more }

Emitted when a file search is currently searching.

BetaResponseFileSearchToolCall { id, queries, status, 3 more }

The results of a file search tool call. See the file search guide for more information.

BetaResponseFormatTextConfig = Text { type } | BetaResponseFormatTextJSONSchemaConfig { name, schema, type, 2 more } | JSONObject { type }

An object specifying the format that the model must output.

Configuring { "type": "json_schema" } enables Structured Outputs, which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.

The default format is { "type": "text" } with no additional options.

Not recommended for gpt-4o and newer models:

Setting to { "type": "json_object" } enables the older JSON mode, which ensures the message the model generates is valid JSON. Using json_schema is preferred for models that support it.

BetaResponseFormatTextJSONSchemaConfig { name, schema, type, 2 more }

JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.

BetaResponseFunctionCallArgumentsDeltaEvent { delta, item_id, output_index, 3 more }

Emitted when there is a partial function-call arguments delta.

BetaResponseFunctionCallArgumentsDoneEvent { arguments, item_id, name, 4 more }

Emitted when function-call arguments are finalized.

BetaResponseFunctionCallOutputItem = BetaResponseInputTextContent { text, type, prompt_cache_breakpoint } | BetaResponseInputImageContent { type, detail, file_id, 2 more } | BetaResponseInputFileContent { type, detail, file_data, 4 more }

A piece of message content, such as text, an image, or a file.

BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>

An array of content outputs (text, image, file) for the function tool call.

BetaResponseFunctionShellCallOutputContent { outcome, stderr, stdout }

Captured stdout and stderr for a portion of a shell tool call output.

BetaResponseFunctionShellToolCall { id, action, call_id, 6 more }

A tool call that executes one or more shell commands in a managed environment.

BetaResponseFunctionShellToolCallOutput { id, call_id, max_output_length, 6 more }

The output of a shell tool call that was emitted.

BetaResponseFunctionToolCall { arguments, call_id, name, 6 more }

A tool call to run a function. See the function calling guide for more information.

BetaResponseFunctionToolCallItem extends BetaResponseFunctionToolCall { arguments, call_id, name, 6 more } { id, status, created_by }

A tool call to run a function. See the function calling guide for more information.

BetaResponseFunctionToolCallOutputItem { id, call_id, output, 7 more }
BetaResponseImageGenCallCompletedEvent { item_id, output_index, sequence_number, 2 more }

Emitted when an image generation tool call has completed and the final image is available.

BetaResponseImageGenCallGeneratingEvent { item_id, output_index, sequence_number, 2 more }

Emitted when an image generation tool call is actively generating an image (intermediate state).

BetaResponseImageGenCallInProgressEvent { item_id, output_index, sequence_number, 2 more }

Emitted when an image generation tool call is in progress.

BetaResponseImageGenCallPartialImageEvent { item_id, output_index, partial_image_b64, 8 more }

Emitted when a partial image is available during image generation streaming.

BetaResponseInProgressEvent { response, sequence_number, type, agent }

Emitted when the response is in progress.

BetaResponseIncludable = "file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | 5 more

Specify additional output data to include in the model response. Currently supported values are:

  • web_search_call.results: Include the search results of the web search tool call.
  • web_search_call.action.sources: Include the sources of the web search tool call.
  • code_interpreter_call.outputs: Includes the outputs of python code execution in code interpreter tool call items.
  • computer_call_output.output.image_url: Include image urls from the computer call output.
  • file_search_call.results: Include the search results of the file search tool call.
  • message.input_image.image_url: Include image urls from the input message.
  • message.output_text.logprobs: Include logprobs with assistant messages.
  • reasoning.encrypted_content: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the store parameter is set to false, or when an organization is enrolled in the zero data retention program).
BetaResponseIncompleteEvent { response, sequence_number, type, agent }

An event that is emitted when a response finishes as incomplete.

BetaResponseInjectCreatedEvent { response_id, sequence_number, type, stream_id }

Emitted when all injected input items were validated and committed to the active response.

BetaResponseInjectEvent { input, response_id, type }

Injects input items into an active response over a WebSocket connection. The items are validated and committed atomically. Currently, the server accepts client-owned tool outputs that resume a waiting agent.

BetaResponseInjectFailedEvent { error, input, response_id, 3 more }

Emitted when injected input could not be committed to a response. The event returns the uncommitted raw input so the client can retry it in another response when appropriate.

BetaResponseInput = Array<BetaResponseInputItem>

A list of one or many input items to the model, containing different content types.

BetaResponseInputAudio { input_audio, type }

An audio input to the model.

BetaResponseInputContent = BetaResponseInputText { text, type, prompt_cache_breakpoint } | BetaResponseInputImage { detail, type, file_id, 2 more } | BetaResponseInputFile { type, detail, file_data, 4 more }

A text input to the model.

BetaResponseInputFile { type, detail, file_data, 4 more }

A file input to the model.

BetaResponseInputFileContent { type, detail, file_data, 4 more }

A file input to the model.

BetaResponseInputImage { detail, type, file_id, 2 more }

An image input to the model. Learn about image inputs.

BetaResponseInputImageContent { type, detail, file_id, 2 more }

An image input to the model. Learn about image inputs

BetaResponseInputItem = BetaEasyInputMessage { content, role, phase, type } | Message { content, role, agent, 2 more } | BetaResponseOutputMessage { id, content, role, 4 more } | 32 more

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the developer or system role take precedence over instructions given with the user role. Messages with the assistant role are presumed to have been generated by the model in previous interactions.

BetaResponseInputMessageContentList = Array<BetaResponseInputContent>

A list of one or many input items to the model, containing different content types.

BetaResponseInputMessageItem { id, content, role, 3 more }
BetaResponseInputText { text, type, prompt_cache_breakpoint }

A text input to the model.

BetaResponseInputTextContent { text, type, prompt_cache_breakpoint }

A text input to the model.

BetaResponseItem = BetaResponseInputMessageItem { id, content, role, 3 more } | BetaResponseOutputMessage { id, content, role, 4 more } | BetaResponseFileSearchToolCall { id, queries, status, 3 more } | 29 more

Content item used to generate a response.

BetaResponseLocalEnvironment { type }

Represents the use of a local environment to perform shell actions.

BetaResponseMcpCallArgumentsDeltaEvent { delta, item_id, output_index, 3 more }

Emitted when there is a delta (partial update) to the arguments of an MCP tool call.

BetaResponseMcpCallArgumentsDoneEvent { arguments, item_id, output_index, 3 more }

Emitted when the arguments for an MCP tool call are finalized.

BetaResponseMcpCallCompletedEvent { item_id, output_index, sequence_number, 2 more }

Emitted when an MCP tool call has completed successfully.

BetaResponseMcpCallFailedEvent { item_id, output_index, sequence_number, 2 more }

Emitted when an MCP tool call has failed.

BetaResponseMcpCallInProgressEvent { item_id, output_index, sequence_number, 2 more }

Emitted when an MCP tool call is in progress.

BetaResponseMcpListToolsCompletedEvent { item_id, output_index, sequence_number, 2 more }

Emitted when the list of available MCP tools has been successfully retrieved.

BetaResponseMcpListToolsFailedEvent { item_id, output_index, sequence_number, 2 more }

Emitted when the attempt to list available MCP tools has failed.

BetaResponseMcpListToolsInProgressEvent { item_id, output_index, sequence_number, 2 more }

Emitted when the system is in the process of retrieving the list of available MCP tools.

BetaResponseOutputAudio { data, transcript, type }

An audio output from the model.

BetaResponseOutputItem = BetaResponseOutputMessage { id, content, role, 4 more } | BetaResponseFileSearchToolCall { id, queries, status, 3 more } | BetaResponseFunctionToolCall { arguments, call_id, name, 6 more } | 28 more

An output message from the model.

BetaResponseOutputItemAddedEvent { item, output_index, sequence_number, 2 more }

Emitted when a new output item is added.

BetaResponseOutputItemDoneEvent { item, output_index, sequence_number, 2 more }

Emitted when an output item is marked done.

BetaResponseOutputMessage { id, content, role, 4 more }

An output message from the model.

BetaResponseOutputRefusal { refusal, type }

A refusal from the model.

BetaResponseOutputText { annotations, text, type, logprobs }

A text output from the model.

BetaResponseOutputTextAnnotationAddedEvent { annotation, annotation_index, content_index, 5 more }

Emitted when an annotation is added to output text content.

BetaResponsePrompt { id, variables, version }

Reference to a prompt template and its variables. Learn more.

BetaResponseQueuedEvent { response, sequence_number, type, agent }

Emitted when a response is queued and waiting to be processed.

BetaResponseReasoningItem { id, summary, type, 4 more }

A description of the chain of thought used by a reasoning model while generating a response. Be sure to include these items in your input to the Responses API for subsequent turns of a conversation if you are manually managing context.

BetaResponseReasoningSummaryPartAddedEvent { item_id, output_index, part, 4 more }

Emitted when a new reasoning summary part is added.

BetaResponseReasoningSummaryPartDoneEvent { item_id, output_index, part, 5 more }

Emitted when a reasoning summary part is completed.

BetaResponseReasoningSummaryTextDeltaEvent { delta, item_id, output_index, 4 more }

Emitted when a delta is added to a reasoning summary text.

BetaResponseReasoningSummaryTextDoneEvent { item_id, output_index, sequence_number, 4 more }

Emitted when a reasoning summary text is completed.

BetaResponseReasoningTextDeltaEvent { content_index, delta, item_id, 4 more }

Emitted when a delta is added to a reasoning text.

BetaResponseReasoningTextDoneEvent { content_index, item_id, output_index, 4 more }

Emitted when a reasoning text is completed.

BetaResponseRefusalDeltaEvent { content_index, delta, item_id, 4 more }

Emitted when there is a partial refusal text.

BetaResponseRefusalDoneEvent { content_index, item_id, output_index, 4 more }

Emitted when refusal text is finalized.

BetaResponseShellCallCommandAddedEvent { command, command_index, output_index, 3 more }

A streaming event that indicated a shell command was added to a tool call.

BetaResponseShellCallCommandDeltaEvent { command_index, delta, output_index, 4 more }

A streaming event that indicated a shell command was incrementally updated.

BetaResponseShellCallCommandDoneEvent { command, command_index, output_index, 3 more }

A streaming event that indicated a shell command was completed.

BetaResponseShellCallOutputContentDeltaEvent { command_index, delta, item_id, 4 more }

A streaming event that indicated shell call output was incrementally added.

BetaResponseShellCallOutputContentDoneEvent { command_index, item_id, output, 4 more }

A streaming event that indicated shell call output was completed.

BetaResponseStatus = "completed" | "failed" | "in_progress" | 3 more

The status of the response generation. One of completed, failed, in_progress, cancelled, queued, or incomplete.

BetaResponseStreamEvent = BetaResponseAudioDeltaEvent { delta, sequence_number, type, agent } | BetaResponseAudioDoneEvent { sequence_number, type, agent } | BetaResponseAudioTranscriptDeltaEvent { delta, sequence_number, type, agent } | 55 more

Event emitted while a response is streamed.

BetaResponseTextConfig { format, verbosity }

Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:

BetaResponseTextDeltaEvent { content_index, delta, item_id, 5 more }

Emitted when there is an additional text delta.

BetaResponseTextDoneEvent { content_index, item_id, logprobs, 5 more }

Emitted when text content is finalized.

BetaResponseToolSearchCall { id, arguments, call_id, 5 more }
BetaResponseToolSearchOutputItem { id, call_id, execution, 5 more }
BetaResponseToolSearchOutputItemParam { tools, type, id, 4 more }
BetaResponseUsage { input_tokens, input_tokens_details, output_tokens, 2 more }

Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used.

BetaResponseWebSearchCallCompletedEvent { item_id, output_index, sequence_number, 2 more }

Emitted when a web search call is completed.

BetaResponseWebSearchCallInProgressEvent { item_id, output_index, sequence_number, 2 more }

Emitted when a web search call is initiated.

BetaResponseWebSearchCallSearchingEvent { item_id, output_index, sequence_number, 2 more }

Emitted when a web search call is executing.

BetaResponsesClientEvent = ResponseCreate { type, background, context_management, 31 more } | BetaResponseInjectEvent { input, response_id, type }

Client events accepted by the Responses WebSocket server.

BetaResponsesServerEvent = BetaResponseAudioWsDelta { stream_id } | BetaResponseAudioWsDone { stream_id } | BetaResponseAudioTranscriptWsDelta { stream_id } | 57 more

Server events emitted by the Responses WebSocket server.

BetaServiceTier = "auto" | "default" | "flex" | 4 more | null

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=fast or service_tier=priority parameter for Responses or Chat Completions. The response will show service_tier=priority regardless of if you specify service_tier=fast or priority in 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 show service_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.

BetaSkillReference { skill_id, type, version }
BetaTool = BetaFunctionTool { name, parameters, strict, 5 more } | BetaFileSearchTool { type, vector_store_ids, filters, 2 more } | BetaComputerTool { type } | 13 more

A tool that can be used to generate a response.

BetaToolChoiceAllowed { mode, tools, type }

Constrains the tools available to the model to a pre-defined set.

BetaToolChoiceApplyPatch { type }

Forces the model to call the apply_patch tool when executing a tool call.

BetaToolChoiceCustom { name, type }

Use this option to force the model to call a specific custom tool.

BetaToolChoiceFunction { name, type }

Use this option to force the model to call a specific function.

BetaToolChoiceMcp { server_label, type, name }

Use this option to force the model to call a specific tool on a remote MCP server.

BetaToolChoiceOptions = "none" | "auto" | "required"

Controls which (if any) tool is called by the model.

none means the model will not call any tool and instead generates a message.

auto means the model can pick between generating a message or calling one or more tools.

required means the model must call one or more tools.

BetaToolChoiceShell { type }

Forces the model to call the shell tool when a tool call is required.

BetaToolChoiceTypes { type }

Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.

BetaToolSearchTool { type, description, execution, parameters }

Hosted or BYOT tool search configuration for deferred tools.

BetaWebSearchPreviewTool { type, search_content_types, search_context_size, user_location }

This tool searches the web for relevant results to use in a response. Learn more about the web search tool.

BetaWebSearchTool { type, external_web_access, filters, 2 more }

Search the Internet for sources related to the prompt. Learn more about the web search tool.

ResponsesInput Items

List input items
client.beta.responses.inputItems.list(stringresponseID, InputItemListParams { after, include, limit, 2 more } params?, RequestOptionsoptions?): CursorPage<BetaResponseItem>
GET/responses/{response_id}/input_items
ModelsExpand Collapse
BetaResponseItemList { data, first_id, has_more, 2 more }

A list of Response items.

ResponsesInput Tokens

Get input token counts
client.beta.responses.inputTokens.count(InputTokenCountParams { conversation, input, instructions, 10 more } params?, RequestOptionsoptions?): InputTokenCountResponse { input_tokens, object }
POST/responses/input_tokens
ModelsExpand Collapse
InputTokenCountResponse { input_tokens, object }