Responses

ResponsesResource

Methods

create() ->
post/v5/responses

Responses

Parameters
input: Union[str, Iterable[]]
str
Iterable[]
model: str

model specified as model_vendor/model, for example openai/gpt-4o

include: Optional[Sequence[str]]

Which fields to include in the response

instructions: Optional[str]

Instructions for the response generation

max_output_tokens: Optional[int]

Maximum number of output tokens

metadata: Optional[Dict[str, ]]

Metadata for the response

parallel_tool_calls: Optional[]

Whether to enable parallel tool calls

previous_response_id: Optional[str]

ID of the previous response for chaining

reasoning: Optional[Dict[str, ]]

Reasoning configuration for the response

store: Optional[]

Whether to store the response

stream: Optional[]

Whether to stream the response

temperature: Optional[float]
(maximum: 2, minimum: 0)

Sampling temperature for randomness control

text: Optional[Dict[str, ]]

Text configuration parameters

tool_choice: Optional[Union[str, Dict[str, ]]]

Tool choice configuration

str
Dict[str, ]
tools: Optional[Iterable[Dict[str, ]]]

Tools available for the response

top_p: Optional[float]
(maximum: 1, minimum: 0)

Top-p sampling parameter

truncation: Optional[Literal["auto", "disabled"]]

Truncation configuration

"auto"
"disabled"
Returns

Emitted when there is a partial audio response.

class ResponseAudioDeltaEvent: ...

Emitted when there is a partial audio response.

class ResponseAudioDoneEvent: ...

Emitted when the audio response is complete.

class ResponseAudioTranscriptDeltaEvent: ...

Emitted when there is a partial transcript of audio.

class ResponseAudioTranscriptDoneEvent: ...

Emitted when the full audio transcript is completed.

class ResponseCodeInterpreterCallCodeDeltaEvent: ...

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.

class ResponseCodeInterpreterCallCompletedEvent: ...

Emitted when the code interpreter call is completed.

class ResponseCodeInterpreterCallInProgressEvent: ...

Emitted when a code interpreter call is in progress.

class ResponseCodeInterpreterCallInterpretingEvent: ...

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

class ResponseCompletedEvent: ...

Emitted when the model response is complete.

class ResponseContentPartAddedEvent: ...

Emitted when a new content part is added.

class ResponseContentPartDoneEvent: ...

Emitted when a content part is done.

class ResponseCreatedEvent: ...

An event that is emitted when a response is created.

class ResponseErrorEvent: ...

Emitted when an error occurs.

class ResponseFileSearchCallCompletedEvent: ...

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

class ResponseFileSearchCallInProgressEvent: ...

Emitted when a file search call is initiated.

class ResponseFileSearchCallSearchingEvent: ...

Emitted when a file search is currently searching.

class ResponseFunctionCallArgumentsDeltaEvent: ...

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

class ResponseFunctionCallArgumentsDoneEvent: ...

Emitted when function-call arguments are finalized.

class ResponseInProgressEvent: ...

Emitted when the response is in progress.

class ResponseFailedEvent: ...

An event that is emitted when a response fails.

class ResponseIncompleteEvent: ...

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

class ResponseOutputItemAddedEvent: ...

Emitted when a new output item is added.

class ResponseOutputItemDoneEvent: ...

Emitted when an output item is marked done.

class ResponseReasoningSummaryPartAddedEvent: ...

Emitted when a new reasoning summary part is added.

class ResponseReasoningSummaryPartDoneEvent: ...

Emitted when a reasoning summary part is completed.

class ResponseReasoningSummaryTextDeltaEvent: ...

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

class ResponseReasoningSummaryTextDoneEvent: ...

Emitted when a reasoning summary text is completed.

class ResponseReasoningTextDeltaEvent: ...

Emitted when a delta is added to a reasoning text.

class ResponseReasoningTextDoneEvent: ...

Emitted when a reasoning text is completed.

class ResponseRefusalDeltaEvent: ...

Emitted when there is a partial refusal text.

class ResponseRefusalDoneEvent: ...

Emitted when refusal text is finalized.

class ResponseTextDeltaEvent: ...

Emitted when there is an additional text delta.

class ResponseTextDoneEvent: ...

Emitted when text content is finalized.

class ResponseWebSearchCallCompletedEvent: ...

Emitted when a web search call is completed.

class ResponseWebSearchCallInProgressEvent: ...

Emitted when a web search call is initiated.

class ResponseWebSearchCallSearchingEvent: ...

Emitted when a web search call is executing.

class ResponseImageGenCallCompletedEvent: ...

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).

class ResponseImageGenCallInProgressEvent: ...

Emitted when an image generation tool call is in progress.

class ResponseImageGenCallPartialImageEvent: ...

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.

class ResponseMcpCallArgumentsDoneEvent: ...

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

class ResponseMcpCallCompletedEvent: ...

Emitted when an MCP tool call has completed successfully.

class ResponseMcpCallFailedEvent: ...

Emitted when an MCP tool call has failed.

class ResponseMcpCallInProgressEvent: ...

Emitted when an MCP tool call is in progress.

class ResponseMcpListToolsCompletedEvent: ...

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.

class ResponseMcpListToolsInProgressEvent: ...

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.

class ResponseQueuedEvent: ...

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

class ResponseCustomToolCallInputDeltaEvent: ...

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

