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

Responses

Cancel a response
client.Responses.Cancel(ctx, responseID) (*Response, error)
POST/responses/{response_id}/cancel
Compact a response
client.Responses.Compact(ctx, body) (*CompactedResponse, error)
POST/responses/compact
Create a model response
client.Responses.New(ctx, body) (*Response, error)
POST/responses
Delete a model response
client.Responses.Delete(ctx, responseID) error
DELETE/responses/{response_id}
Get a model response
client.Responses.Get(ctx, responseID, query) (*Response, error)
GET/responses/{response_id}
ModelsExpand Collapse
type ApplyPatchTool struct{…}

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

type CompactedResponse struct{…}
type ComputerActionUnion interface{…}

A click action.

type ComputerActionList []ComputerActionUnion

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

type ComputerTool struct{…}

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

type ComputerUsePreviewTool struct{…}

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

type ContainerAuto struct{…}
type ContainerNetworkPolicyAllowlist struct{…}
type ContainerNetworkPolicyDisabled struct{…}
type ContainerNetworkPolicyDomainSecret struct{…}
type ContainerReference struct{…}
type CustomTool struct{…}

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

type EasyInputMessage struct{…}

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.

type FileSearchTool struct{…}

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

type FunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

type FunctionTool struct{…}

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

type InlineSkill struct{…}
type InlineSkillSource struct{…}

Inline skill payload

type LocalEnvironment struct{…}
type LocalSkill struct{…}
type McpToolCallErrorUnion interface{…}
type NamespaceTool struct{…}

Groups function/custom tools under a shared namespace.

type Response struct{…}
type ResponseApplyPatchToolCall struct{…}

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

type ResponseApplyPatchToolCallOutput struct{…}

The output emitted by an apply patch tool call.

type ResponseAudioDeltaEvent struct{…}

Emitted when there is a partial audio response.

type ResponseAudioDoneEvent struct{…}

Emitted when the audio response is complete.

type ResponseAudioTranscriptDeltaEvent struct{…}

Emitted when there is a partial transcript of audio.

type ResponseAudioTranscriptDoneEvent struct{…}

Emitted when the full audio transcript is completed.

type ResponseCodeInterpreterCallCodeDeltaEvent struct{…}

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

type ResponseCodeInterpreterCallCodeDoneEvent struct{…}

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

type ResponseCodeInterpreterCallCompletedEvent struct{…}

Emitted when the code interpreter call is completed.

type ResponseCodeInterpreterCallInProgressEvent struct{…}

Emitted when a code interpreter call is in progress.

type ResponseCodeInterpreterCallInterpretingEvent struct{…}

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

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

type ResponseCompactionItem struct{…}

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

type ResponseCompactionItemParamResp struct{…}

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

type ResponseCompletedEvent struct{…}

Emitted when the model response is complete.

type ResponseComputerToolCall struct{…}

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

type ResponseComputerToolCallOutputItem struct{…}
type ResponseComputerToolCallOutputScreenshot struct{…}

A computer screenshot image used with the computer use tool.

type ResponseContainerReference struct{…}

Represents a container created with /v1/containers.

type ResponseContentUnion interface{…}

Multi-modal input and output contents.

type ResponseContentPartAddedEvent struct{…}

Emitted when a new content part is added.

type ResponseContentPartDoneEvent struct{…}

Emitted when a content part is done.

type ResponseConversationParamResp struct{…}

The conversation that this response belongs to.

type ResponseCreatedEvent struct{…}

An event that is emitted when a response is created.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

type ResponseCustomToolCallInputDeltaEvent struct{…}

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

type ResponseCustomToolCallInputDoneEvent struct{…}

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

type ResponseCustomToolCallItem struct{…}

A call to a custom tool created by the model.

type ResponseCustomToolCallOutput struct{…}

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

type ResponseCustomToolCallOutputItem struct{…}

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

type ResponseError struct{…}

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

type ResponseErrorEvent struct{…}

Emitted when an error occurs.

type ResponseFailedEvent struct{…}

An event that is emitted when a response fails.

type ResponseFileSearchCallCompletedEvent struct{…}

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

type ResponseFileSearchCallInProgressEvent struct{…}

Emitted when a file search call is initiated.

type ResponseFileSearchCallSearchingEvent struct{…}

Emitted when a file search is currently searching.

type ResponseFileSearchToolCall struct{…}

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

type ResponseFormatTextConfigUnion interface{…}

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.

type ResponseFormatTextJSONSchemaConfig struct{…}

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

type ResponseFunctionCallArgumentsDeltaEvent struct{…}

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

type ResponseFunctionCallArgumentsDoneEvent struct{…}

Emitted when function-call arguments are finalized.

type ResponseFunctionCallOutputItemUnion interface{…}

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

type ResponseFunctionCallOutputItemList []ResponseFunctionCallOutputItemUnion

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

type ResponseFunctionShellCallOutputContent struct{…}

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

type ResponseFunctionShellToolCall struct{…}

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

type ResponseFunctionShellToolCallOutput struct{…}

The output of a shell tool call that was emitted.

type ResponseFunctionToolCall struct{…}

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

type ResponseFunctionToolCallItem struct{…}

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

type ResponseFunctionToolCallOutputItem struct{…}
type ResponseImageGenCallCompletedEvent struct{…}

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

type ResponseImageGenCallGeneratingEvent struct{…}

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

type ResponseImageGenCallInProgressEvent struct{…}

Emitted when an image generation tool call is in progress.

type ResponseImageGenCallPartialImageEvent struct{…}

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

type ResponseInProgressEvent struct{…}

Emitted when the response is in progress.

