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
input: Union[str, Iterable[InputInputItem]]
Iterable[InputInputItem]
class InputInputItemEasyInputMessageParam: …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: Union[str, Iterable[InputInputItemEasyInputMessageParamContentInputItem]]
Iterable[InputInputItemEasyInputMessageParamContentInputItem]
class OpenAIResponseInputImageParam: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class InputInputItemOpenAITypesResponsesResponseInputParamMessage: …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: Iterable[InputInputItemOpenAITypesResponsesResponseInputParamMessageContent]
class OpenAIResponseInputImageParam: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class InputInputItemResponseOutputMessageParam: …An output message from the model.
An output message from the model.
content: Iterable[InputInputItemResponseOutputMessageParamContent]
class InputInputItemResponseOutputMessageParamContentResponseOutputTextParam: …A text output from the model.
A text output from the model.
annotations: Iterable[InputInputItemResponseOutputMessageParamContentResponseOutputTextParamAnnotation]
class InputInputItemResponseOutputMessageParamContentResponseOutputTextParamAnnotationAnnotationFileCitation: …A citation to a file.
A citation to a file.
class InputInputItemResponseOutputMessageParamContentResponseOutputTextParamAnnotationOpenAITypesResponsesResponseOutputTextParamAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class InputInputItemResponseFileSearchToolCallParam: …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.
class InputInputItemResponseComputerToolCallParam: …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: InputInputItemResponseComputerToolCallParamActionA click action.
A click action.
class InputInputItemResponseComputerToolCallParamActionActionKeypress: …A collection of keypresses the model would like to perform.
A collection of keypresses the model would like to perform.
class InputInputItemOpenAITypesResponsesResponseInputParamComputerCallOutput: …The output of a computer tool call.
The output of a computer tool call.
class InputInputItemResponseFunctionWebSearchParam: …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: InputInputItemResponseFunctionWebSearchParamActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class InputInputItemResponseFunctionWebSearchParamActionOpenAITypesResponsesResponseFunctionWebSearchParamActionSearch: …Action type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class InputInputItemResponseFunctionToolCallParam: …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.
class InputInputItemOpenAITypesResponsesResponseInputParamFunctionCallOutput: …The output of a function tool call.
The output of a function tool call.
output: Union[str, Iterable[InputInputItemOpenAITypesResponsesResponseInputParamFunctionCallOutputOutputOutputContentList]]
Iterable[InputInputItemOpenAITypesResponsesResponseInputParamFunctionCallOutputOutputOutputContentList]
class InputInputItemOpenAITypesResponsesResponseInputParamFunctionCallOutputOutputOutputContentListResponseInputTextContentParam: …A text input to the model.
A text input to the model.
class InputInputItemOpenAITypesResponsesResponseInputParamFunctionCallOutputOutputOutputContentListResponseInputImageContentParam: …An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
class InputInputItemResponseReasoningItemParam: …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.
class InputInputItemResponseCompactionItemParamParam: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class InputInputItemOpenAITypesResponsesResponseInputParamImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class InputInputItemResponseCodeInterpreterToolCallParam: …A tool call to run code.
A tool call to run code.
class InputInputItemOpenAITypesResponsesResponseInputParamLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class InputInputItemOpenAITypesResponsesResponseInputParamLocalShellCallOutput: …The output of a local shell tool call.
The output of a local shell tool call.
class InputInputItemOpenAITypesResponsesResponseInputParamShellCall: …A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
class InputInputItemOpenAITypesResponsesResponseInputParamShellCallOutput: …The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
output: Iterable[InputInputItemOpenAITypesResponsesResponseInputParamShellCallOutputOutput]
outcome: InputInputItemOpenAITypesResponsesResponseInputParamShellCallOutputOutputOutcomeIndicates that the shell call exceeded its configured time limit.
Indicates that the shell call exceeded its configured time limit.
class InputInputItemOpenAITypesResponsesResponseInputParamApplyPatchCall: …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: InputInputItemOpenAITypesResponsesResponseInputParamApplyPatchCallOperationInstruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
class InputInputItemOpenAITypesResponsesResponseInputParamApplyPatchCallOperationApplyPatchCallOperationCreateFile: …Instruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
class InputInputItemOpenAITypesResponsesResponseInputParamApplyPatchCallOutput: …The streamed output emitted by an apply patch tool call.
The streamed output emitted by an apply patch tool call.
class InputInputItemOpenAITypesResponsesResponseInputParamMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
class InputInputItemOpenAITypesResponsesResponseInputParamMcpApprovalResponse: …A response to an MCP approval request.
A response to an MCP approval request.
class InputInputItemOpenAITypesResponsesResponseInputParamMcpCall: …An invocation of a tool on an MCP server.
An invocation of a tool on an MCP server.
class InputInputItemResponseCustomToolCallOutputParam: …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: Union[str, Iterable[InputInputItemResponseCustomToolCallOutputParamOutputOutputContentList]]
Iterable[InputInputItemResponseCustomToolCallOutputParamOutputOutputContentList]
class OpenAIResponseInputImageParam: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
ReturnsExpand Collapse
Emitted when there is a partial audio response.
Emitted when there is a partial audio response.
class OpenAIResponse: …
model: Union[Literal["gpt-5.2", "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", 83 more], str]
output: List[Output]
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseFunctionToolCall: …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.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItem: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseOutputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseOutputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class ResponseFunctionShellToolCall: …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.
class ResponseFunctionShellToolCallOutput: …The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
class ResponseApplyPatchToolCall: …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: OperationInstruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
class OpenAITypesResponsesResponseOutputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
tool_choice: ToolChoiceConstrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
class ToolChoiceTypes: …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.
class ToolChoiceMcp: …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: List[Tool]
class FunctionTool: …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.
class FileSearchTool: …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: Optional[Filters]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.
class FiltersComparisonFilter: …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.
ranking_options: Optional[RankingOptions]Ranking options for search.
Ranking options for search.
class ComputerTool: …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.
class WebSearchTool: …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.
class ToolMcp: …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.
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]
require_approval: Optional[ToolMcpRequireApproval]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.
class ToolMcpRequireApprovalMcpRequireApprovalMcpToolApprovalFilter: …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.
class ToolCodeInterpreter: …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: ToolCodeInterpreterContainerConfiguration 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.
class ToolCodeInterpreterContainerCodeInterpreterContainerCodeInterpreterToolAuto: …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.
class ToolImageGeneration: …A tool that generates images using the GPT image models.
A tool that generates images using the GPT image models.
input_image_mask: Optional[ToolImageGenerationInputImageMask]Optional mask for inpainting.
Contains image_url
(string, optional) and file_id (string, optional).
Optional mask for inpainting.
Contains image_url
(string, optional) and file_id (string, optional).
class ToolLocalShell: …A tool that allows the model to execute shell commands in a local environment.
A tool that allows the model to execute shell commands in a local environment.
class FunctionShellTool: …A tool that allows the model to execute shell commands.
A tool that allows the model to execute shell commands.
environment: Optional[Environment]
class CustomTool: …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
class WebSearchPreviewTool: …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.
conversation: Optional[Conversation]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.
error: Optional[OpenAIResponseError]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: Optional[Union[str, List[InstructionsInputItem], null]]
List[InstructionsInputItem]
class EasyInputMessage: …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: Union[str, List[ContentInputItem]]
List[ContentInputItem]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class OpenAITypesResponsesResponseInputItemMessage: …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: List[Content]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAITypesResponsesResponseInputItemComputerCallOutput: …The output of a computer tool call.
The output of a computer tool call.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseFunctionToolCall: …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.
class OpenAITypesResponsesResponseInputItemFunctionCallOutput: …The output of a function tool call.
The output of a function tool call.
output: Union[str, List[OutputOutputContentList]]
List[OutputOutputContentList]
class OutputOutputContentListResponseInputImageContent: …An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItemParam: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseInputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseInputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class OpenAITypesResponsesResponseInputItemLocalShellCallOutput: …The output of a local shell tool call.
The output of a local shell tool call.
class ShellCall: …A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
class ShellCallOutput: …The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
class ApplyPatchCall: …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: OperationInstruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
class OpenAITypesResponsesResponseInputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
class OpenAITypesResponsesResponseInputItemMcpApprovalResponse: …A response to an MCP approval request.
A response to an MCP approval request.
class OpenAIResponseCustomToolCallOutput: …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: Union[str, List[OutputOutputContentList]]
List[OutputOutputContentList]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
prompt: Optional[OpenAIResponsePrompt]Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
variables: Optional[Dict[str, Variables]]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
reasoning: Optional[Reasoning]gpt-5 and o-series models only
Configuration options for
reasoning models.
gpt-5 and o-series models only
Configuration options for reasoning models.
text: Optional[OpenAIResponseTextConfig]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: Optional[Format]Default response format. Used to generate text responses.
Default response format. Used to generate text responses.
class FormatResponseFormatTextJsonSchemaConfig: …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.
class ResponseCodeInterpreterCallCodeDeltaEvent: …Emitted when a partial code snippet is streamed by the code interpreter.
Emitted when a partial code snippet is streamed by the code interpreter.
class ResponseCodeInterpreterCallCodeDoneEvent: …Emitted when the code snippet is finalized by the code interpreter.
Emitted when the code snippet is finalized by the code interpreter.
class ResponseCodeInterpreterCallCompletedEvent: …Emitted when the code interpreter call is completed.
Emitted when the code interpreter call is completed.
class ResponseCodeInterpreterCallInProgressEvent: …Emitted when a code interpreter call is in progress.
Emitted when a code interpreter call is in progress.
class ResponseCodeInterpreterCallInterpretingEvent: …Emitted when the code interpreter is actively interpreting the code snippet.
Emitted when the code interpreter is actively interpreting the code snippet.
class ResponseCompletedEvent: …Emitted when the model response is complete.
Emitted when the model response is complete.
model: Union[Literal["gpt-5.2", "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", 83 more], str]
output: List[Output]
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseFunctionToolCall: …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.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItem: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseOutputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseOutputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class ResponseFunctionShellToolCall: …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.
class ResponseFunctionShellToolCallOutput: …The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
class ResponseApplyPatchToolCall: …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: OperationInstruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
class OpenAITypesResponsesResponseOutputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
tool_choice: ToolChoiceConstrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
class ToolChoiceTypes: …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.
class ToolChoiceMcp: …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: List[Tool]
class FunctionTool: …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.
class FileSearchTool: …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: Optional[Filters]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.
class FiltersComparisonFilter: …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.
ranking_options: Optional[RankingOptions]Ranking options for search.
Ranking options for search.
class ComputerTool: …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.
class WebSearchTool: …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.
class ToolMcp: …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.
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]
require_approval: Optional[ToolMcpRequireApproval]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.
class ToolMcpRequireApprovalMcpRequireApprovalMcpToolApprovalFilter: …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.
class ToolCodeInterpreter: …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: ToolCodeInterpreterContainerConfiguration 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.
class ToolCodeInterpreterContainerCodeInterpreterContainerCodeInterpreterToolAuto: …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.
class ToolImageGeneration: …A tool that generates images using the GPT image models.
A tool that generates images using the GPT image models.
input_image_mask: Optional[ToolImageGenerationInputImageMask]Optional mask for inpainting.
Contains image_url
(string, optional) and file_id (string, optional).
Optional mask for inpainting.
Contains image_url
(string, optional) and file_id (string, optional).
class ToolLocalShell: …A tool that allows the model to execute shell commands in a local environment.
A tool that allows the model to execute shell commands in a local environment.
class FunctionShellTool: …A tool that allows the model to execute shell commands.
A tool that allows the model to execute shell commands.
environment: Optional[Environment]
class CustomTool: …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
class WebSearchPreviewTool: …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.
conversation: Optional[Conversation]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.
error: Optional[OpenAIResponseError]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: Optional[Union[str, List[InstructionsInputItem], null]]
List[InstructionsInputItem]
class EasyInputMessage: …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: Union[str, List[ContentInputItem]]
List[ContentInputItem]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class OpenAITypesResponsesResponseInputItemMessage: …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: List[Content]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAITypesResponsesResponseInputItemComputerCallOutput: …The output of a computer tool call.
The output of a computer tool call.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseFunctionToolCall: …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.
class OpenAITypesResponsesResponseInputItemFunctionCallOutput: …The output of a function tool call.
The output of a function tool call.
output: Union[str, List[OutputOutputContentList]]
List[OutputOutputContentList]
class OutputOutputContentListResponseInputImageContent: …An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItemParam: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseInputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseInputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class OpenAITypesResponsesResponseInputItemLocalShellCallOutput: …The output of a local shell tool call.
The output of a local shell tool call.
class ShellCall: …A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
class ShellCallOutput: …The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
class ApplyPatchCall: …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: OperationInstruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
class OpenAITypesResponsesResponseInputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
class OpenAITypesResponsesResponseInputItemMcpApprovalResponse: …A response to an MCP approval request.
A response to an MCP approval request.
class OpenAIResponseCustomToolCallOutput: …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: Union[str, List[OutputOutputContentList]]
List[OutputOutputContentList]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
prompt: Optional[OpenAIResponsePrompt]Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
variables: Optional[Dict[str, Variables]]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
reasoning: Optional[Reasoning]gpt-5 and o-series models only
Configuration options for
reasoning models.
gpt-5 and o-series models only
Configuration options for reasoning models.
text: Optional[OpenAIResponseTextConfig]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: Optional[Format]Default response format. Used to generate text responses.
Default response format. Used to generate text responses.
class FormatResponseFormatTextJsonSchemaConfig: …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.
class ResponseContentPartAddedEvent: …Emitted when a new content part is added.
Emitted when a new content part is added.
part: ResponseContentPartAddedEventPartA text output from the model.
A text output from the model.
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class ResponseContentPartDoneEvent: …Emitted when a content part is done.
Emitted when a content part is done.
part: ResponseContentPartDoneEventPartA text output from the model.
A text output from the model.
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class ResponseCreatedEvent: …An event that is emitted when a response is created.
An event that is emitted when a response is created.
model: Union[Literal["gpt-5.2", "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", 83 more], str]
output: List[Output]
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseFunctionToolCall: …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.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItem: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseOutputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseOutputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class ResponseFunctionShellToolCall: …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.
class ResponseFunctionShellToolCallOutput: …The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
class ResponseApplyPatchToolCall: …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: OperationInstruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
class OpenAITypesResponsesResponseOutputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
tool_choice: ToolChoiceConstrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
class ToolChoiceTypes: …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.
class ToolChoiceMcp: …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: List[Tool]
class FunctionTool: …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.
class FileSearchTool: …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: Optional[Filters]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.
class FiltersComparisonFilter: …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.
ranking_options: Optional[RankingOptions]Ranking options for search.
Ranking options for search.
class ComputerTool: …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.
class WebSearchTool: …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.
class ToolMcp: …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.
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]
require_approval: Optional[ToolMcpRequireApproval]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.
class ToolMcpRequireApprovalMcpRequireApprovalMcpToolApprovalFilter: …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.
class ToolCodeInterpreter: …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: ToolCodeInterpreterContainerConfiguration 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.
class ToolCodeInterpreterContainerCodeInterpreterContainerCodeInterpreterToolAuto: …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.
class ToolImageGeneration: …A tool that generates images using the GPT image models.
A tool that generates images using the GPT image models.
input_image_mask: Optional[ToolImageGenerationInputImageMask]Optional mask for inpainting.
Contains image_url
(string, optional) and file_id (string, optional).
Optional mask for inpainting.
Contains image_url
(string, optional) and file_id (string, optional).
class ToolLocalShell: …A tool that allows the model to execute shell commands in a local environment.
A tool that allows the model to execute shell commands in a local environment.
class FunctionShellTool: …A tool that allows the model to execute shell commands.
A tool that allows the model to execute shell commands.
environment: Optional[Environment]
class CustomTool: …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
class WebSearchPreviewTool: …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.
conversation: Optional[Conversation]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.
error: Optional[OpenAIResponseError]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: Optional[Union[str, List[InstructionsInputItem], null]]
List[InstructionsInputItem]
class EasyInputMessage: …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: Union[str, List[ContentInputItem]]
List[ContentInputItem]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class OpenAITypesResponsesResponseInputItemMessage: …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: List[Content]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAITypesResponsesResponseInputItemComputerCallOutput: …The output of a computer tool call.
The output of a computer tool call.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseFunctionToolCall: …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.
class OpenAITypesResponsesResponseInputItemFunctionCallOutput: …The output of a function tool call.
The output of a function tool call.
output: Union[str, List[OutputOutputContentList]]
List[OutputOutputContentList]
class OutputOutputContentListResponseInputImageContent: …An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItemParam: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseInputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseInputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class OpenAITypesResponsesResponseInputItemLocalShellCallOutput: …The output of a local shell tool call.
The output of a local shell tool call.
class ShellCall: …A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
class ShellCallOutput: …The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
class ApplyPatchCall: …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: OperationInstruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
class OpenAITypesResponsesResponseInputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
class OpenAITypesResponsesResponseInputItemMcpApprovalResponse: …A response to an MCP approval request.
A response to an MCP approval request.
class OpenAIResponseCustomToolCallOutput: …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: Union[str, List[OutputOutputContentList]]
List[OutputOutputContentList]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
prompt: Optional[OpenAIResponsePrompt]Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
variables: Optional[Dict[str, Variables]]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
reasoning: Optional[Reasoning]gpt-5 and o-series models only
Configuration options for
reasoning models.
gpt-5 and o-series models only
Configuration options for reasoning models.
text: Optional[OpenAIResponseTextConfig]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: Optional[Format]Default response format. Used to generate text responses.
Default response format. Used to generate text responses.
class FormatResponseFormatTextJsonSchemaConfig: …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.
class ResponseFileSearchCallCompletedEvent: …Emitted when a file search call is completed (results found).
Emitted when a file search call is completed (results found).
class ResponseFunctionCallArgumentsDeltaEvent: …Emitted when there is a partial function-call arguments delta.
Emitted when there is a partial function-call arguments delta.
class ResponseInProgressEvent: …Emitted when the response is in progress.
Emitted when the response is in progress.
model: Union[Literal["gpt-5.2", "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", 83 more], str]
output: List[Output]
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseFunctionToolCall: …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.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItem: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseOutputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseOutputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class ResponseFunctionShellToolCall: …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.
class ResponseFunctionShellToolCallOutput: …The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
class ResponseApplyPatchToolCall: …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: OperationInstruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
class OpenAITypesResponsesResponseOutputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
tool_choice: ToolChoiceConstrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
class ToolChoiceTypes: …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.
class ToolChoiceMcp: …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: List[Tool]
class FunctionTool: …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.
class FileSearchTool: …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: Optional[Filters]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.
class FiltersComparisonFilter: …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.
ranking_options: Optional[RankingOptions]Ranking options for search.
Ranking options for search.
class ComputerTool: …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.
class WebSearchTool: …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.
class ToolMcp: …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.
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]
require_approval: Optional[ToolMcpRequireApproval]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.
class ToolMcpRequireApprovalMcpRequireApprovalMcpToolApprovalFilter: …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.
class ToolCodeInterpreter: …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: ToolCodeInterpreterContainerConfiguration 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.
class ToolCodeInterpreterContainerCodeInterpreterContainerCodeInterpreterToolAuto: …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.
class ToolImageGeneration: …A tool that generates images using the GPT image models.
A tool that generates images using the GPT image models.
input_image_mask: Optional[ToolImageGenerationInputImageMask]Optional mask for inpainting.
Contains image_url
(string, optional) and file_id (string, optional).
Optional mask for inpainting.
Contains image_url
(string, optional) and file_id (string, optional).
class ToolLocalShell: …A tool that allows the model to execute shell commands in a local environment.
A tool that allows the model to execute shell commands in a local environment.
class FunctionShellTool: …A tool that allows the model to execute shell commands.
A tool that allows the model to execute shell commands.
environment: Optional[Environment]
class CustomTool: …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
class WebSearchPreviewTool: …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.
conversation: Optional[Conversation]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.
error: Optional[OpenAIResponseError]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: Optional[Union[str, List[InstructionsInputItem], null]]
List[InstructionsInputItem]
class EasyInputMessage: …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: Union[str, List[ContentInputItem]]
List[ContentInputItem]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class OpenAITypesResponsesResponseInputItemMessage: …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: List[Content]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAITypesResponsesResponseInputItemComputerCallOutput: …The output of a computer tool call.
The output of a computer tool call.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseFunctionToolCall: …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.
class OpenAITypesResponsesResponseInputItemFunctionCallOutput: …The output of a function tool call.
The output of a function tool call.
output: Union[str, List[OutputOutputContentList]]
List[OutputOutputContentList]
class OutputOutputContentListResponseInputImageContent: …An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItemParam: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseInputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseInputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class OpenAITypesResponsesResponseInputItemLocalShellCallOutput: …The output of a local shell tool call.
The output of a local shell tool call.
class ShellCall: …A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
class ShellCallOutput: …The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
class ApplyPatchCall: …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: OperationInstruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
class OpenAITypesResponsesResponseInputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
class OpenAITypesResponsesResponseInputItemMcpApprovalResponse: …A response to an MCP approval request.
A response to an MCP approval request.
class OpenAIResponseCustomToolCallOutput: …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: Union[str, List[OutputOutputContentList]]
List[OutputOutputContentList]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
prompt: Optional[OpenAIResponsePrompt]Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
variables: Optional[Dict[str, Variables]]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
reasoning: Optional[Reasoning]gpt-5 and o-series models only
Configuration options for
reasoning models.
gpt-5 and o-series models only
Configuration options for reasoning models.
text: Optional[OpenAIResponseTextConfig]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: Optional[Format]Default response format. Used to generate text responses.
Default response format. Used to generate text responses.
class FormatResponseFormatTextJsonSchemaConfig: …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.
class ResponseFailedEvent: …An event that is emitted when a response fails.
An event that is emitted when a response fails.
model: Union[Literal["gpt-5.2", "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", 83 more], str]
output: List[Output]
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseFunctionToolCall: …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.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItem: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseOutputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseOutputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class ResponseFunctionShellToolCall: …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.
class ResponseFunctionShellToolCallOutput: …The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
class ResponseApplyPatchToolCall: …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: OperationInstruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
class OpenAITypesResponsesResponseOutputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
tool_choice: ToolChoiceConstrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
class ToolChoiceTypes: …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.
class ToolChoiceMcp: …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: List[Tool]
class FunctionTool: …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.
class FileSearchTool: …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: Optional[Filters]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.
class FiltersComparisonFilter: …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.
ranking_options: Optional[RankingOptions]Ranking options for search.
Ranking options for search.
class ComputerTool: …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.
class WebSearchTool: …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.
class ToolMcp: …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.
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]
require_approval: Optional[ToolMcpRequireApproval]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.
class ToolMcpRequireApprovalMcpRequireApprovalMcpToolApprovalFilter: …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.
class ToolCodeInterpreter: …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: ToolCodeInterpreterContainerConfiguration 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.
class ToolCodeInterpreterContainerCodeInterpreterContainerCodeInterpreterToolAuto: …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.
class ToolImageGeneration: …A tool that generates images using the GPT image models.
A tool that generates images using the GPT image models.
input_image_mask: Optional[ToolImageGenerationInputImageMask]Optional mask for inpainting.
Contains image_url
(string, optional) and file_id (string, optional).
Optional mask for inpainting.
Contains image_url
(string, optional) and file_id (string, optional).
class ToolLocalShell: …A tool that allows the model to execute shell commands in a local environment.
A tool that allows the model to execute shell commands in a local environment.
class FunctionShellTool: …A tool that allows the model to execute shell commands.
A tool that allows the model to execute shell commands.
environment: Optional[Environment]
class CustomTool: …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
class WebSearchPreviewTool: …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.
conversation: Optional[Conversation]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.
error: Optional[OpenAIResponseError]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: Optional[Union[str, List[InstructionsInputItem], null]]
List[InstructionsInputItem]
class EasyInputMessage: …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: Union[str, List[ContentInputItem]]
List[ContentInputItem]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class OpenAITypesResponsesResponseInputItemMessage: …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: List[Content]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAITypesResponsesResponseInputItemComputerCallOutput: …The output of a computer tool call.
The output of a computer tool call.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseFunctionToolCall: …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.
class OpenAITypesResponsesResponseInputItemFunctionCallOutput: …The output of a function tool call.
The output of a function tool call.
output: Union[str, List[OutputOutputContentList]]
List[OutputOutputContentList]
class OutputOutputContentListResponseInputImageContent: …An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItemParam: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseInputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseInputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class OpenAITypesResponsesResponseInputItemLocalShellCallOutput: …The output of a local shell tool call.
The output of a local shell tool call.
class ShellCall: …A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
class ShellCallOutput: …The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
class ApplyPatchCall: …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: OperationInstruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
class OpenAITypesResponsesResponseInputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
class OpenAITypesResponsesResponseInputItemMcpApprovalResponse: …A response to an MCP approval request.
A response to an MCP approval request.
class OpenAIResponseCustomToolCallOutput: …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: Union[str, List[OutputOutputContentList]]
List[OutputOutputContentList]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
prompt: Optional[OpenAIResponsePrompt]Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
variables: Optional[Dict[str, Variables]]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
reasoning: Optional[Reasoning]gpt-5 and o-series models only
Configuration options for
reasoning models.
gpt-5 and o-series models only
Configuration options for reasoning models.
text: Optional[OpenAIResponseTextConfig]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: Optional[Format]Default response format. Used to generate text responses.
Default response format. Used to generate text responses.
class FormatResponseFormatTextJsonSchemaConfig: …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.
class ResponseIncompleteEvent: …An event that is emitted when a response finishes as incomplete.
An event that is emitted when a response finishes as incomplete.
model: Union[Literal["gpt-5.2", "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", 83 more], str]
output: List[Output]
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseFunctionToolCall: …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.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItem: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseOutputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseOutputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class ResponseFunctionShellToolCall: …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.
class ResponseFunctionShellToolCallOutput: …The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
class ResponseApplyPatchToolCall: …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: OperationInstruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
class OpenAITypesResponsesResponseOutputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
tool_choice: ToolChoiceConstrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
class ToolChoiceTypes: …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.
class ToolChoiceMcp: …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: List[Tool]
class FunctionTool: …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.
class FileSearchTool: …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: Optional[Filters]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.
class FiltersComparisonFilter: …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.
ranking_options: Optional[RankingOptions]Ranking options for search.
Ranking options for search.
class ComputerTool: …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.
class WebSearchTool: …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.
class ToolMcp: …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.
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]
require_approval: Optional[ToolMcpRequireApproval]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.
class ToolMcpRequireApprovalMcpRequireApprovalMcpToolApprovalFilter: …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.
class ToolCodeInterpreter: …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: ToolCodeInterpreterContainerConfiguration 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.
class ToolCodeInterpreterContainerCodeInterpreterContainerCodeInterpreterToolAuto: …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.
class ToolImageGeneration: …A tool that generates images using the GPT image models.
A tool that generates images using the GPT image models.
input_image_mask: Optional[ToolImageGenerationInputImageMask]Optional mask for inpainting.
Contains image_url
(string, optional) and file_id (string, optional).
Optional mask for inpainting.
Contains image_url
(string, optional) and file_id (string, optional).
class ToolLocalShell: …A tool that allows the model to execute shell commands in a local environment.
A tool that allows the model to execute shell commands in a local environment.
class FunctionShellTool: …A tool that allows the model to execute shell commands.
A tool that allows the model to execute shell commands.
environment: Optional[Environment]
class CustomTool: …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
class WebSearchPreviewTool: …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.
conversation: Optional[Conversation]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.
error: Optional[OpenAIResponseError]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: Optional[Union[str, List[InstructionsInputItem], null]]
List[InstructionsInputItem]
class EasyInputMessage: …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: Union[str, List[ContentInputItem]]
List[ContentInputItem]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class OpenAITypesResponsesResponseInputItemMessage: …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: List[Content]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAITypesResponsesResponseInputItemComputerCallOutput: …The output of a computer tool call.
The output of a computer tool call.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseFunctionToolCall: …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.
class OpenAITypesResponsesResponseInputItemFunctionCallOutput: …The output of a function tool call.
The output of a function tool call.
output: Union[str, List[OutputOutputContentList]]
List[OutputOutputContentList]
class OutputOutputContentListResponseInputImageContent: …An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItemParam: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseInputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseInputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class OpenAITypesResponsesResponseInputItemLocalShellCallOutput: …The output of a local shell tool call.
The output of a local shell tool call.
class ShellCall: …A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
class ShellCallOutput: …The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
class ApplyPatchCall: …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: OperationInstruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
class OpenAITypesResponsesResponseInputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
class OpenAITypesResponsesResponseInputItemMcpApprovalResponse: …A response to an MCP approval request.
A response to an MCP approval request.
class OpenAIResponseCustomToolCallOutput: …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: Union[str, List[OutputOutputContentList]]
List[OutputOutputContentList]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
prompt: Optional[OpenAIResponsePrompt]Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
variables: Optional[Dict[str, Variables]]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
reasoning: Optional[Reasoning]gpt-5 and o-series models only
Configuration options for
reasoning models.
gpt-5 and o-series models only
Configuration options for reasoning models.
text: Optional[OpenAIResponseTextConfig]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: Optional[Format]Default response format. Used to generate text responses.
Default response format. Used to generate text responses.
class FormatResponseFormatTextJsonSchemaConfig: …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.
class ResponseOutputItemAddedEvent: …Emitted when a new output item is added.
Emitted when a new output item is added.
item: ResponseOutputItemAddedEventItemAn output message from the model.
An output message from the model.
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseFunctionToolCall: …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.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItem: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseOutputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseOutputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class ResponseFunctionShellToolCall: …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.
class ResponseFunctionShellToolCallOutput: …The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
class ResponseApplyPatchToolCall: …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: OperationInstruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
class OpenAITypesResponsesResponseOutputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
class ResponseOutputItemDoneEvent: …Emitted when an output item is marked done.
Emitted when an output item is marked done.
item: ResponseOutputItemDoneEventItemAn output message from the model.
An output message from the model.
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseFunctionToolCall: …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.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItem: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseOutputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseOutputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class ResponseFunctionShellToolCall: …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.
class ResponseFunctionShellToolCallOutput: …The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
class ResponseApplyPatchToolCall: …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: OperationInstruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
class OpenAITypesResponsesResponseOutputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
class ResponseReasoningSummaryTextDeltaEvent: …Emitted when a delta is added to a reasoning summary text.
Emitted when a delta is added to a reasoning summary text.
class ResponseTextDeltaEvent: …Emitted when there is an additional text delta.
Emitted when there is an additional text delta.
class ResponseImageGenCallCompletedEvent: …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.
class ResponseImageGenCallGeneratingEvent: …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).
class ResponseImageGenCallInProgressEvent: …Emitted when an image generation tool call is in progress.
Emitted when an image generation tool call is in progress.
class ResponseImageGenCallPartialImageEvent: …Emitted when a partial image is available during image generation streaming.
Emitted when a partial image is available during image generation streaming.
class ResponseMcpCallArgumentsDeltaEvent: …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.
class ResponseMcpCallArgumentsDoneEvent: …Emitted when the arguments for an MCP tool call are finalized.
Emitted when the arguments for an MCP tool call are finalized.
class ResponseMcpListToolsCompletedEvent: …Emitted when the list of available MCP tools has been successfully retrieved.
Emitted when the list of available MCP tools has been successfully retrieved.
class ResponseMcpListToolsFailedEvent: …Emitted when the attempt to list available MCP tools has failed.
Emitted when the attempt to list available MCP tools has failed.
class ResponseMcpListToolsInProgressEvent: …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.
class ResponseOutputTextAnnotationAddedEvent: …Emitted when an annotation is added to output text content.
Emitted when an annotation is added to output text content.
class ResponseQueuedEvent: …Emitted when a response is queued and waiting to be processed.
Emitted when a response is queued and waiting to be processed.
model: Union[Literal["gpt-5.2", "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", 83 more], str]
output: List[Output]
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseFunctionToolCall: …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.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItem: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseOutputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseOutputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class ResponseFunctionShellToolCall: …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.
class ResponseFunctionShellToolCallOutput: …The output of a shell tool call that was emitted.
The output of a shell tool call that was emitted.
class ResponseApplyPatchToolCall: …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: OperationInstruction describing how to create a file via the apply_patch tool.
Instruction describing how to create a file via the apply_patch tool.
class OpenAITypesResponsesResponseOutputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
tool_choice: ToolChoiceConstrains the tools available to the model to a pre-defined set.
Constrains the tools available to the model to a pre-defined set.
class ToolChoiceTypes: …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.
class ToolChoiceMcp: …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: List[Tool]
class FunctionTool: …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.
class FileSearchTool: …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: Optional[Filters]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.
class FiltersComparisonFilter: …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.
ranking_options: Optional[RankingOptions]Ranking options for search.
Ranking options for search.
class ComputerTool: …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.
class WebSearchTool: …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.
class ToolMcp: …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.
connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", 5 more]]
require_approval: Optional[ToolMcpRequireApproval]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.
class ToolMcpRequireApprovalMcpRequireApprovalMcpToolApprovalFilter: …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.
class ToolCodeInterpreter: …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: ToolCodeInterpreterContainerConfiguration 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.
class ToolCodeInterpreterContainerCodeInterpreterContainerCodeInterpreterToolAuto: …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.
class ToolImageGeneration: …A tool that generates images using the GPT image models.
A tool that generates images using the GPT image models.
input_image_mask: Optional[ToolImageGenerationInputImageMask]Optional mask for inpainting.
Contains image_url
(string, optional) and file_id (string, optional).
Optional mask for inpainting.
Contains image_url
(string, optional) and file_id (string, optional).
class ToolLocalShell: …A tool that allows the model to execute shell commands in a local environment.
A tool that allows the model to execute shell commands in a local environment.
class FunctionShellTool: …A tool that allows the model to execute shell commands.
A tool that allows the model to execute shell commands.
environment: Optional[Environment]
class CustomTool: …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
class WebSearchPreviewTool: …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.
conversation: Optional[Conversation]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.
error: Optional[OpenAIResponseError]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: Optional[Union[str, List[InstructionsInputItem], null]]
List[InstructionsInputItem]
class EasyInputMessage: …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: Union[str, List[ContentInputItem]]
List[ContentInputItem]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class OpenAITypesResponsesResponseInputItemMessage: …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: List[Content]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
class OpenAIResponseOutputMessage: …An output message from the model.
An output message from the model.
content: List[Content]
class OpenAIResponseOutputText: …A text output from the model.
A text output from the model.
annotations: List[Annotation]
class AnnotationOpenAITypesResponsesResponseOutputTextAnnotationURLCitation: …A citation for a web resource used to generate a model response.
A citation for a web resource used to generate a model response.
class OpenAIResponseFileSearchToolCall: …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.
class OpenAIResponseComputerToolCall: …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: ActionA click action.
A click action.
class OpenAITypesResponsesResponseInputItemComputerCallOutput: …The output of a computer tool call.
The output of a computer tool call.
class OpenAIResponseFunctionWebSearch: …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: ActionAction type “search” - Performs a web search query.
Action type “search” - Performs a web search query.
class OpenAIResponseFunctionToolCall: …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.
class OpenAITypesResponsesResponseInputItemFunctionCallOutput: …The output of a function tool call.
The output of a function tool call.
output: Union[str, List[OutputOutputContentList]]
List[OutputOutputContentList]
class OutputOutputContentListResponseInputImageContent: …An image input to the model.
Learn about image inputs
An image input to the model.
Learn about image inputs
class OpenAIResponseReasoningItem: …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.
class ResponseCompactionItemParam: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class OpenAITypesResponsesResponseInputItemImageGenerationCall: …An image generation request made by the model.
An image generation request made by the model.
class OpenAIResponseCodeInterpreterToolCall: …A tool call to run code.
A tool call to run code.
class OpenAITypesResponsesResponseInputItemLocalShellCall: …A tool call to run a command on the local shell.
A tool call to run a command on the local shell.
class OpenAITypesResponsesResponseInputItemLocalShellCallOutput: …The output of a local shell tool call.
The output of a local shell tool call.
class ShellCall: …A tool representing a request to execute one or more shell commands.
A tool representing a request to execute one or more shell commands.
class ShellCallOutput: …The streamed output items emitted by a shell tool call.
The streamed output items emitted by a shell tool call.
class ApplyPatchCall: …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: OperationInstruction for creating a new file via the apply_patch tool.
Instruction for creating a new file via the apply_patch tool.
class OpenAITypesResponsesResponseInputItemMcpListTools: …A list of tools available on an MCP server.
A list of tools available on an MCP server.
class OpenAITypesResponsesResponseInputItemMcpApprovalResponse: …A response to an MCP approval request.
A response to an MCP approval request.
class OpenAIResponseCustomToolCallOutput: …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: Union[str, List[OutputOutputContentList]]
List[OutputOutputContentList]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
prompt: Optional[OpenAIResponsePrompt]Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
variables: Optional[Dict[str, Variables]]
class OpenAIResponseInputImage: …An image input to the model.
Learn about image inputs.
An image input to the model.
Learn about image inputs.
reasoning: Optional[Reasoning]gpt-5 and o-series models only
Configuration options for
reasoning models.
gpt-5 and o-series models only
Configuration options for reasoning models.
text: Optional[OpenAIResponseTextConfig]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: Optional[Format]Default response format. Used to generate text responses.
Default response format. Used to generate text responses.
class FormatResponseFormatTextJsonSchemaConfig: …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.
class ResponseCustomToolCallInputDeltaEvent: …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 os
from scale_gp_beta import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
response = client.responses.create(
input="string",
model="model",
)
print(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"
}