class ResponseCustomToolCallInputDoneEvent: ...

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

class GenericResponseEvent: ...
Request example
200Example

Domain types

class ApplyPatchCall: ...

A tool call representing a request to create, delete, or update files using diff patches.

class ApplyPatchCallOutput: ...

The streamed output emitted by an apply patch tool call.

class ApplyPatchTool: ...

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

class ComputerTool: ...

A tool that controls a virtual computer.

Learn more about the computer tool.

class ContainerNetworkPolicyAllowlist: ...
class ContainerNetworkPolicyDisabled: ...
class ContainerReference: ...
class ContainerReferenceParam: ...
class Conversation: ...

The conversation that this response belonged to.

Input items and output items from this response were automatically added to this conversation.

class CustomTool: ...

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.

class FileSearchTool: ...

A tool that searches for relevant content from uploaded files.

Learn more about the file search tool.

class FunctionShellTool: ...

A tool that allows the model to execute shell commands.

class FunctionTool: ...

Defines a function in your own code the model can choose to call.

Learn more about function calling.

class IncompleteDetails: ...

Details about why the response is incomplete.

class LocalEnvironment: ...
class LocalEnvironmentParam: ...
class McpApprovalRequest: ...

A request for human approval of a tool invocation.

class OpenAIResponse: ...
class OpenAIResponseCodeInterpreterToolCall: ...

A tool call to run code.

class OpenAIResponseComputerToolCall: ...

A tool call to a computer use tool.

See the computer use guide for more information.

class OpenAIResponseCustomToolCall: ...

A call to a custom tool created by the model.

class OpenAIResponseCustomToolCallOutput: ...

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

class OpenAIResponseError: ...

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

class OpenAIResponseFileSearchToolCall: ...

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.

class OpenAIResponseFunctionWebSearch: ...

The results of a web search tool call.

See the web search guide for more information.

class OpenAIResponseInputFile: ...

A file input to the model.

class OpenAIResponseInputFileParam: ...

A file input to the model.

class OpenAIResponseInputImage: ...

An image input to the model.

Learn about image inputs.

class OpenAIResponseInputImageParam: ...

An image input to the model.

Learn about image inputs.

class OpenAIResponseInputText: ...

A text input to the model.

class OpenAIResponseInputTextParam: ...

A text input to the model.

class OpenAIResponseOutputMessage: ...

An output message from the model.

class OpenAIResponseOutputRefusal: ...

A refusal from the model.

class OpenAIResponseOutputText: ...

A text output from the model.

class OpenAIResponsePrompt: ...

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

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.

class OpenAIResponseTextConfig: ...

Configuration options for a text response from the model.

Can be plain text or structured JSON data. Learn more:

class OpenAIResponseUsage: ...

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

class OpenAITypesResponsesResponseInputItemComputerCallOutput: ...

The output of a computer tool call.

class OpenAITypesResponsesResponseInputItemFunctionCallOutput: ...

The output of a function tool call.

class OpenAITypesResponsesResponseInputItemImageGenerationCall: ...

An image generation request made by the model.

class OpenAITypesResponsesResponseInputItemItemReference: ...

An internal identifier for an item to reference.

class OpenAITypesResponsesResponseInputItemLocalShellCall: ...

A tool call to run a command on the local shell.

class OpenAITypesResponsesResponseInputItemLocalShellCallOutput: ...

The output of a local shell tool call.

class OpenAITypesResponsesResponseInputItemMcpApprovalResponse: ...

A response to an MCP approval request.

class OpenAITypesResponsesResponseInputItemMcpCall: ...

An invocation of a tool on an MCP server.

class OpenAITypesResponsesResponseInputItemMcpListTools: ...

A list of tools available on an MCP server.

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.

class OpenAITypesResponsesResponseOutputItemImageGenerationCall: ...

An image generation request made by the model.

class OpenAITypesResponsesResponseOutputItemLocalShellCall: ...

A tool call to run a command on the local shell.

class OpenAITypesResponsesResponseOutputItemMcpCall: ...

An invocation of a tool on an MCP server.

class OpenAITypesResponsesResponseOutputItemMcpListTools: ...

A list of tools available on an MCP server.

class PartReasoningText: ...

Reasoning text from the model.

class Reasoning: ...

gpt-5 and o-series models only

Configuration options for reasoning models.

class ResponseApplyPatchToolCall: ...

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

class ResponseApplyPatchToolCallOutput: ...

The output emitted by an apply patch tool call.

class ResponseCompactionItem: ...

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

class ResponseCompactionItemParam: ...

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

class ResponseComputerToolCallOutputScreenshot: ...

A computer screenshot image used with the computer use tool.

Emitted when there is a partial audio response.

class ResponseFunctionShellToolCall: ...

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.

class ShellCall: ...

A tool representing a request to execute one or more shell commands.

class ShellCallOutput: ...

The streamed output items emitted by a shell tool call.

class ToolChoiceAllowed: ...

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

class ToolChoiceApplyPatch: ...

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

class ToolChoiceCustom: ...

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

class ToolChoiceFunction: ...

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

class ToolChoiceMcp: ...

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

class ToolChoiceShell: ...

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

class ToolChoiceTypes: ...

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.

class WebSearchTool: ...

Search the Internet for sources related to the prompt.

Learn more about the web search tool.