type ResponseIncludable string

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).
type ResponseIncompleteEvent struct{…}

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

type ResponseInput []ResponseInputItemUnion

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

type ResponseInputAudio struct{…}

An audio input to the model.

type ResponseInputContentUnion interface{…}

A text input to the model.

type ResponseInputFile struct{…}

A file input to the model.

type ResponseInputFileContent struct{…}

A file input to the model.

type ResponseInputImage struct{…}

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

type ResponseInputImageContent struct{…}

An image input to the model. Learn about image inputs

type ResponseInputItemUnion interface{…}

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.

type ResponseInputMessageContentList []ResponseInputContentUnion

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

type ResponseInputMessageItem struct{…}
type ResponseInputText struct{…}

A text input to the model.

type ResponseInputTextContent struct{…}

A text input to the model.

type ResponseItemUnion interface{…}

Content item used to generate a response.

type ResponseLocalEnvironment struct{…}

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

type ResponseMcpCallArgumentsDeltaEvent struct{…}

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

type ResponseMcpCallArgumentsDoneEvent struct{…}

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

type ResponseMcpCallCompletedEvent struct{…}

Emitted when an MCP tool call has completed successfully.

type ResponseMcpCallFailedEvent struct{…}

Emitted when an MCP tool call has failed.

type ResponseMcpCallInProgressEvent struct{…}

Emitted when an MCP tool call is in progress.

type ResponseMcpListToolsCompletedEvent struct{…}

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

type ResponseMcpListToolsFailedEvent struct{…}

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

type ResponseMcpListToolsInProgressEvent struct{…}

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

type ResponseOutputAudio struct{…}

An audio output from the model.

type ResponseOutputItemUnion interface{…}

An output message from the model.

type ResponseOutputItemAddedEvent struct{…}

Emitted when a new output item is added.

type ResponseOutputItemDoneEvent struct{…}

Emitted when an output item is marked done.

type ResponseOutputMessage struct{…}

An output message from the model.

type ResponseOutputRefusal struct{…}

A refusal from the model.

type ResponseOutputText struct{…}

A text output from the model.

type ResponseOutputTextAnnotationAddedEvent struct{…}

Emitted when an annotation is added to output text content.

type ResponsePrompt struct{…}

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

type ResponseQueuedEvent struct{…}

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

type ResponseReasoningItem struct{…}

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.

type ResponseReasoningSummaryPartAddedEvent struct{…}

Emitted when a new reasoning summary part is added.

type ResponseReasoningSummaryPartDoneEvent struct{…}

Emitted when a reasoning summary part is completed.

type ResponseReasoningSummaryTextDeltaEvent struct{…}

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

type ResponseReasoningSummaryTextDoneEvent struct{…}

Emitted when a reasoning summary text is completed.

type ResponseReasoningTextDeltaEvent struct{…}

Emitted when a delta is added to a reasoning text.

type ResponseReasoningTextDoneEvent struct{…}

Emitted when a reasoning text is completed.

type ResponseRefusalDeltaEvent struct{…}

Emitted when there is a partial refusal text.

type ResponseRefusalDoneEvent struct{…}

Emitted when refusal text is finalized.

type ResponseShellCallCommandAddedEvent struct{…}

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

type ResponseShellCallCommandDeltaEvent struct{…}

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

type ResponseShellCallCommandDoneEvent struct{…}

A streaming event that indicated a shell command was completed.

type ResponseShellCallOutputContentDeltaEvent struct{…}

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

type ResponseShellCallOutputContentDoneEvent struct{…}

A streaming event that indicated shell call output was completed.

type ResponseStatus string

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

type ResponseStreamEventUnion interface{…}

Event emitted while a response is streamed.

type ResponseTextConfig struct{…}

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

type ResponseTextDeltaEvent struct{…}

Emitted when there is an additional text delta.

type ResponseTextDoneEvent struct{…}

Emitted when text content is finalized.

type ResponseToolSearchCall struct{…}
type ResponseToolSearchOutputItem struct{…}
type ResponseToolSearchOutputItemParamResp struct{…}
type ResponseUsage struct{…}

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

type ResponseWebSearchCallCompletedEvent struct{…}

Emitted when a web search call is completed.

type ResponseWebSearchCallInProgressEvent struct{…}

Emitted when a web search call is initiated.

type ResponseWebSearchCallSearchingEvent struct{…}

Emitted when a web search call is executing.

type ResponsesClientEvent struct{…}
type ResponsesServerEventUnion interface{…}

Server events emitted by the Responses WebSocket server.

type SkillReference struct{…}
type ToolUnion interface{…}

A tool that can be used to generate a response.

type ToolChoiceAllowed struct{…}

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

type ToolChoiceApplyPatch struct{…}

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

type ToolChoiceCustom struct{…}

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

type ToolChoiceFunction struct{…}

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

type ToolChoiceMcp struct{…}

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

type ToolChoiceOptions string

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.

type ToolChoiceShell struct{…}

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

type ToolChoiceTypes struct{…}

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

type ToolSearchTool struct{…}

Hosted or BYOT tool search configuration for deferred tools.

type WebSearchPreviewTool struct{…}

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

type WebSearchTool struct{…}

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

ResponsesInput Items

List input items
client.Responses.InputItems.List(ctx, responseID, query) (*CursorPage[ResponseItemUnion], error)
GET/responses/{response_id}/input_items
ModelsExpand Collapse
type ResponseItemList struct{…}

A list of Response items.

ResponsesInput Tokens

Get input token counts
client.Responses.InputTokens.Count(ctx, body) (*InputTokenCountResponse, error)
POST/responses/input_tokens