Run OpenAI Responses API (OpenAI only)
Runs inference using the OpenAI Responses API contract, taking an input rather than a chat messages array.
This endpoint is restricted to OpenAI-vendor models: requests whose model (vendor/name) resolves
to any other vendor are rejected with an unsupported-vendor error, unlike /v5/chat/completions and
/v5/inference which support many vendors. Use it when you specifically need Responses API features
such as previous_response_id chaining, instructions, or store; use /v5/chat/completions for the
standard messages-based chat contract. When stream is set the response streams as server-sent
events; otherwise a single response object is returned.
ParametersExpand Collapse
body: ResponseCreateParams { input, model, include, 14 more }
input: string | Array<EasyInputMessageParam { content, role, phase, type } | OpenAITypesResponsesResponseInputParamMessage { content, role, status, type } | ResponseOutputMessageParam { id, content, role, 3 more } | 23 more>
Array<EasyInputMessageParam { content, role, phase, type } | OpenAITypesResponsesResponseInputParamMessage { content, role, status, type } | ResponseOutputMessageParam { id, content, role, 3 more } | 23 more>
EasyInputMessageParam { 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.
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.
content: string | Array<OpenAIResponseInputTextParam { text, type } | OpenAIResponseInputImageParam { detail, type, file_id, image_url } | OpenAIResponseInputFileParam { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputTextParam { text, type } | OpenAIResponseInputImageParam { detail, type, file_id, image_url } | OpenAIResponseInputFileParam { type, file_data, file_id, 2 more } >
OpenAIResponseInputImageParam { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAITypesResponsesResponseInputParamMessage { content, role, status, 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.
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.
content: Array<OpenAIResponseInputTextParam { text, type } | OpenAIResponseInputImageParam { detail, type, file_id, image_url } | OpenAIResponseInputFileParam { type, file_data, file_id, 2 more } >
OpenAIResponseInputImageParam { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
ResponseOutputMessageParam { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<ResponseOutputTextParam { annotations, text, type, logprobs } | ResponseOutputRefusalParam { refusal, type } >
ResponseOutputTextParam { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextParamAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextParamAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
ResponseFileSearchToolCallParam { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
ResponseComputerToolCallParam { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAITypesResponsesResponseInputParamComputerCallOutput { call_id, output, type, 3 more } The output of a computer tool call.
The output of a computer tool call.
ResponseFunctionWebSearchParam { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchParamActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchParamActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
ResponseFunctionToolCallParam { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAITypesResponsesResponseInputParamFunctionCallOutput { call_id, output, type, 2 more } The output of a function tool call.
The output of a function tool call.
output: string | Array<ResponseInputTextContentParam { text, type } | ResponseInputImageContentParam { type, detail, file_id, image_url } | ResponseInputFileContentParam { type, file_data, file_id, 2 more } >
Array<ResponseInputTextContentParam { text, type } | ResponseInputImageContentParam { type, detail, file_id, image_url } | ResponseInputFileContentParam { type, file_data, file_id, 2 more } >
ResponseInputImageContentParam { type, detail, file_id, image_url } An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
ResponseReasoningItemParam { id, summary, type, 3 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.
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.
ResponseCompactionItemParamParam { encrypted_content, type, id } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseInputParamImageGenerationCall { id, result, status, type } An image generation request made by the model.
An image generation request made by the model.
ResponseCodeInterpreterToolCallParam { id, code, container_id, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseInputParamLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
OpenAITypesResponsesResponseInputParamLocalShellCallOutput { id, output, type, status } The output of a local shell tool call.
The output of a local shell tool call.
OpenAITypesResponsesResponseInputParamShellCall { action, call_id, type, 3 more } A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
action: Action { commands, max_output_length, timeout_ms } The shell commands and limits that describe how to run the tool call.
The shell commands and limits that describe how to run the tool call.
environment?: LocalEnvironmentParam { type, skills } | ContainerReferenceParam { container_id, type }
OpenAITypesResponsesResponseInputParamShellCallOutput { call_id, output, type, 3 more } The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
OpenAITypesResponsesResponseInputParamApplyPatchCall { call_id, operation, status, 2 more } A tool call representing a request to create, delete, or update files using diff patches.
A tool call representing a request to create, delete, or update files using diff patches.
operation: ApplyPatchCallOperationCreateFile { diff, path, type } | ApplyPatchCallOperationDeleteFile { path, type } | ApplyPatchCallOperationUpdateFile { diff, path, type } Instruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
OpenAITypesResponsesResponseInputParamApplyPatchCallOutput { call_id, status, type, 2 more } The streamed output emitted by an apply patch tool call.
The streamed output emitted by an apply patch tool call.
OpenAITypesResponsesResponseInputParamMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
McpApprovalRequest { id, arguments, name, 2 more } A request for human approval of a tool invocation.
A request for human approval of a tool invocation.
OpenAITypesResponsesResponseInputParamMcpApprovalResponse { approval_request_id, approve, type, 2 more } A response to an MCP approval request.
A response to an MCP approval request.
OpenAITypesResponsesResponseInputParamMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
ResponseCustomToolCallOutputParam { call_id, output, type, id } The output of a custom tool call from your code, being sent back to the model.
The output of a custom tool call from your code, being sent back to the model.
output: string | Array<OpenAIResponseInputTextParam { text, type } | OpenAIResponseInputImageParam { detail, type, file_id, image_url } | OpenAIResponseInputFileParam { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputTextParam { text, type } | OpenAIResponseInputImageParam { detail, type, file_id, image_url } | OpenAIResponseInputFileParam { type, file_data, file_id, 2 more } >
OpenAIResponseInputImageParam { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
ReturnsExpand Collapse
ResponseCreateResponse = OpenAIResponse { id, created_at, model, 29 more } | ResponseAudioDeltaEvent { delta, sequence_number, type } | ResponseAudioDoneEvent { sequence_number, type } | 52 moreEmitted when there is a partial audio response.
Emitted when there is a partial audio response.
OpenAIResponse { id, created_at, model, 29 more }
model: "gpt-5.2" | "gpt-5.2-2025-12-11" | "gpt-5.2-chat-latest" | 83 more | (string & {})
output: Array<OpenAIResponseOutputMessage { id, content, role, 3 more } | OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } | OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } | 15 more>
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItem { id, encrypted_content, type, created_by } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseOutputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseOutputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
ResponseFunctionShellToolCall { id, action, call_id, 4 more } A tool call that executes one or more shell commands in a managed environment.
A tool call that executes one or more shell commands in a managed environment.
action: Action { commands, max_output_length, timeout_ms } The shell commands and limits that describe how to run the tool call.
The shell commands and limits that describe how to run the tool call.
ResponseFunctionShellToolCallOutput { id, call_id, output, 4 more } The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
ResponseApplyPatchToolCall { id, call_id, operation, 3 more } A tool call that applies file diffs by creating, deleting, or updating files.
A tool call that applies file diffs by creating, deleting, or updating files.
operation: OperationCreateFile { diff, path, type } | OperationDeleteFile { path, type } | OperationUpdateFile { diff, path, type } Instruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
ResponseApplyPatchToolCallOutput { id, call_id, status, 3 more } The output emitted by an apply patch tool call.
The output emitted by an apply patch tool call.
OpenAITypesResponsesResponseOutputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAITypesResponsesResponseOutputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
tool_choice: "none" | "auto" | "required" | ToolChoiceAllowed { mode, tools, type } | ToolChoiceTypes { type } | 5 moreConstrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
ToolChoiceAllowed { mode, tools, type } Constrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
ToolChoiceTypes { type } Indicates that the model should use a built-in tool to generate a response.
Learn more about built-in tools.
Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.
ToolChoiceMcp { server_label, type, name } Use this option to force the model to call a specific tool on a remote MCP server.
Use this option to force the model to call a specific tool on a remote MCP server.
tools: Array<FunctionTool { name, type, description, 2 more } | FileSearchTool { type, vector_store_ids, filters, 2 more } | ComputerTool { display_height, display_width, environment, type } | 9 more>
FunctionTool { name, type, description, 2 more } Defines a function in your own code the model can choose to call.
Learn more about function calling.
Defines a function in your own code the model can choose to call.
Learn more about function calling.
FileSearchTool { type, vector_store_ids, filters, 2 more } A tool that searches for relevant content from uploaded files.
Learn more about the file search tool.
A tool that searches for relevant content from uploaded files.
Learn more about the file search tool.
filters?: ComparisonFilter { key, type, value } | CompoundFilter { filters, type } A filter used to compare a specified attribute key to a given value using a defined comparison operation.
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
ComparisonFilter { key, type, value } A filter used to compare a specified attribute key to a given value using a defined comparison operation.
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
CompoundFilter { filters, type } Combine multiple filters using and or or.
Combine multiple filters using and or or.
ranking_options?: RankingOptions { hybrid_search, ranker, score_threshold } Ranking options for search.
Ranking options for search.
ComputerTool { display_height, display_width, environment, type } A tool that controls a virtual computer.
Learn more about the computer tool.
A tool that controls a virtual computer.
Learn more about the computer tool.
WebSearchTool { type, filters, search_context_size, user_location } Search the Internet for sources related to the prompt.
Learn more about the
web search tool.
Search the Internet for sources related to the prompt.
Learn more about the web search tool.
Mcp { server_label, type, allowed_tools, 6 more } Give the model access to additional tools via remote Model Context Protocol
(MCP) servers. Learn more about MCP.
Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
allowed_tools?: Array<string> | McpAllowedToolsMcpToolFilter { read_only, tool_names } A filter object to specify which tools are allowed.
A filter object to specify which tools are allowed.
require_approval?: McpRequireApprovalMcpToolApprovalFilter { always, never } | "always" | "never"Specify which of the MCP server’s tools require approval.
Can be
always, never, or a filter object associated with tools
that require approval.
Specify which of the MCP server’s tools require approval.
Can be
always, never, or a filter object associated with tools
that require approval.
CodeInterpreter { container, type } A tool that runs Python code to help generate a response to a prompt.
A tool that runs Python code to help generate a response to a prompt.
container: string | CodeInterpreterContainerCodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy } Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
CodeInterpreterContainerCodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy } Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
network_policy?: ContainerNetworkPolicyDisabled { type } | ContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
ImageGeneration { type, action, background, 9 more } A tool that generates images using the GPT image models.
A tool that generates images using the GPT image models.
FunctionShellTool { type, environment } A tool that allows the model to execute shell commands.
A tool that allows the model to execute shell commands.
environment?: ContainerAuto { type, file_ids, memory_limit, 2 more } | LocalEnvironment { type, skills } | ContainerReference { container_id, type }
ContainerAuto { type, file_ids, memory_limit, 2 more }
network_policy?: ContainerNetworkPolicyDisabled { type } | ContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
CustomTool { name, type, description, format } A custom tool that processes input using a specified format.
Learn more about custom tools
A custom tool that processes input using a specified format.
Learn more about custom tools
WebSearchPreviewTool { type, 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.
This tool searches the web for relevant results to use in a response.
Learn more about the web search tool.
The conversation that this response belonged to.
Input items and output items from this response were automatically added to this conversation.
The conversation that this response belonged to.
Input items and output items from this response were automatically added to this conversation.
An error object returned when the model fails to generate a Response.
An error object returned when the model fails to generate a Response.
instructions?: string | Array<EasyInputMessage { content, role, phase, type } | OpenAITypesResponsesResponseInputItemMessage { content, role, status, type } | OpenAIResponseOutputMessage { id, content, role, 3 more } | 23 more>
Array<EasyInputMessage { content, role, phase, type } | OpenAITypesResponsesResponseInputItemMessage { content, role, status, type } | OpenAIResponseOutputMessage { id, content, role, 3 more } | 23 more>
EasyInputMessage { 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.
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.
content: string | Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAITypesResponsesResponseInputItemMessage { content, role, status, 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.
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.
content: Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAITypesResponsesResponseInputItemComputerCallOutput { call_id, output, type, 3 more } The output of a computer tool call.
The output of a computer tool call.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAITypesResponsesResponseInputItemFunctionCallOutput { call_id, output, type, 2 more } The output of a function tool call.
The output of a function tool call.
output: string | Array<ResponseInputTextContent { text, type } | ResponseInputImageContent { type, detail, file_id, image_url } | ResponseInputFileContent { type, file_data, file_id, 2 more } >
Array<ResponseInputTextContent { text, type } | ResponseInputImageContent { type, detail, file_id, image_url } | ResponseInputFileContent { type, file_data, file_id, 2 more } >
ResponseInputImageContent { type, detail, file_id, image_url } An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItemParam { encrypted_content, type, id } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseInputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseInputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
OpenAITypesResponsesResponseInputItemLocalShellCallOutput { id, output, type, status } The output of a local shell tool call.
The output of a local shell tool call.
ShellCall { action, call_id, type, 3 more } A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
ShellCallOutput { call_id, output, type, 3 more } The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
ApplyPatchCall { call_id, operation, status, 2 more } A tool call representing a request to create, delete, or update files using diff patches.
A tool call representing a request to create, delete, or update files using diff patches.
operation: ApplyPatchCallOperationCreateFile { diff, path, type } | ApplyPatchCallOperationDeleteFile { path, type } | ApplyPatchCallOperationUpdateFile { diff, path, type } Instruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
ApplyPatchCallOutput { call_id, status, type, 2 more } The streamed output emitted by an apply patch tool call.
The streamed output emitted by an apply patch tool call.
OpenAITypesResponsesResponseInputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
McpApprovalRequest { id, arguments, name, 2 more } A request for human approval of a tool invocation.
A request for human approval of a tool invocation.
OpenAITypesResponsesResponseInputItemMcpApprovalResponse { approval_request_id, approve, type, 2 more } A response to an MCP approval request.
A response to an MCP approval request.
OpenAITypesResponsesResponseInputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAIResponseCustomToolCallOutput { call_id, output, type, id } The output of a custom tool call from your code, being sent back to the model.
The output of a custom tool call from your code, being sent back to the model.
output: string | Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
variables?: Record<string, string | OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
gpt-5 and o-series models only
Configuration options for
reasoning models.
gpt-5 and o-series models only
Configuration options for reasoning models.
Configuration options for a text response from the model.
Can be plain
text or structured JSON data. Learn more:
Configuration options for a text response from the model.
Can be plain text or structured JSON data. Learn more:
format?: ResponseFormatText { type } | ResponseFormatTextJsonSchemaConfig { name, schema, type, 2 more } | ResponseFormatJsonObject { type } Default response format. Used to generate text responses.
Default response format. Used to generate text responses.
ResponseFormatTextJsonSchemaConfig { name, schema, type, 2 more } JSON Schema response format.
Used to generate structured JSON responses.
Learn more about Structured Outputs.
JSON Schema response format.
Used to generate structured JSON responses. Learn more about Structured Outputs.
Represents token usage details including input tokens, output tokens,
a breakdown of output tokens, and the total tokens used.
Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used.
ResponseAudioDeltaEvent { delta, sequence_number, type } Emitted when there is a partial audio response.
Emitted when there is a partial audio response.
ResponseAudioTranscriptDeltaEvent { delta, sequence_number, type } Emitted when there is a partial transcript of audio.
Emitted when there is a partial transcript of audio.
ResponseAudioTranscriptDoneEvent { sequence_number, type } Emitted when the full audio transcript is completed.
Emitted when the full audio transcript is completed.
ResponseCodeInterpreterCallCodeDeltaEvent { delta, item_id, output_index, 2 more } Emitted when a partial code snippet is streamed by the code interpreter.
Emitted when a partial code snippet is streamed by the code interpreter.
ResponseCodeInterpreterCallCodeDoneEvent { code, item_id, output_index, 2 more } Emitted when the code snippet is finalized by the code interpreter.
Emitted when the code snippet is finalized by the code interpreter.
ResponseCodeInterpreterCallCompletedEvent { item_id, output_index, sequence_number, type } Emitted when the code interpreter call is completed.
Emitted when the code interpreter call is completed.
ResponseCodeInterpreterCallInProgressEvent { item_id, output_index, sequence_number, type } Emitted when a code interpreter call is in progress.
Emitted when a code interpreter call is in progress.
ResponseCodeInterpreterCallInterpretingEvent { item_id, output_index, sequence_number, type } Emitted when the code interpreter is actively interpreting the code snippet.
Emitted when the code interpreter is actively interpreting the code snippet.
ResponseCompletedEvent { response, sequence_number, type } Emitted when the model response is complete.
Emitted when the model response is complete.
model: "gpt-5.2" | "gpt-5.2-2025-12-11" | "gpt-5.2-chat-latest" | 83 more | (string & {})
output: Array<OpenAIResponseOutputMessage { id, content, role, 3 more } | OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } | OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } | 15 more>
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItem { id, encrypted_content, type, created_by } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseOutputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseOutputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
ResponseFunctionShellToolCall { id, action, call_id, 4 more } A tool call that executes one or more shell commands in a managed environment.
A tool call that executes one or more shell commands in a managed environment.
action: Action { commands, max_output_length, timeout_ms } The shell commands and limits that describe how to run the tool call.
The shell commands and limits that describe how to run the tool call.
ResponseFunctionShellToolCallOutput { id, call_id, output, 4 more } The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
ResponseApplyPatchToolCall { id, call_id, operation, 3 more } A tool call that applies file diffs by creating, deleting, or updating files.
A tool call that applies file diffs by creating, deleting, or updating files.
operation: OperationCreateFile { diff, path, type } | OperationDeleteFile { path, type } | OperationUpdateFile { diff, path, type } Instruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
ResponseApplyPatchToolCallOutput { id, call_id, status, 3 more } The output emitted by an apply patch tool call.
The output emitted by an apply patch tool call.
OpenAITypesResponsesResponseOutputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAITypesResponsesResponseOutputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
tool_choice: "none" | "auto" | "required" | ToolChoiceAllowed { mode, tools, type } | ToolChoiceTypes { type } | 5 moreConstrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
ToolChoiceAllowed { mode, tools, type } Constrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
ToolChoiceTypes { type } Indicates that the model should use a built-in tool to generate a response.
Learn more about built-in tools.
Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.
ToolChoiceMcp { server_label, type, name } Use this option to force the model to call a specific tool on a remote MCP server.
Use this option to force the model to call a specific tool on a remote MCP server.
tools: Array<FunctionTool { name, type, description, 2 more } | FileSearchTool { type, vector_store_ids, filters, 2 more } | ComputerTool { display_height, display_width, environment, type } | 9 more>
FunctionTool { name, type, description, 2 more } Defines a function in your own code the model can choose to call.
Learn more about function calling.
Defines a function in your own code the model can choose to call.
Learn more about function calling.
FileSearchTool { type, vector_store_ids, filters, 2 more } A tool that searches for relevant content from uploaded files.
Learn more about the file search tool.
A tool that searches for relevant content from uploaded files.
Learn more about the file search tool.
filters?: ComparisonFilter { key, type, value } | CompoundFilter { filters, type } A filter used to compare a specified attribute key to a given value using a defined comparison operation.
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
ComparisonFilter { key, type, value } A filter used to compare a specified attribute key to a given value using a defined comparison operation.
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
CompoundFilter { filters, type } Combine multiple filters using and or or.
Combine multiple filters using and or or.
ranking_options?: RankingOptions { hybrid_search, ranker, score_threshold } Ranking options for search.
Ranking options for search.
ComputerTool { display_height, display_width, environment, type } A tool that controls a virtual computer.
Learn more about the computer tool.
A tool that controls a virtual computer.
Learn more about the computer tool.
WebSearchTool { type, filters, search_context_size, user_location } Search the Internet for sources related to the prompt.
Learn more about the
web search tool.
Search the Internet for sources related to the prompt.
Learn more about the web search tool.
Mcp { server_label, type, allowed_tools, 6 more } Give the model access to additional tools via remote Model Context Protocol
(MCP) servers. Learn more about MCP.
Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
allowed_tools?: Array<string> | McpAllowedToolsMcpToolFilter { read_only, tool_names } A filter object to specify which tools are allowed.
A filter object to specify which tools are allowed.
require_approval?: McpRequireApprovalMcpToolApprovalFilter { always, never } | "always" | "never"Specify which of the MCP server’s tools require approval.
Can be
always, never, or a filter object associated with tools
that require approval.
Specify which of the MCP server’s tools require approval.
Can be
always, never, or a filter object associated with tools
that require approval.
CodeInterpreter { container, type } A tool that runs Python code to help generate a response to a prompt.
A tool that runs Python code to help generate a response to a prompt.
container: string | CodeInterpreterContainerCodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy } Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
CodeInterpreterContainerCodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy } Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
network_policy?: ContainerNetworkPolicyDisabled { type } | ContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
ImageGeneration { type, action, background, 9 more } A tool that generates images using the GPT image models.
A tool that generates images using the GPT image models.
FunctionShellTool { type, environment } A tool that allows the model to execute shell commands.
A tool that allows the model to execute shell commands.
environment?: ContainerAuto { type, file_ids, memory_limit, 2 more } | LocalEnvironment { type, skills } | ContainerReference { container_id, type }
ContainerAuto { type, file_ids, memory_limit, 2 more }
network_policy?: ContainerNetworkPolicyDisabled { type } | ContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
CustomTool { name, type, description, format } A custom tool that processes input using a specified format.
Learn more about custom tools
A custom tool that processes input using a specified format.
Learn more about custom tools
WebSearchPreviewTool { type, 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.
This tool searches the web for relevant results to use in a response.
Learn more about the web search tool.
The conversation that this response belonged to.
Input items and output items from this response were automatically added to this conversation.
The conversation that this response belonged to.
Input items and output items from this response were automatically added to this conversation.
An error object returned when the model fails to generate a Response.
An error object returned when the model fails to generate a Response.
instructions?: string | Array<EasyInputMessage { content, role, phase, type } | OpenAITypesResponsesResponseInputItemMessage { content, role, status, type } | OpenAIResponseOutputMessage { id, content, role, 3 more } | 23 more>
Array<EasyInputMessage { content, role, phase, type } | OpenAITypesResponsesResponseInputItemMessage { content, role, status, type } | OpenAIResponseOutputMessage { id, content, role, 3 more } | 23 more>
EasyInputMessage { 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.
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.
content: string | Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAITypesResponsesResponseInputItemMessage { content, role, status, 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.
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.
content: Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAITypesResponsesResponseInputItemComputerCallOutput { call_id, output, type, 3 more } The output of a computer tool call.
The output of a computer tool call.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAITypesResponsesResponseInputItemFunctionCallOutput { call_id, output, type, 2 more } The output of a function tool call.
The output of a function tool call.
output: string | Array<ResponseInputTextContent { text, type } | ResponseInputImageContent { type, detail, file_id, image_url } | ResponseInputFileContent { type, file_data, file_id, 2 more } >
Array<ResponseInputTextContent { text, type } | ResponseInputImageContent { type, detail, file_id, image_url } | ResponseInputFileContent { type, file_data, file_id, 2 more } >
ResponseInputImageContent { type, detail, file_id, image_url } An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItemParam { encrypted_content, type, id } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseInputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseInputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
OpenAITypesResponsesResponseInputItemLocalShellCallOutput { id, output, type, status } The output of a local shell tool call.
The output of a local shell tool call.
ShellCall { action, call_id, type, 3 more } A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
ShellCallOutput { call_id, output, type, 3 more } The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
ApplyPatchCall { call_id, operation, status, 2 more } A tool call representing a request to create, delete, or update files using diff patches.
A tool call representing a request to create, delete, or update files using diff patches.
operation: ApplyPatchCallOperationCreateFile { diff, path, type } | ApplyPatchCallOperationDeleteFile { path, type } | ApplyPatchCallOperationUpdateFile { diff, path, type } Instruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
ApplyPatchCallOutput { call_id, status, type, 2 more } The streamed output emitted by an apply patch tool call.
The streamed output emitted by an apply patch tool call.
OpenAITypesResponsesResponseInputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
McpApprovalRequest { id, arguments, name, 2 more } A request for human approval of a tool invocation.
A request for human approval of a tool invocation.
OpenAITypesResponsesResponseInputItemMcpApprovalResponse { approval_request_id, approve, type, 2 more } A response to an MCP approval request.
A response to an MCP approval request.
OpenAITypesResponsesResponseInputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAIResponseCustomToolCallOutput { call_id, output, type, id } The output of a custom tool call from your code, being sent back to the model.
The output of a custom tool call from your code, being sent back to the model.
output: string | Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
variables?: Record<string, string | OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
gpt-5 and o-series models only
Configuration options for
reasoning models.
gpt-5 and o-series models only
Configuration options for reasoning models.
Configuration options for a text response from the model.
Can be plain
text or structured JSON data. Learn more:
Configuration options for a text response from the model.
Can be plain text or structured JSON data. Learn more:
format?: ResponseFormatText { type } | ResponseFormatTextJsonSchemaConfig { name, schema, type, 2 more } | ResponseFormatJsonObject { type } Default response format. Used to generate text responses.
Default response format. Used to generate text responses.
ResponseFormatTextJsonSchemaConfig { name, schema, type, 2 more } JSON Schema response format.
Used to generate structured JSON responses.
Learn more about Structured Outputs.
JSON Schema response format.
Used to generate structured JSON responses. Learn more about Structured Outputs.
Represents token usage details including input tokens, output tokens,
a breakdown of output tokens, and the total tokens used.
Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used.
ResponseContentPartAddedEvent { content_index, item_id, output_index, 3 more } Emitted when a new content part is added.
Emitted when a new content part is added.
part: OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } | PartReasoningText { text, type } A text output from the model.
A text output from the model.
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
ResponseContentPartDoneEvent { content_index, item_id, output_index, 3 more } Emitted when a content part is done.
Emitted when a content part is done.
part: OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } | PartReasoningText { text, type } A text output from the model.
A text output from the model.
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
ResponseCreatedEvent { response, sequence_number, type } An event that is emitted when a response is created.
An event that is emitted when a response is created.
model: "gpt-5.2" | "gpt-5.2-2025-12-11" | "gpt-5.2-chat-latest" | 83 more | (string & {})
output: Array<OpenAIResponseOutputMessage { id, content, role, 3 more } | OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } | OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } | 15 more>
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItem { id, encrypted_content, type, created_by } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseOutputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseOutputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
ResponseFunctionShellToolCall { id, action, call_id, 4 more } A tool call that executes one or more shell commands in a managed environment.
A tool call that executes one or more shell commands in a managed environment.
action: Action { commands, max_output_length, timeout_ms } The shell commands and limits that describe how to run the tool call.
The shell commands and limits that describe how to run the tool call.
ResponseFunctionShellToolCallOutput { id, call_id, output, 4 more } The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
ResponseApplyPatchToolCall { id, call_id, operation, 3 more } A tool call that applies file diffs by creating, deleting, or updating files.
A tool call that applies file diffs by creating, deleting, or updating files.
operation: OperationCreateFile { diff, path, type } | OperationDeleteFile { path, type } | OperationUpdateFile { diff, path, type } Instruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
ResponseApplyPatchToolCallOutput { id, call_id, status, 3 more } The output emitted by an apply patch tool call.
The output emitted by an apply patch tool call.
OpenAITypesResponsesResponseOutputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAITypesResponsesResponseOutputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
tool_choice: "none" | "auto" | "required" | ToolChoiceAllowed { mode, tools, type } | ToolChoiceTypes { type } | 5 moreConstrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
ToolChoiceAllowed { mode, tools, type } Constrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
ToolChoiceTypes { type } Indicates that the model should use a built-in tool to generate a response.
Learn more about built-in tools.
Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.
ToolChoiceMcp { server_label, type, name } Use this option to force the model to call a specific tool on a remote MCP server.
Use this option to force the model to call a specific tool on a remote MCP server.
tools: Array<FunctionTool { name, type, description, 2 more } | FileSearchTool { type, vector_store_ids, filters, 2 more } | ComputerTool { display_height, display_width, environment, type } | 9 more>
FunctionTool { name, type, description, 2 more } Defines a function in your own code the model can choose to call.
Learn more about function calling.
Defines a function in your own code the model can choose to call.
Learn more about function calling.
FileSearchTool { type, vector_store_ids, filters, 2 more } A tool that searches for relevant content from uploaded files.
Learn more about the file search tool.
A tool that searches for relevant content from uploaded files.
Learn more about the file search tool.
filters?: ComparisonFilter { key, type, value } | CompoundFilter { filters, type } A filter used to compare a specified attribute key to a given value using a defined comparison operation.
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
ComparisonFilter { key, type, value } A filter used to compare a specified attribute key to a given value using a defined comparison operation.
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
CompoundFilter { filters, type } Combine multiple filters using and or or.
Combine multiple filters using and or or.
ranking_options?: RankingOptions { hybrid_search, ranker, score_threshold } Ranking options for search.
Ranking options for search.
ComputerTool { display_height, display_width, environment, type } A tool that controls a virtual computer.
Learn more about the computer tool.
A tool that controls a virtual computer.
Learn more about the computer tool.
WebSearchTool { type, filters, search_context_size, user_location } Search the Internet for sources related to the prompt.
Learn more about the
web search tool.
Search the Internet for sources related to the prompt.
Learn more about the web search tool.
Mcp { server_label, type, allowed_tools, 6 more } Give the model access to additional tools via remote Model Context Protocol
(MCP) servers. Learn more about MCP.
Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
allowed_tools?: Array<string> | McpAllowedToolsMcpToolFilter { read_only, tool_names } A filter object to specify which tools are allowed.
A filter object to specify which tools are allowed.
require_approval?: McpRequireApprovalMcpToolApprovalFilter { always, never } | "always" | "never"Specify which of the MCP server’s tools require approval.
Can be
always, never, or a filter object associated with tools
that require approval.
Specify which of the MCP server’s tools require approval.
Can be
always, never, or a filter object associated with tools
that require approval.
CodeInterpreter { container, type } A tool that runs Python code to help generate a response to a prompt.
A tool that runs Python code to help generate a response to a prompt.
container: string | CodeInterpreterContainerCodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy } Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
CodeInterpreterContainerCodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy } Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
network_policy?: ContainerNetworkPolicyDisabled { type } | ContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
ImageGeneration { type, action, background, 9 more } A tool that generates images using the GPT image models.
A tool that generates images using the GPT image models.
FunctionShellTool { type, environment } A tool that allows the model to execute shell commands.
A tool that allows the model to execute shell commands.
environment?: ContainerAuto { type, file_ids, memory_limit, 2 more } | LocalEnvironment { type, skills } | ContainerReference { container_id, type }
ContainerAuto { type, file_ids, memory_limit, 2 more }
network_policy?: ContainerNetworkPolicyDisabled { type } | ContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
CustomTool { name, type, description, format } A custom tool that processes input using a specified format.
Learn more about custom tools
A custom tool that processes input using a specified format.
Learn more about custom tools
WebSearchPreviewTool { type, 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.
This tool searches the web for relevant results to use in a response.
Learn more about the web search tool.
The conversation that this response belonged to.
Input items and output items from this response were automatically added to this conversation.
The conversation that this response belonged to.
Input items and output items from this response were automatically added to this conversation.
An error object returned when the model fails to generate a Response.
An error object returned when the model fails to generate a Response.
instructions?: string | Array<EasyInputMessage { content, role, phase, type } | OpenAITypesResponsesResponseInputItemMessage { content, role, status, type } | OpenAIResponseOutputMessage { id, content, role, 3 more } | 23 more>
Array<EasyInputMessage { content, role, phase, type } | OpenAITypesResponsesResponseInputItemMessage { content, role, status, type } | OpenAIResponseOutputMessage { id, content, role, 3 more } | 23 more>
EasyInputMessage { 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.
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.
content: string | Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAITypesResponsesResponseInputItemMessage { content, role, status, 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.
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.
content: Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAITypesResponsesResponseInputItemComputerCallOutput { call_id, output, type, 3 more } The output of a computer tool call.
The output of a computer tool call.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAITypesResponsesResponseInputItemFunctionCallOutput { call_id, output, type, 2 more } The output of a function tool call.
The output of a function tool call.
output: string | Array<ResponseInputTextContent { text, type } | ResponseInputImageContent { type, detail, file_id, image_url } | ResponseInputFileContent { type, file_data, file_id, 2 more } >
Array<ResponseInputTextContent { text, type } | ResponseInputImageContent { type, detail, file_id, image_url } | ResponseInputFileContent { type, file_data, file_id, 2 more } >
ResponseInputImageContent { type, detail, file_id, image_url } An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItemParam { encrypted_content, type, id } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseInputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseInputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
OpenAITypesResponsesResponseInputItemLocalShellCallOutput { id, output, type, status } The output of a local shell tool call.
The output of a local shell tool call.
ShellCall { action, call_id, type, 3 more } A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
ShellCallOutput { call_id, output, type, 3 more } The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
ApplyPatchCall { call_id, operation, status, 2 more } A tool call representing a request to create, delete, or update files using diff patches.
A tool call representing a request to create, delete, or update files using diff patches.
operation: ApplyPatchCallOperationCreateFile { diff, path, type } | ApplyPatchCallOperationDeleteFile { path, type } | ApplyPatchCallOperationUpdateFile { diff, path, type } Instruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
ApplyPatchCallOutput { call_id, status, type, 2 more } The streamed output emitted by an apply patch tool call.
The streamed output emitted by an apply patch tool call.
OpenAITypesResponsesResponseInputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
McpApprovalRequest { id, arguments, name, 2 more } A request for human approval of a tool invocation.
A request for human approval of a tool invocation.
OpenAITypesResponsesResponseInputItemMcpApprovalResponse { approval_request_id, approve, type, 2 more } A response to an MCP approval request.
A response to an MCP approval request.
OpenAITypesResponsesResponseInputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAIResponseCustomToolCallOutput { call_id, output, type, id } The output of a custom tool call from your code, being sent back to the model.
The output of a custom tool call from your code, being sent back to the model.
output: string | Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
variables?: Record<string, string | OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
gpt-5 and o-series models only
Configuration options for
reasoning models.
gpt-5 and o-series models only
Configuration options for reasoning models.
Configuration options for a text response from the model.
Can be plain
text or structured JSON data. Learn more:
Configuration options for a text response from the model.
Can be plain text or structured JSON data. Learn more:
format?: ResponseFormatText { type } | ResponseFormatTextJsonSchemaConfig { name, schema, type, 2 more } | ResponseFormatJsonObject { type } Default response format. Used to generate text responses.
Default response format. Used to generate text responses.
ResponseFormatTextJsonSchemaConfig { name, schema, type, 2 more } JSON Schema response format.
Used to generate structured JSON responses.
Learn more about Structured Outputs.
JSON Schema response format.
Used to generate structured JSON responses. Learn more about Structured Outputs.
Represents token usage details including input tokens, output tokens,
a breakdown of output tokens, and the total tokens used.
Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used.
ResponseFileSearchCallCompletedEvent { item_id, output_index, sequence_number, type } Emitted when a file search call is completed (results found).
Emitted when a file search call is completed (results found).
ResponseFileSearchCallInProgressEvent { item_id, output_index, sequence_number, type } Emitted when a file search call is initiated.
Emitted when a file search call is initiated.
ResponseFileSearchCallSearchingEvent { item_id, output_index, sequence_number, type } Emitted when a file search is currently searching.
Emitted when a file search is currently searching.
ResponseFunctionCallArgumentsDeltaEvent { delta, item_id, output_index, 2 more } Emitted when there is a partial function-call arguments delta.
Emitted when there is a partial function-call arguments delta.
ResponseFunctionCallArgumentsDoneEvent { arguments, item_id, name, 3 more } Emitted when function-call arguments are finalized.
Emitted when function-call arguments are finalized.
ResponseInProgressEvent { response, sequence_number, type } Emitted when the response is in progress.
Emitted when the response is in progress.
model: "gpt-5.2" | "gpt-5.2-2025-12-11" | "gpt-5.2-chat-latest" | 83 more | (string & {})
output: Array<OpenAIResponseOutputMessage { id, content, role, 3 more } | OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } | OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } | 15 more>
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItem { id, encrypted_content, type, created_by } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseOutputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseOutputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
ResponseFunctionShellToolCall { id, action, call_id, 4 more } A tool call that executes one or more shell commands in a managed environment.
A tool call that executes one or more shell commands in a managed environment.
action: Action { commands, max_output_length, timeout_ms } The shell commands and limits that describe how to run the tool call.
The shell commands and limits that describe how to run the tool call.
ResponseFunctionShellToolCallOutput { id, call_id, output, 4 more } The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
ResponseApplyPatchToolCall { id, call_id, operation, 3 more } A tool call that applies file diffs by creating, deleting, or updating files.
A tool call that applies file diffs by creating, deleting, or updating files.
operation: OperationCreateFile { diff, path, type } | OperationDeleteFile { path, type } | OperationUpdateFile { diff, path, type } Instruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
ResponseApplyPatchToolCallOutput { id, call_id, status, 3 more } The output emitted by an apply patch tool call.
The output emitted by an apply patch tool call.
OpenAITypesResponsesResponseOutputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAITypesResponsesResponseOutputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
tool_choice: "none" | "auto" | "required" | ToolChoiceAllowed { mode, tools, type } | ToolChoiceTypes { type } | 5 moreConstrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
ToolChoiceAllowed { mode, tools, type } Constrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
ToolChoiceTypes { type } Indicates that the model should use a built-in tool to generate a response.
Learn more about built-in tools.
Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.
ToolChoiceMcp { server_label, type, name } Use this option to force the model to call a specific tool on a remote MCP server.
Use this option to force the model to call a specific tool on a remote MCP server.
tools: Array<FunctionTool { name, type, description, 2 more } | FileSearchTool { type, vector_store_ids, filters, 2 more } | ComputerTool { display_height, display_width, environment, type } | 9 more>
FunctionTool { name, type, description, 2 more } Defines a function in your own code the model can choose to call.
Learn more about function calling.
Defines a function in your own code the model can choose to call.
Learn more about function calling.
FileSearchTool { type, vector_store_ids, filters, 2 more } A tool that searches for relevant content from uploaded files.
Learn more about the file search tool.
A tool that searches for relevant content from uploaded files.
Learn more about the file search tool.
filters?: ComparisonFilter { key, type, value } | CompoundFilter { filters, type } A filter used to compare a specified attribute key to a given value using a defined comparison operation.
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
ComparisonFilter { key, type, value } A filter used to compare a specified attribute key to a given value using a defined comparison operation.
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
CompoundFilter { filters, type } Combine multiple filters using and or or.
Combine multiple filters using and or or.
ranking_options?: RankingOptions { hybrid_search, ranker, score_threshold } Ranking options for search.
Ranking options for search.
ComputerTool { display_height, display_width, environment, type } A tool that controls a virtual computer.
Learn more about the computer tool.
A tool that controls a virtual computer.
Learn more about the computer tool.
WebSearchTool { type, filters, search_context_size, user_location } Search the Internet for sources related to the prompt.
Learn more about the
web search tool.
Search the Internet for sources related to the prompt.
Learn more about the web search tool.
Mcp { server_label, type, allowed_tools, 6 more } Give the model access to additional tools via remote Model Context Protocol
(MCP) servers. Learn more about MCP.
Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
allowed_tools?: Array<string> | McpAllowedToolsMcpToolFilter { read_only, tool_names } A filter object to specify which tools are allowed.
A filter object to specify which tools are allowed.
require_approval?: McpRequireApprovalMcpToolApprovalFilter { always, never } | "always" | "never"Specify which of the MCP server’s tools require approval.
Can be
always, never, or a filter object associated with tools
that require approval.
Specify which of the MCP server’s tools require approval.
Can be
always, never, or a filter object associated with tools
that require approval.
CodeInterpreter { container, type } A tool that runs Python code to help generate a response to a prompt.
A tool that runs Python code to help generate a response to a prompt.
container: string | CodeInterpreterContainerCodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy } Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
CodeInterpreterContainerCodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy } Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
network_policy?: ContainerNetworkPolicyDisabled { type } | ContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
ImageGeneration { type, action, background, 9 more } A tool that generates images using the GPT image models.
A tool that generates images using the GPT image models.
FunctionShellTool { type, environment } A tool that allows the model to execute shell commands.
A tool that allows the model to execute shell commands.
environment?: ContainerAuto { type, file_ids, memory_limit, 2 more } | LocalEnvironment { type, skills } | ContainerReference { container_id, type }
ContainerAuto { type, file_ids, memory_limit, 2 more }
network_policy?: ContainerNetworkPolicyDisabled { type } | ContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
CustomTool { name, type, description, format } A custom tool that processes input using a specified format.
Learn more about custom tools
A custom tool that processes input using a specified format.
Learn more about custom tools
WebSearchPreviewTool { type, 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.
This tool searches the web for relevant results to use in a response.
Learn more about the web search tool.
The conversation that this response belonged to.
Input items and output items from this response were automatically added to this conversation.
The conversation that this response belonged to.
Input items and output items from this response were automatically added to this conversation.
An error object returned when the model fails to generate a Response.
An error object returned when the model fails to generate a Response.
instructions?: string | Array<EasyInputMessage { content, role, phase, type } | OpenAITypesResponsesResponseInputItemMessage { content, role, status, type } | OpenAIResponseOutputMessage { id, content, role, 3 more } | 23 more>
Array<EasyInputMessage { content, role, phase, type } | OpenAITypesResponsesResponseInputItemMessage { content, role, status, type } | OpenAIResponseOutputMessage { id, content, role, 3 more } | 23 more>
EasyInputMessage { 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.
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.
content: string | Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAITypesResponsesResponseInputItemMessage { content, role, status, 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.
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.
content: Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAITypesResponsesResponseInputItemComputerCallOutput { call_id, output, type, 3 more } The output of a computer tool call.
The output of a computer tool call.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAITypesResponsesResponseInputItemFunctionCallOutput { call_id, output, type, 2 more } The output of a function tool call.
The output of a function tool call.
output: string | Array<ResponseInputTextContent { text, type } | ResponseInputImageContent { type, detail, file_id, image_url } | ResponseInputFileContent { type, file_data, file_id, 2 more } >
Array<ResponseInputTextContent { text, type } | ResponseInputImageContent { type, detail, file_id, image_url } | ResponseInputFileContent { type, file_data, file_id, 2 more } >
ResponseInputImageContent { type, detail, file_id, image_url } An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItemParam { encrypted_content, type, id } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseInputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseInputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
OpenAITypesResponsesResponseInputItemLocalShellCallOutput { id, output, type, status } The output of a local shell tool call.
The output of a local shell tool call.
ShellCall { action, call_id, type, 3 more } A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
ShellCallOutput { call_id, output, type, 3 more } The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
ApplyPatchCall { call_id, operation, status, 2 more } A tool call representing a request to create, delete, or update files using diff patches.
A tool call representing a request to create, delete, or update files using diff patches.
operation: ApplyPatchCallOperationCreateFile { diff, path, type } | ApplyPatchCallOperationDeleteFile { path, type } | ApplyPatchCallOperationUpdateFile { diff, path, type } Instruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
ApplyPatchCallOutput { call_id, status, type, 2 more } The streamed output emitted by an apply patch tool call.
The streamed output emitted by an apply patch tool call.
OpenAITypesResponsesResponseInputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
McpApprovalRequest { id, arguments, name, 2 more } A request for human approval of a tool invocation.
A request for human approval of a tool invocation.
OpenAITypesResponsesResponseInputItemMcpApprovalResponse { approval_request_id, approve, type, 2 more } A response to an MCP approval request.
A response to an MCP approval request.
OpenAITypesResponsesResponseInputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAIResponseCustomToolCallOutput { call_id, output, type, id } The output of a custom tool call from your code, being sent back to the model.
The output of a custom tool call from your code, being sent back to the model.
output: string | Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
variables?: Record<string, string | OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
gpt-5 and o-series models only
Configuration options for
reasoning models.
gpt-5 and o-series models only
Configuration options for reasoning models.
Configuration options for a text response from the model.
Can be plain
text or structured JSON data. Learn more:
Configuration options for a text response from the model.
Can be plain text or structured JSON data. Learn more:
format?: ResponseFormatText { type } | ResponseFormatTextJsonSchemaConfig { name, schema, type, 2 more } | ResponseFormatJsonObject { type } Default response format. Used to generate text responses.
Default response format. Used to generate text responses.
ResponseFormatTextJsonSchemaConfig { name, schema, type, 2 more } JSON Schema response format.
Used to generate structured JSON responses.
Learn more about Structured Outputs.
JSON Schema response format.
Used to generate structured JSON responses. Learn more about Structured Outputs.
Represents token usage details including input tokens, output tokens,
a breakdown of output tokens, and the total tokens used.
Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used.
ResponseFailedEvent { response, sequence_number, type } An event that is emitted when a response fails.
An event that is emitted when a response fails.
model: "gpt-5.2" | "gpt-5.2-2025-12-11" | "gpt-5.2-chat-latest" | 83 more | (string & {})
output: Array<OpenAIResponseOutputMessage { id, content, role, 3 more } | OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } | OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } | 15 more>
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItem { id, encrypted_content, type, created_by } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseOutputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseOutputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
ResponseFunctionShellToolCall { id, action, call_id, 4 more } A tool call that executes one or more shell commands in a managed environment.
A tool call that executes one or more shell commands in a managed environment.
action: Action { commands, max_output_length, timeout_ms } The shell commands and limits that describe how to run the tool call.
The shell commands and limits that describe how to run the tool call.
ResponseFunctionShellToolCallOutput { id, call_id, output, 4 more } The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
ResponseApplyPatchToolCall { id, call_id, operation, 3 more } A tool call that applies file diffs by creating, deleting, or updating files.
A tool call that applies file diffs by creating, deleting, or updating files.
operation: OperationCreateFile { diff, path, type } | OperationDeleteFile { path, type } | OperationUpdateFile { diff, path, type } Instruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
ResponseApplyPatchToolCallOutput { id, call_id, status, 3 more } The output emitted by an apply patch tool call.
The output emitted by an apply patch tool call.
OpenAITypesResponsesResponseOutputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAITypesResponsesResponseOutputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
tool_choice: "none" | "auto" | "required" | ToolChoiceAllowed { mode, tools, type } | ToolChoiceTypes { type } | 5 moreConstrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
ToolChoiceAllowed { mode, tools, type } Constrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
ToolChoiceTypes { type } Indicates that the model should use a built-in tool to generate a response.
Learn more about built-in tools.
Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.
ToolChoiceMcp { server_label, type, name } Use this option to force the model to call a specific tool on a remote MCP server.
Use this option to force the model to call a specific tool on a remote MCP server.
tools: Array<FunctionTool { name, type, description, 2 more } | FileSearchTool { type, vector_store_ids, filters, 2 more } | ComputerTool { display_height, display_width, environment, type } | 9 more>
FunctionTool { name, type, description, 2 more } Defines a function in your own code the model can choose to call.
Learn more about function calling.
Defines a function in your own code the model can choose to call.
Learn more about function calling.
FileSearchTool { type, vector_store_ids, filters, 2 more } A tool that searches for relevant content from uploaded files.
Learn more about the file search tool.
A tool that searches for relevant content from uploaded files.
Learn more about the file search tool.
filters?: ComparisonFilter { key, type, value } | CompoundFilter { filters, type } A filter used to compare a specified attribute key to a given value using a defined comparison operation.
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
ComparisonFilter { key, type, value } A filter used to compare a specified attribute key to a given value using a defined comparison operation.
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
CompoundFilter { filters, type } Combine multiple filters using and or or.
Combine multiple filters using and or or.
ranking_options?: RankingOptions { hybrid_search, ranker, score_threshold } Ranking options for search.
Ranking options for search.
ComputerTool { display_height, display_width, environment, type } A tool that controls a virtual computer.
Learn more about the computer tool.
A tool that controls a virtual computer.
Learn more about the computer tool.
WebSearchTool { type, filters, search_context_size, user_location } Search the Internet for sources related to the prompt.
Learn more about the
web search tool.
Search the Internet for sources related to the prompt.
Learn more about the web search tool.
Mcp { server_label, type, allowed_tools, 6 more } Give the model access to additional tools via remote Model Context Protocol
(MCP) servers. Learn more about MCP.
Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
allowed_tools?: Array<string> | McpAllowedToolsMcpToolFilter { read_only, tool_names } A filter object to specify which tools are allowed.
A filter object to specify which tools are allowed.
require_approval?: McpRequireApprovalMcpToolApprovalFilter { always, never } | "always" | "never"Specify which of the MCP server’s tools require approval.
Can be
always, never, or a filter object associated with tools
that require approval.
Specify which of the MCP server’s tools require approval.
Can be
always, never, or a filter object associated with tools
that require approval.
CodeInterpreter { container, type } A tool that runs Python code to help generate a response to a prompt.
A tool that runs Python code to help generate a response to a prompt.
container: string | CodeInterpreterContainerCodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy } Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
CodeInterpreterContainerCodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy } Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
network_policy?: ContainerNetworkPolicyDisabled { type } | ContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
ImageGeneration { type, action, background, 9 more } A tool that generates images using the GPT image models.
A tool that generates images using the GPT image models.
FunctionShellTool { type, environment } A tool that allows the model to execute shell commands.
A tool that allows the model to execute shell commands.
environment?: ContainerAuto { type, file_ids, memory_limit, 2 more } | LocalEnvironment { type, skills } | ContainerReference { container_id, type }
ContainerAuto { type, file_ids, memory_limit, 2 more }
network_policy?: ContainerNetworkPolicyDisabled { type } | ContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
CustomTool { name, type, description, format } A custom tool that processes input using a specified format.
Learn more about custom tools
A custom tool that processes input using a specified format.
Learn more about custom tools
WebSearchPreviewTool { type, 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.
This tool searches the web for relevant results to use in a response.
Learn more about the web search tool.
The conversation that this response belonged to.
Input items and output items from this response were automatically added to this conversation.
The conversation that this response belonged to.
Input items and output items from this response were automatically added to this conversation.
An error object returned when the model fails to generate a Response.
An error object returned when the model fails to generate a Response.
instructions?: string | Array<EasyInputMessage { content, role, phase, type } | OpenAITypesResponsesResponseInputItemMessage { content, role, status, type } | OpenAIResponseOutputMessage { id, content, role, 3 more } | 23 more>
Array<EasyInputMessage { content, role, phase, type } | OpenAITypesResponsesResponseInputItemMessage { content, role, status, type } | OpenAIResponseOutputMessage { id, content, role, 3 more } | 23 more>
EasyInputMessage { 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.
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.
content: string | Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAITypesResponsesResponseInputItemMessage { content, role, status, 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.
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.
content: Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAITypesResponsesResponseInputItemComputerCallOutput { call_id, output, type, 3 more } The output of a computer tool call.
The output of a computer tool call.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAITypesResponsesResponseInputItemFunctionCallOutput { call_id, output, type, 2 more } The output of a function tool call.
The output of a function tool call.
output: string | Array<ResponseInputTextContent { text, type } | ResponseInputImageContent { type, detail, file_id, image_url } | ResponseInputFileContent { type, file_data, file_id, 2 more } >
Array<ResponseInputTextContent { text, type } | ResponseInputImageContent { type, detail, file_id, image_url } | ResponseInputFileContent { type, file_data, file_id, 2 more } >
ResponseInputImageContent { type, detail, file_id, image_url } An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItemParam { encrypted_content, type, id } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseInputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseInputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
OpenAITypesResponsesResponseInputItemLocalShellCallOutput { id, output, type, status } The output of a local shell tool call.
The output of a local shell tool call.
ShellCall { action, call_id, type, 3 more } A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
ShellCallOutput { call_id, output, type, 3 more } The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
ApplyPatchCall { call_id, operation, status, 2 more } A tool call representing a request to create, delete, or update files using diff patches.
A tool call representing a request to create, delete, or update files using diff patches.
operation: ApplyPatchCallOperationCreateFile { diff, path, type } | ApplyPatchCallOperationDeleteFile { path, type } | ApplyPatchCallOperationUpdateFile { diff, path, type } Instruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
ApplyPatchCallOutput { call_id, status, type, 2 more } The streamed output emitted by an apply patch tool call.
The streamed output emitted by an apply patch tool call.
OpenAITypesResponsesResponseInputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
McpApprovalRequest { id, arguments, name, 2 more } A request for human approval of a tool invocation.
A request for human approval of a tool invocation.
OpenAITypesResponsesResponseInputItemMcpApprovalResponse { approval_request_id, approve, type, 2 more } A response to an MCP approval request.
A response to an MCP approval request.
OpenAITypesResponsesResponseInputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAIResponseCustomToolCallOutput { call_id, output, type, id } The output of a custom tool call from your code, being sent back to the model.
The output of a custom tool call from your code, being sent back to the model.
output: string | Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
variables?: Record<string, string | OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
gpt-5 and o-series models only
Configuration options for
reasoning models.
gpt-5 and o-series models only
Configuration options for reasoning models.
Configuration options for a text response from the model.
Can be plain
text or structured JSON data. Learn more:
Configuration options for a text response from the model.
Can be plain text or structured JSON data. Learn more:
format?: ResponseFormatText { type } | ResponseFormatTextJsonSchemaConfig { name, schema, type, 2 more } | ResponseFormatJsonObject { type } Default response format. Used to generate text responses.
Default response format. Used to generate text responses.
ResponseFormatTextJsonSchemaConfig { name, schema, type, 2 more } JSON Schema response format.
Used to generate structured JSON responses.
Learn more about Structured Outputs.
JSON Schema response format.
Used to generate structured JSON responses. Learn more about Structured Outputs.
Represents token usage details including input tokens, output tokens,
a breakdown of output tokens, and the total tokens used.
Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used.
ResponseIncompleteEvent { response, sequence_number, type } An event that is emitted when a response finishes as incomplete.
An event that is emitted when a response finishes as incomplete.
model: "gpt-5.2" | "gpt-5.2-2025-12-11" | "gpt-5.2-chat-latest" | 83 more | (string & {})
output: Array<OpenAIResponseOutputMessage { id, content, role, 3 more } | OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } | OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } | 15 more>
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItem { id, encrypted_content, type, created_by } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseOutputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseOutputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
ResponseFunctionShellToolCall { id, action, call_id, 4 more } A tool call that executes one or more shell commands in a managed environment.
A tool call that executes one or more shell commands in a managed environment.
action: Action { commands, max_output_length, timeout_ms } The shell commands and limits that describe how to run the tool call.
The shell commands and limits that describe how to run the tool call.
ResponseFunctionShellToolCallOutput { id, call_id, output, 4 more } The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
ResponseApplyPatchToolCall { id, call_id, operation, 3 more } A tool call that applies file diffs by creating, deleting, or updating files.
A tool call that applies file diffs by creating, deleting, or updating files.
operation: OperationCreateFile { diff, path, type } | OperationDeleteFile { path, type } | OperationUpdateFile { diff, path, type } Instruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
ResponseApplyPatchToolCallOutput { id, call_id, status, 3 more } The output emitted by an apply patch tool call.
The output emitted by an apply patch tool call.
OpenAITypesResponsesResponseOutputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAITypesResponsesResponseOutputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
tool_choice: "none" | "auto" | "required" | ToolChoiceAllowed { mode, tools, type } | ToolChoiceTypes { type } | 5 moreConstrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
ToolChoiceAllowed { mode, tools, type } Constrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
ToolChoiceTypes { type } Indicates that the model should use a built-in tool to generate a response.
Learn more about built-in tools.
Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.
ToolChoiceMcp { server_label, type, name } Use this option to force the model to call a specific tool on a remote MCP server.
Use this option to force the model to call a specific tool on a remote MCP server.
tools: Array<FunctionTool { name, type, description, 2 more } | FileSearchTool { type, vector_store_ids, filters, 2 more } | ComputerTool { display_height, display_width, environment, type } | 9 more>
FunctionTool { name, type, description, 2 more } Defines a function in your own code the model can choose to call.
Learn more about function calling.
Defines a function in your own code the model can choose to call.
Learn more about function calling.
FileSearchTool { type, vector_store_ids, filters, 2 more } A tool that searches for relevant content from uploaded files.
Learn more about the file search tool.
A tool that searches for relevant content from uploaded files.
Learn more about the file search tool.
filters?: ComparisonFilter { key, type, value } | CompoundFilter { filters, type } A filter used to compare a specified attribute key to a given value using a defined comparison operation.
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
ComparisonFilter { key, type, value } A filter used to compare a specified attribute key to a given value using a defined comparison operation.
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
CompoundFilter { filters, type } Combine multiple filters using and or or.
Combine multiple filters using and or or.
ranking_options?: RankingOptions { hybrid_search, ranker, score_threshold } Ranking options for search.
Ranking options for search.
ComputerTool { display_height, display_width, environment, type } A tool that controls a virtual computer.
Learn more about the computer tool.
A tool that controls a virtual computer.
Learn more about the computer tool.
WebSearchTool { type, filters, search_context_size, user_location } Search the Internet for sources related to the prompt.
Learn more about the
web search tool.
Search the Internet for sources related to the prompt.
Learn more about the web search tool.
Mcp { server_label, type, allowed_tools, 6 more } Give the model access to additional tools via remote Model Context Protocol
(MCP) servers. Learn more about MCP.
Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
allowed_tools?: Array<string> | McpAllowedToolsMcpToolFilter { read_only, tool_names } A filter object to specify which tools are allowed.
A filter object to specify which tools are allowed.
require_approval?: McpRequireApprovalMcpToolApprovalFilter { always, never } | "always" | "never"Specify which of the MCP server’s tools require approval.
Can be
always, never, or a filter object associated with tools
that require approval.
Specify which of the MCP server’s tools require approval.
Can be
always, never, or a filter object associated with tools
that require approval.
CodeInterpreter { container, type } A tool that runs Python code to help generate a response to a prompt.
A tool that runs Python code to help generate a response to a prompt.
container: string | CodeInterpreterContainerCodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy } Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
CodeInterpreterContainerCodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy } Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
network_policy?: ContainerNetworkPolicyDisabled { type } | ContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
ImageGeneration { type, action, background, 9 more } A tool that generates images using the GPT image models.
A tool that generates images using the GPT image models.
FunctionShellTool { type, environment } A tool that allows the model to execute shell commands.
A tool that allows the model to execute shell commands.
environment?: ContainerAuto { type, file_ids, memory_limit, 2 more } | LocalEnvironment { type, skills } | ContainerReference { container_id, type }
ContainerAuto { type, file_ids, memory_limit, 2 more }
network_policy?: ContainerNetworkPolicyDisabled { type } | ContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
CustomTool { name, type, description, format } A custom tool that processes input using a specified format.
Learn more about custom tools
A custom tool that processes input using a specified format.
Learn more about custom tools
WebSearchPreviewTool { type, 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.
This tool searches the web for relevant results to use in a response.
Learn more about the web search tool.
The conversation that this response belonged to.
Input items and output items from this response were automatically added to this conversation.
The conversation that this response belonged to.
Input items and output items from this response were automatically added to this conversation.
An error object returned when the model fails to generate a Response.
An error object returned when the model fails to generate a Response.
instructions?: string | Array<EasyInputMessage { content, role, phase, type } | OpenAITypesResponsesResponseInputItemMessage { content, role, status, type } | OpenAIResponseOutputMessage { id, content, role, 3 more } | 23 more>
Array<EasyInputMessage { content, role, phase, type } | OpenAITypesResponsesResponseInputItemMessage { content, role, status, type } | OpenAIResponseOutputMessage { id, content, role, 3 more } | 23 more>
EasyInputMessage { 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.
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.
content: string | Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAITypesResponsesResponseInputItemMessage { content, role, status, 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.
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.
content: Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAITypesResponsesResponseInputItemComputerCallOutput { call_id, output, type, 3 more } The output of a computer tool call.
The output of a computer tool call.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAITypesResponsesResponseInputItemFunctionCallOutput { call_id, output, type, 2 more } The output of a function tool call.
The output of a function tool call.
output: string | Array<ResponseInputTextContent { text, type } | ResponseInputImageContent { type, detail, file_id, image_url } | ResponseInputFileContent { type, file_data, file_id, 2 more } >
Array<ResponseInputTextContent { text, type } | ResponseInputImageContent { type, detail, file_id, image_url } | ResponseInputFileContent { type, file_data, file_id, 2 more } >
ResponseInputImageContent { type, detail, file_id, image_url } An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItemParam { encrypted_content, type, id } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseInputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseInputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
OpenAITypesResponsesResponseInputItemLocalShellCallOutput { id, output, type, status } The output of a local shell tool call.
The output of a local shell tool call.
ShellCall { action, call_id, type, 3 more } A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
ShellCallOutput { call_id, output, type, 3 more } The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
ApplyPatchCall { call_id, operation, status, 2 more } A tool call representing a request to create, delete, or update files using diff patches.
A tool call representing a request to create, delete, or update files using diff patches.
operation: ApplyPatchCallOperationCreateFile { diff, path, type } | ApplyPatchCallOperationDeleteFile { path, type } | ApplyPatchCallOperationUpdateFile { diff, path, type } Instruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
ApplyPatchCallOutput { call_id, status, type, 2 more } The streamed output emitted by an apply patch tool call.
The streamed output emitted by an apply patch tool call.
OpenAITypesResponsesResponseInputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
McpApprovalRequest { id, arguments, name, 2 more } A request for human approval of a tool invocation.
A request for human approval of a tool invocation.
OpenAITypesResponsesResponseInputItemMcpApprovalResponse { approval_request_id, approve, type, 2 more } A response to an MCP approval request.
A response to an MCP approval request.
OpenAITypesResponsesResponseInputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAIResponseCustomToolCallOutput { call_id, output, type, id } The output of a custom tool call from your code, being sent back to the model.
The output of a custom tool call from your code, being sent back to the model.
output: string | Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
variables?: Record<string, string | OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
gpt-5 and o-series models only
Configuration options for
reasoning models.
gpt-5 and o-series models only
Configuration options for reasoning models.
Configuration options for a text response from the model.
Can be plain
text or structured JSON data. Learn more:
Configuration options for a text response from the model.
Can be plain text or structured JSON data. Learn more:
format?: ResponseFormatText { type } | ResponseFormatTextJsonSchemaConfig { name, schema, type, 2 more } | ResponseFormatJsonObject { type } Default response format. Used to generate text responses.
Default response format. Used to generate text responses.
ResponseFormatTextJsonSchemaConfig { name, schema, type, 2 more } JSON Schema response format.
Used to generate structured JSON responses.
Learn more about Structured Outputs.
JSON Schema response format.
Used to generate structured JSON responses. Learn more about Structured Outputs.
Represents token usage details including input tokens, output tokens,
a breakdown of output tokens, and the total tokens used.
Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used.
ResponseOutputItemAddedEvent { item, output_index, sequence_number, type } Emitted when a new output item is added.
Emitted when a new output item is added.
item: OpenAIResponseOutputMessage { id, content, role, 3 more } | OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } | OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } | 15 moreAn output message from the model.
An output message from the model.
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItem { id, encrypted_content, type, created_by } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseOutputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseOutputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
ResponseFunctionShellToolCall { id, action, call_id, 4 more } A tool call that executes one or more shell commands in a managed environment.
A tool call that executes one or more shell commands in a managed environment.
action: Action { commands, max_output_length, timeout_ms } The shell commands and limits that describe how to run the tool call.
The shell commands and limits that describe how to run the tool call.
ResponseFunctionShellToolCallOutput { id, call_id, output, 4 more } The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
ResponseApplyPatchToolCall { id, call_id, operation, 3 more } A tool call that applies file diffs by creating, deleting, or updating files.
A tool call that applies file diffs by creating, deleting, or updating files.
operation: OperationCreateFile { diff, path, type } | OperationDeleteFile { path, type } | OperationUpdateFile { diff, path, type } Instruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
ResponseApplyPatchToolCallOutput { id, call_id, status, 3 more } The output emitted by an apply patch tool call.
The output emitted by an apply patch tool call.
OpenAITypesResponsesResponseOutputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAITypesResponsesResponseOutputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
ResponseOutputItemDoneEvent { item, output_index, sequence_number, type } Emitted when an output item is marked done.
Emitted when an output item is marked done.
item: OpenAIResponseOutputMessage { id, content, role, 3 more } | OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } | OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } | 15 moreAn output message from the model.
An output message from the model.
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItem { id, encrypted_content, type, created_by } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseOutputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseOutputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
ResponseFunctionShellToolCall { id, action, call_id, 4 more } A tool call that executes one or more shell commands in a managed environment.
A tool call that executes one or more shell commands in a managed environment.
action: Action { commands, max_output_length, timeout_ms } The shell commands and limits that describe how to run the tool call.
The shell commands and limits that describe how to run the tool call.
ResponseFunctionShellToolCallOutput { id, call_id, output, 4 more } The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
ResponseApplyPatchToolCall { id, call_id, operation, 3 more } A tool call that applies file diffs by creating, deleting, or updating files.
A tool call that applies file diffs by creating, deleting, or updating files.
operation: OperationCreateFile { diff, path, type } | OperationDeleteFile { path, type } | OperationUpdateFile { diff, path, type } Instruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
ResponseApplyPatchToolCallOutput { id, call_id, status, 3 more } The output emitted by an apply patch tool call.
The output emitted by an apply patch tool call.
OpenAITypesResponsesResponseOutputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAITypesResponsesResponseOutputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
ResponseReasoningSummaryPartAddedEvent { item_id, output_index, part, 3 more } Emitted when a new reasoning summary part is added.
Emitted when a new reasoning summary part is added.
ResponseReasoningSummaryPartDoneEvent { item_id, output_index, part, 3 more } Emitted when a reasoning summary part is completed.
Emitted when a reasoning summary part is completed.
ResponseReasoningSummaryTextDeltaEvent { delta, item_id, output_index, 3 more } Emitted when a delta is added to a reasoning summary text.
Emitted when a delta is added to a reasoning summary text.
ResponseReasoningSummaryTextDoneEvent { item_id, output_index, sequence_number, 3 more } Emitted when a reasoning summary text is completed.
Emitted when a reasoning summary text is completed.
ResponseReasoningTextDeltaEvent { content_index, delta, item_id, 3 more } Emitted when a delta is added to a reasoning text.
Emitted when a delta is added to a reasoning text.
ResponseReasoningTextDoneEvent { content_index, item_id, output_index, 3 more } Emitted when a reasoning text is completed.
Emitted when a reasoning text is completed.
ResponseRefusalDeltaEvent { content_index, delta, item_id, 3 more } Emitted when there is a partial refusal text.
Emitted when there is a partial refusal text.
ResponseRefusalDoneEvent { content_index, item_id, output_index, 3 more } Emitted when refusal text is finalized.
Emitted when refusal text is finalized.
ResponseTextDeltaEvent { content_index, delta, item_id, 4 more } Emitted when there is an additional text delta.
Emitted when there is an additional text delta.
ResponseTextDoneEvent { content_index, item_id, logprobs, 4 more } Emitted when text content is finalized.
Emitted when text content is finalized.
ResponseWebSearchCallCompletedEvent { item_id, output_index, sequence_number, type } Emitted when a web search call is completed.
Emitted when a web search call is completed.
ResponseWebSearchCallInProgressEvent { item_id, output_index, sequence_number, type } Emitted when a web search call is initiated.
Emitted when a web search call is initiated.
ResponseWebSearchCallSearchingEvent { item_id, output_index, sequence_number, type } Emitted when a web search call is executing.
Emitted when a web search call is executing.
ResponseImageGenCallCompletedEvent { item_id, output_index, sequence_number, type } Emitted when an image generation tool call has completed and the final image is available.
Emitted when an image generation tool call has completed and the final image is available.
ResponseImageGenCallGeneratingEvent { item_id, output_index, sequence_number, type } Emitted when an image generation tool call is actively generating an image (intermediate state).
Emitted when an image generation tool call is actively generating an image (intermediate state).
ResponseImageGenCallInProgressEvent { item_id, output_index, sequence_number, type } Emitted when an image generation tool call is in progress.
Emitted when an image generation tool call is in progress.
ResponseImageGenCallPartialImageEvent { item_id, output_index, partial_image_b64, 3 more } Emitted when a partial image is available during image generation streaming.
Emitted when a partial image is available during image generation streaming.
ResponseMcpCallArgumentsDeltaEvent { delta, item_id, output_index, 2 more } Emitted when there is a delta (partial update) to the arguments of an MCP tool call.
Emitted when there is a delta (partial update) to the arguments of an MCP tool call.
ResponseMcpCallArgumentsDoneEvent { arguments, item_id, output_index, 2 more } Emitted when the arguments for an MCP tool call are finalized.
Emitted when the arguments for an MCP tool call are finalized.
ResponseMcpCallCompletedEvent { item_id, output_index, sequence_number, type } Emitted when an MCP tool call has completed successfully.
Emitted when an MCP tool call has completed successfully.
ResponseMcpCallFailedEvent { item_id, output_index, sequence_number, type } Emitted when an MCP tool call has failed.
Emitted when an MCP tool call has failed.
ResponseMcpCallInProgressEvent { item_id, output_index, sequence_number, type } Emitted when an MCP tool call is in progress.
Emitted when an MCP tool call is in progress.
ResponseMcpListToolsCompletedEvent { item_id, output_index, sequence_number, type } Emitted when the list of available MCP tools has been successfully retrieved.
Emitted when the list of available MCP tools has been successfully retrieved.
ResponseMcpListToolsFailedEvent { item_id, output_index, sequence_number, type } Emitted when the attempt to list available MCP tools has failed.
Emitted when the attempt to list available MCP tools has failed.
ResponseMcpListToolsInProgressEvent { item_id, output_index, sequence_number, type } Emitted when the system is in the process of retrieving the list of available MCP tools.
Emitted when the system is in the process of retrieving the list of available MCP tools.
ResponseOutputTextAnnotationAddedEvent { annotation, annotation_index, content_index, 4 more } Emitted when an annotation is added to output text content.
Emitted when an annotation is added to output text content.
ResponseQueuedEvent { response, sequence_number, type } Emitted when a response is queued and waiting to be processed.
Emitted when a response is queued and waiting to be processed.
model: "gpt-5.2" | "gpt-5.2-2025-12-11" | "gpt-5.2-chat-latest" | 83 more | (string & {})
output: Array<OpenAIResponseOutputMessage { id, content, role, 3 more } | OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } | OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } | 15 more>
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItem { id, encrypted_content, type, created_by } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseOutputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseOutputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
ResponseFunctionShellToolCall { id, action, call_id, 4 more } A tool call that executes one or more shell commands in a managed environment.
A tool call that executes one or more shell commands in a managed environment.
action: Action { commands, max_output_length, timeout_ms } The shell commands and limits that describe how to run the tool call.
The shell commands and limits that describe how to run the tool call.
ResponseFunctionShellToolCallOutput { id, call_id, output, 4 more } The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
ResponseApplyPatchToolCall { id, call_id, operation, 3 more } A tool call that applies file diffs by creating, deleting, or updating files.
A tool call that applies file diffs by creating, deleting, or updating files.
operation: OperationCreateFile { diff, path, type } | OperationDeleteFile { path, type } | OperationUpdateFile { diff, path, type } Instruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
ResponseApplyPatchToolCallOutput { id, call_id, status, 3 more } The output emitted by an apply patch tool call.
The output emitted by an apply patch tool call.
OpenAITypesResponsesResponseOutputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAITypesResponsesResponseOutputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
tool_choice: "none" | "auto" | "required" | ToolChoiceAllowed { mode, tools, type } | ToolChoiceTypes { type } | 5 moreConstrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
ToolChoiceAllowed { mode, tools, type } Constrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
ToolChoiceTypes { type } Indicates that the model should use a built-in tool to generate a response.
Learn more about built-in tools.
Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.
ToolChoiceMcp { server_label, type, name } Use this option to force the model to call a specific tool on a remote MCP server.
Use this option to force the model to call a specific tool on a remote MCP server.
tools: Array<FunctionTool { name, type, description, 2 more } | FileSearchTool { type, vector_store_ids, filters, 2 more } | ComputerTool { display_height, display_width, environment, type } | 9 more>
FunctionTool { name, type, description, 2 more } Defines a function in your own code the model can choose to call.
Learn more about function calling.
Defines a function in your own code the model can choose to call.
Learn more about function calling.
FileSearchTool { type, vector_store_ids, filters, 2 more } A tool that searches for relevant content from uploaded files.
Learn more about the file search tool.
A tool that searches for relevant content from uploaded files.
Learn more about the file search tool.
filters?: ComparisonFilter { key, type, value } | CompoundFilter { filters, type } A filter used to compare a specified attribute key to a given value using a defined comparison operation.
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
ComparisonFilter { key, type, value } A filter used to compare a specified attribute key to a given value using a defined comparison operation.
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
CompoundFilter { filters, type } Combine multiple filters using and or or.
Combine multiple filters using and or or.
ranking_options?: RankingOptions { hybrid_search, ranker, score_threshold } Ranking options for search.
Ranking options for search.
ComputerTool { display_height, display_width, environment, type } A tool that controls a virtual computer.
Learn more about the computer tool.
A tool that controls a virtual computer.
Learn more about the computer tool.
WebSearchTool { type, filters, search_context_size, user_location } Search the Internet for sources related to the prompt.
Learn more about the
web search tool.
Search the Internet for sources related to the prompt.
Learn more about the web search tool.
Mcp { server_label, type, allowed_tools, 6 more } Give the model access to additional tools via remote Model Context Protocol
(MCP) servers. Learn more about MCP.
Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
allowed_tools?: Array<string> | McpAllowedToolsMcpToolFilter { read_only, tool_names } A filter object to specify which tools are allowed.
A filter object to specify which tools are allowed.
require_approval?: McpRequireApprovalMcpToolApprovalFilter { always, never } | "always" | "never"Specify which of the MCP server’s tools require approval.
Can be
always, never, or a filter object associated with tools
that require approval.
Specify which of the MCP server’s tools require approval.
Can be
always, never, or a filter object associated with tools
that require approval.
CodeInterpreter { container, type } A tool that runs Python code to help generate a response to a prompt.
A tool that runs Python code to help generate a response to a prompt.
container: string | CodeInterpreterContainerCodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy } Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
CodeInterpreterContainerCodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy } Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
Configuration for a code interpreter container.
Optionally specify the IDs of the files to run the code on.
network_policy?: ContainerNetworkPolicyDisabled { type } | ContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
ImageGeneration { type, action, background, 9 more } A tool that generates images using the GPT image models.
A tool that generates images using the GPT image models.
FunctionShellTool { type, environment } A tool that allows the model to execute shell commands.
A tool that allows the model to execute shell commands.
environment?: ContainerAuto { type, file_ids, memory_limit, 2 more } | LocalEnvironment { type, skills } | ContainerReference { container_id, type }
ContainerAuto { type, file_ids, memory_limit, 2 more }
network_policy?: ContainerNetworkPolicyDisabled { type } | ContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
CustomTool { name, type, description, format } A custom tool that processes input using a specified format.
Learn more about custom tools
A custom tool that processes input using a specified format.
Learn more about custom tools
WebSearchPreviewTool { type, 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.
This tool searches the web for relevant results to use in a response.
Learn more about the web search tool.
The conversation that this response belonged to.
Input items and output items from this response were automatically added to this conversation.
The conversation that this response belonged to.
Input items and output items from this response were automatically added to this conversation.
An error object returned when the model fails to generate a Response.
An error object returned when the model fails to generate a Response.
instructions?: string | Array<EasyInputMessage { content, role, phase, type } | OpenAITypesResponsesResponseInputItemMessage { content, role, status, type } | OpenAIResponseOutputMessage { id, content, role, 3 more } | 23 more>
Array<EasyInputMessage { content, role, phase, type } | OpenAITypesResponsesResponseInputItemMessage { content, role, status, type } | OpenAIResponseOutputMessage { id, content, role, 3 more } | 23 more>
EasyInputMessage { 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.
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.
content: string | Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAITypesResponsesResponseInputItemMessage { content, role, status, 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.
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.
content: Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
OpenAIResponseOutputMessage { id, content, role, 3 more } An output message from the model.
An output message from the model.
content: Array<OpenAIResponseOutputText { annotations, text, type, logprobs } | OpenAIResponseOutputRefusal { refusal, type } >
OpenAIResponseOutputText { annotations, text, type, logprobs } A text output from the model.
A text output from the model.
annotations: Array<AnnotationFileCitation { file_id, filename, index, type } | OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } | AnnotationContainerFileCitation { container_id, end_index, file_id, 3 more } | AnnotationFilePath { file_id, index, type } >
OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index, start_index, title, 2 more } A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
OpenAIResponseFileSearchToolCall { id, queries, status, 2 more } The results of a file search tool call.
See the
file search guide for more information.
The results of a file search tool call.
See the file search guide for more information.
OpenAIResponseComputerToolCall { id, action, call_id, 3 more } A tool call to a computer use tool.
See the
computer use guide for more information.
A tool call to a computer use tool.
See the computer use guide for more information.
action: ActionClick { button, type, x, y } | ActionDoubleClick { type, x, y } | ActionDrag { path, type } | 6 moreA click action.
A click action.
OpenAITypesResponsesResponseInputItemComputerCallOutput { call_id, output, type, 3 more } The output of a computer tool call.
The output of a computer tool call.
OpenAIResponseFunctionWebSearch { id, action, status, type } The results of a web search tool call.
See the
web search guide for more information.
The results of a web search tool call.
See the web search guide for more information.
action: OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query, type, queries, sources } | OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type, url } | ActionFind { pattern, type, url } Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
OpenAIResponseFunctionToolCall { arguments, call_id, name, 3 more } A tool call to run a function.
See the
function calling guide for more information.
A tool call to run a function.
See the function calling guide for more information.
OpenAITypesResponsesResponseInputItemFunctionCallOutput { call_id, output, type, 2 more } The output of a function tool call.
The output of a function tool call.
output: string | Array<ResponseInputTextContent { text, type } | ResponseInputImageContent { type, detail, file_id, image_url } | ResponseInputFileContent { type, file_data, file_id, 2 more } >
Array<ResponseInputTextContent { text, type } | ResponseInputImageContent { type, detail, file_id, image_url } | ResponseInputFileContent { type, file_data, file_id, 2 more } >
ResponseInputImageContent { type, detail, file_id, image_url } An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
OpenAIResponseReasoningItem { id, summary, type, 3 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.
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.
ResponseCompactionItemParam { encrypted_content, type, id } A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
OpenAITypesResponsesResponseInputItemImageGenerationCall { id, status, type, result } An image generation request made by the model.
An image generation request made by the model.
OpenAIResponseCodeInterpreterToolCall { id, container_id, status, 3 more } A tool call to run code.
A tool call to run code.
OpenAITypesResponsesResponseInputItemLocalShellCall { id, action, call_id, 2 more } A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
OpenAITypesResponsesResponseInputItemLocalShellCallOutput { id, output, type, status } The output of a local shell tool call.
The output of a local shell tool call.
ShellCall { action, call_id, type, 3 more } A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
ShellCallOutput { call_id, output, type, 3 more } The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
ApplyPatchCall { call_id, operation, status, 2 more } A tool call representing a request to create, delete, or update files using diff patches.
A tool call representing a request to create, delete, or update files using diff patches.
operation: ApplyPatchCallOperationCreateFile { diff, path, type } | ApplyPatchCallOperationDeleteFile { path, type } | ApplyPatchCallOperationUpdateFile { diff, path, type } Instruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
ApplyPatchCallOutput { call_id, status, type, 2 more } The streamed output emitted by an apply patch tool call.
The streamed output emitted by an apply patch tool call.
OpenAITypesResponsesResponseInputItemMcpListTools { id, server_label, tools, 2 more } A list of tools available on an MCP server.
A list of tools available on an MCP server.
McpApprovalRequest { id, arguments, name, 2 more } A request for human approval of a tool invocation.
A request for human approval of a tool invocation.
OpenAITypesResponsesResponseInputItemMcpApprovalResponse { approval_request_id, approve, type, 2 more } A response to an MCP approval request.
A response to an MCP approval request.
OpenAITypesResponsesResponseInputItemMcpCall { id, arguments, name, 6 more } An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
OpenAIResponseCustomToolCallOutput { call_id, output, type, id } The output of a custom tool call from your code, being sent back to the model.
The output of a custom tool call from your code, being sent back to the model.
output: string | Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
Array<OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
variables?: Record<string, string | OpenAIResponseInputText { text, type } | OpenAIResponseInputImage { detail, type, file_id, image_url } | OpenAIResponseInputFile { type, file_data, file_id, 2 more } >
OpenAIResponseInputImage { detail, type, file_id, image_url } An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
gpt-5 and o-series models only
Configuration options for
reasoning models.
gpt-5 and o-series models only
Configuration options for reasoning models.
Configuration options for a text response from the model.
Can be plain
text or structured JSON data. Learn more:
Configuration options for a text response from the model.
Can be plain text or structured JSON data. Learn more:
format?: ResponseFormatText { type } | ResponseFormatTextJsonSchemaConfig { name, schema, type, 2 more } | ResponseFormatJsonObject { type } Default response format. Used to generate text responses.
Default response format. Used to generate text responses.
ResponseFormatTextJsonSchemaConfig { name, schema, type, 2 more } JSON Schema response format.
Used to generate structured JSON responses.
Learn more about Structured Outputs.
JSON Schema response format.
Used to generate structured JSON responses. Learn more about Structured Outputs.
Represents token usage details including input tokens, output tokens,
a breakdown of output tokens, and the total tokens used.
Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used.
ResponseCustomToolCallInputDeltaEvent { delta, item_id, output_index, 2 more } Event representing a delta (partial update) to the input of a custom tool call.
Event representing a delta (partial update) to the input of a custom tool call.
Run OpenAI Responses API (OpenAI only)
import SGPClient from 'scale-gp';
const client = new SGPClient({
accountID: 'My Account ID',
apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});
const response = await client.responses.create({ input: 'string', model: 'model' });
console.log(response);{
"id": "id",
"created_at": 0,
"model": "gpt-5.2",
"object": "response",
"output": [
{
"id": "id",
"content": [
{
"annotations": [
{
"file_id": "file_id",
"filename": "filename",
"index": 0,
"type": "file_citation"
}
],
"text": "text",
"type": "output_text",
"logprobs": [
{
"token": "token",
"bytes": [
0
],
"logprob": 0,
"top_logprobs": [
{
"token": "token",
"bytes": [
0
],
"logprob": 0
}
]
}
]
}
],
"role": "assistant",
"status": "in_progress",
"type": "message",
"phase": "commentary"
}
],
"parallel_tool_calls": true,
"tool_choice": "none",
"tools": [
{
"name": "name",
"type": "function",
"description": "description",
"parameters": {
"foo": "bar"
},
"strict": true
}
],
"background": true,
"completed_at": 0,
"conversation": {
"id": "id"
},
"error": {
"code": "server_error",
"message": "message"
},
"incomplete_details": {
"reason": "max_output_tokens"
},
"instructions": "string",
"max_output_tokens": 0,
"max_tool_calls": 0,
"metadata": {
"foo": "string"
},
"previous_response_id": "previous_response_id",
"prompt": {
"id": "id",
"variables": {
"foo": "string"
},
"version": "version"
},
"prompt_cache_key": "prompt_cache_key",
"prompt_cache_retention": "in-memory",
"reasoning": {
"effort": "none",
"generate_summary": "auto",
"summary": "auto"
},
"safety_identifier": "safety_identifier",
"service_tier": "auto",
"status": "completed",
"temperature": 0,
"text": {
"format": {
"type": "text"
},
"verbosity": "low"
},
"top_logprobs": 0,
"top_p": 0,
"truncation": "auto",
"usage": {
"input_tokens": 0,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 0,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 0
},
"user": "user"
}Returns Examples
{
"id": "id",
"created_at": 0,
"model": "gpt-5.2",
"object": "response",
"output": [
{
"id": "id",
"content": [
{
"annotations": [
{
"file_id": "file_id",
"filename": "filename",
"index": 0,
"type": "file_citation"
}
],
"text": "text",
"type": "output_text",
"logprobs": [
{
"token": "token",
"bytes": [
0
],
"logprob": 0,
"top_logprobs": [
{
"token": "token",
"bytes": [
0
],
"logprob": 0
}
]
}
]
}
],
"role": "assistant",
"status": "in_progress",
"type": "message",
"phase": "commentary"
}
],
"parallel_tool_calls": true,
"tool_choice": "none",
"tools": [
{
"name": "name",
"type": "function",
"description": "description",
"parameters": {
"foo": "bar"
},
"strict": true
}
],
"background": true,
"completed_at": 0,
"conversation": {
"id": "id"
},
"error": {
"code": "server_error",
"message": "message"
},
"incomplete_details": {
"reason": "max_output_tokens"
},
"instructions": "string",
"max_output_tokens": 0,
"max_tool_calls": 0,
"metadata": {
"foo": "string"
},
"previous_response_id": "previous_response_id",
"prompt": {
"id": "id",
"variables": {
"foo": "string"
},
"version": "version"
},
"prompt_cache_key": "prompt_cache_key",
"prompt_cache_retention": "in-memory",
"reasoning": {
"effort": "none",
"generate_summary": "auto",
"summary": "auto"
},
"safety_identifier": "safety_identifier",
"service_tier": "auto",
"status": "completed",
"temperature": 0,
"text": {
"format": {
"type": "text"
},
"verbosity": "low"
},
"top_logprobs": 0,
"top_p": 0,
"truncation": "auto",
"usage": {
"input_tokens": 0,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 0,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 0
},
"user": "user"
}