Responses
Compact a response
Get a model response
ModelsExpand Collapse
List[ComputerAction]Flattened batched actions for computer_use. Each action includes an
type discriminator and action-specific fields.
Flattened batched actions for computer_use. Each action includes an
type discriminator and action-specific fields.
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 ComputerUsePreviewTool: …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 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 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.
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.
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 ResponseCompactionItem: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class ResponseCompactionItemParam: …A compaction item generated by the v1/responses/compact API.
A compaction item generated by the v1/responses/compact API.
class ResponseComputerToolCall: …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.
class ResponseFileSearchToolCall: …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.
An object specifying the format that the model must output.
Configuring { "type": "json_schema" } enables Structured Outputs,
which ensures the model will match your supplied JSON schema. Learn more in the
Structured Outputs guide.
The default format is { "type": "text" } with no additional options.
Not recommended for gpt-4o and newer models:
Setting to { "type": "json_object" } enables the older JSON mode, which
ensures the message the model generates is valid JSON. Using json_schema
is preferred for models that support it.
An object specifying the format that the model must output.
Configuring { "type": "json_schema" } enables Structured Outputs,
which ensures the model will match your supplied JSON schema. Learn more in the
Structured Outputs guide.
The default format is { "type": "text" } with no additional options.
Not recommended for gpt-4o and newer models:
Setting to { "type": "json_object" } enables the older JSON mode, which
ensures the message the model generates is valid JSON. Using json_schema
is preferred for models that support it.
class ResponseFormatTextJSONSchemaConfig: …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 ResponseFunctionToolCall: …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 ResponseFunctionToolCallItem: …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 ResponseFunctionWebSearch: …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.
Literal["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", 5 more]Specify additional output data to include in the model response. Currently supported values are:
web_search_call.results: Include the search results of the web search tool call.
web_search_call.action.sources: Include the sources of the web search tool call.
code_interpreter_call.outputs: Includes the outputs of python code execution in code interpreter tool call items.
computer_call_output.output.image_url: Include image urls from the computer call output.
file_search_call.results: Include the search results of the file search tool call.
message.input_image.image_url: Include image urls from the input message.
message.output_text.logprobs: Include logprobs with assistant messages.
reasoning.encrypted_content: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the store parameter is set to false, or when an organization is enrolled in the zero data retention program).
Specify additional output data to include in the model response. Currently supported values are:
web_search_call.results: Include the search results of the web search tool call.web_search_call.action.sources: Include the sources of the web search tool call.code_interpreter_call.outputs: Includes the outputs of python code execution in code interpreter tool call items.computer_call_output.output.image_url: Include image urls from the computer call output.file_search_call.results: Include the search results of the file search tool call.message.input_image.image_url: Include image urls from the input message.message.output_text.logprobs: Include logprobs with assistant messages.reasoning.encrypted_content: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when thestoreparameter is set tofalse, or when an organization is enrolled in the zero data retention program).
List[ResponseInputItem]A list of one or many input items to the model, containing
different content types.
A list of one or many input items to the model, containing different content types.
class ResponseInputImage: …An image input to the model. Learn about image inputs.
An image input to the model. Learn about image inputs.
class ResponseInputImageContent: …An image input to the model. Learn about image inputs
An image input to the model. Learn about image inputs
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.
List[ResponseInputContent]A list of one or many input items to the model, containing different content
types.
A list of one or many input items to the model, containing different content types.
class ResponsePrompt: …Reference to a prompt template and its variables.
Learn more.
Reference to a prompt template and its variables. Learn more.
class ResponseReasoningItem: …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.
Literal["none", "auto", "required"]Controls which (if any) tool is called by the model.
none means the model will not call any tool and instead generates a message.
auto means the model can pick between generating a message or calling one or
more tools.
required means the model must call one or more tools.
Controls which (if any) tool is called by the model.
none means the model will not call any tool and instead generates a message.
auto means the model can pick between generating a message or calling one or
more tools.
required means the model must call one or more tools.
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 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.
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.