Skip to content

Create a model response

client.Responses.New(ctx, body) (*Response, error)
POST/responses

Creates a model response. Provide text or image inputs to generate text or JSON outputs. Have the model call your own custom code or use built-in tools like web search or file search to use your own data as input for the model's response.

ParametersExpand Collapse
body ResponseNewParams
Background param.Field[bool]optional

Whether to run the model response in the background. Learn more.

ContextManagement param.Field[[]ResponseNewParamsContextManagement]optional

Context management configuration for this request.

Type string

The context management entry type. Currently only 'compaction' is supported.

CompactThreshold int64optional

Token threshold at which compaction should be triggered for this entry.

minimum1000
Conversation param.Field[ResponseNewParamsConversationUnion]optional

The conversation that this response belongs to. Items from this conversation are prepended to input_items for this response request. Input items and output items from this response are automatically added to this conversation after this response completes.

string
type ResponseConversationParamResp struct{…}

The conversation that this response belongs to.

ID string

The unique ID of the conversation.

Include param.Field[[]ResponseIncludable]optional

Specify additional output data to include in the model response. Currently supported values are:

  • 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).
const ResponseIncludableFileSearchCallResults ResponseIncludable = "file_search_call.results"
const ResponseIncludableWebSearchCallResults ResponseIncludable = "web_search_call.results"
const ResponseIncludableWebSearchCallActionSources ResponseIncludable = "web_search_call.action.sources"
const ResponseIncludableMessageInputImageImageURL ResponseIncludable = "message.input_image.image_url"
const ResponseIncludableComputerCallOutputOutputImageURL ResponseIncludable = "computer_call_output.output.image_url"
const ResponseIncludableCodeInterpreterCallOutputs ResponseIncludable = "code_interpreter_call.outputs"
const ResponseIncludableReasoningEncryptedContent ResponseIncludable = "reasoning.encrypted_content"
const ResponseIncludableMessageOutputTextLogprobs ResponseIncludable = "message.output_text.logprobs"
Input param.Field[ResponseNewParamsInputUnion]optional

Text, image, or file inputs to the model, used to generate a response.

Learn more:

string
type ResponseInput []ResponseInputItemUnion

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

Accepts one of the following:
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.

Content EasyInputMessageContentUnion

Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.

Accepts one of the following:
string
type ResponseInputMessageContentList []ResponseInputContentUnion

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role EasyInputMessageRole

The role of the message input. One of user, assistant, system, or developer.

Accepts one of the following:
const EasyInputMessageRoleUser EasyInputMessageRole = "user"
const EasyInputMessageRoleAssistant EasyInputMessageRole = "assistant"
const EasyInputMessageRoleSystem EasyInputMessageRole = "system"
const EasyInputMessageRoleDeveloper EasyInputMessageRole = "developer"
Type EasyInputMessageTypeoptional

The type of the message input. Always message.

type ResponseInputItemMessage 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.

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role string

The role of the message input. One of user, system, or developer.

Accepts one of the following:
const ResponseInputItemMessageRoleUser ResponseInputItemMessageRole = "user"
const ResponseInputItemMessageRoleSystem ResponseInputItemMessageRole = "system"
const ResponseInputItemMessageRoleDeveloper ResponseInputItemMessageRole = "developer"
Status stringoptional

The status of item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemMessageStatusInProgress ResponseInputItemMessageStatus = "in_progress"
const ResponseInputItemMessageStatusCompleted ResponseInputItemMessageStatus = "completed"
const ResponseInputItemMessageStatusIncomplete ResponseInputItemMessageStatus = "incomplete"
Type stringoptional

The type of the message input. Always set to message.

type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

type ResponseInputItemComputerCallOutput struct{…}

The output of a computer tool call.

CallID string

The ID of the computer tool call that produced the output.

maxLength64
minLength1

A computer screenshot image used with the computer use tool.

Type ComputerScreenshot

Specifies the event type. For a computer screenshot, this property is always set to computer_screenshot.

FileID stringoptional

The identifier of an uploaded file that contains the screenshot.

ImageURL stringoptional

The URL of the screenshot image.

Type ComputerCallOutput

The type of the computer tool call output. Always computer_call_output.

ID stringoptional

The ID of the computer tool call output.

AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckoptional

The safety checks reported by the API that have been acknowledged by the developer.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status stringoptional

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseInputItemComputerCallOutputStatusInProgress ResponseInputItemComputerCallOutputStatus = "in_progress"
const ResponseInputItemComputerCallOutputStatusCompleted ResponseInputItemComputerCallOutputStatus = "completed"
const ResponseInputItemComputerCallOutputStatusIncomplete ResponseInputItemComputerCallOutputStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
type ResponseInputItemFunctionCallOutput struct{…}

The output of a function tool call.

CallID string

The unique ID of the function tool call generated by the model.

maxLength64
minLength1
Output ResponseInputItemFunctionCallOutputOutputUnion

Text, image, or file output of the function tool call.

Accepts one of the following:
string
type ResponseFunctionCallOutputItemList []ResponseFunctionCallOutputItemUnion

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

Accepts one of the following:
type ResponseInputTextContent struct{…}

A text input to the model.

Text string

The text input to the model.

maxLength10485760
Type InputText

The type of the input item. Always input_text.

type ResponseInputImageContent struct{…}

An image input to the model. Learn about image inputs

Type InputImage

The type of the input item. Always input_image.

Detail ResponseInputImageContentDetailoptional

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageContentDetailLow ResponseInputImageContentDetail = "low"
const ResponseInputImageContentDetailHigh ResponseInputImageContentDetail = "high"
const ResponseInputImageContentDetailAuto ResponseInputImageContentDetail = "auto"
FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

maxLength20971520
type ResponseInputFileContent struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The base64-encoded data of the file to be sent to the model.

maxLength33554432
FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type FunctionCallOutput

The type of the function tool call output. Always function_call_output.

ID stringoptional

The unique ID of the function tool call output. Populated when this item is returned via API.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemFunctionCallOutputStatusInProgress ResponseInputItemFunctionCallOutputStatus = "in_progress"
const ResponseInputItemFunctionCallOutputStatusCompleted ResponseInputItemFunctionCallOutputStatus = "completed"
const ResponseInputItemFunctionCallOutputStatusIncomplete ResponseInputItemFunctionCallOutputStatus = "incomplete"
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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItemParamResp struct{…}

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

EncryptedContent string

The encrypted content of the compaction summary.

maxLength10485760
Type Compaction

The type of the item. Always compaction.

ID stringoptional

The ID of the compaction item.

type ResponseInputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseInputItemImageGenerationCallStatusInProgress ResponseInputItemImageGenerationCallStatus = "in_progress"
const ResponseInputItemImageGenerationCallStatusCompleted ResponseInputItemImageGenerationCallStatus = "completed"
const ResponseInputItemImageGenerationCallStatusGenerating ResponseInputItemImageGenerationCallStatus = "generating"
const ResponseInputItemImageGenerationCallStatusFailed ResponseInputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseInputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseInputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseInputItemLocalShellCallStatusInProgress ResponseInputItemLocalShellCallStatus = "in_progress"
const ResponseInputItemLocalShellCallStatusCompleted ResponseInputItemLocalShellCallStatus = "completed"
const ResponseInputItemLocalShellCallStatusIncomplete ResponseInputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseInputItemLocalShellCallOutput struct{…}

The output of a local shell tool call.

ID string

The unique ID of the local shell tool call generated by the model.

Output string

A JSON string of the output of the local shell tool call.

Type LocalShellCallOutput

The type of the local shell tool call output. Always local_shell_call_output.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemLocalShellCallOutputStatusInProgress ResponseInputItemLocalShellCallOutputStatus = "in_progress"
const ResponseInputItemLocalShellCallOutputStatusCompleted ResponseInputItemLocalShellCallOutputStatus = "completed"
const ResponseInputItemLocalShellCallOutputStatusIncomplete ResponseInputItemLocalShellCallOutputStatus = "incomplete"
type ResponseInputItemShellCall struct{…}

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

Action ResponseInputItemShellCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string

Ordered shell commands for the execution environment to run.

MaxOutputLength int64optional

Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

TimeoutMs int64optional

Maximum wall-clock time in milliseconds to allow the shell commands to run.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1
Type ShellCall

The type of the item. Always shell_call.

ID stringoptional

The unique ID of the shell tool call. Populated when this item is returned via API.

Status stringoptional

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemShellCallStatusInProgress ResponseInputItemShellCallStatus = "in_progress"
const ResponseInputItemShellCallStatusCompleted ResponseInputItemShellCallStatus = "completed"
const ResponseInputItemShellCallStatusIncomplete ResponseInputItemShellCallStatus = "incomplete"
type ResponseInputItemShellCallOutput struct{…}

The streamed output items emitted by a shell tool call.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1

Captured chunks of stdout and stderr output, along with their associated outcomes.

Outcome ResponseFunctionShellCallOutputContentOutcomeUnion

The exit or timeout outcome associated with this shell call.

Accepts one of the following:
type ResponseFunctionShellCallOutputContentOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellCallOutputContentOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

The exit code returned by the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

Captured stderr output for the shell call.

maxLength10485760
Stdout string

Captured stdout output for the shell call.

maxLength10485760
Type ShellCallOutput

The type of the item. Always shell_call_output.

ID stringoptional

The unique ID of the shell tool call output. Populated when this item is returned via API.

MaxOutputLength int64optional

The maximum number of UTF-8 characters captured for this shell call's combined output.

Status stringoptional

The status of the shell call output.

Accepts one of the following:
const ResponseInputItemShellCallOutputStatusInProgress ResponseInputItemShellCallOutputStatus = "in_progress"
const ResponseInputItemShellCallOutputStatusCompleted ResponseInputItemShellCallOutputStatus = "completed"
const ResponseInputItemShellCallOutputStatusIncomplete ResponseInputItemShellCallOutputStatus = "incomplete"
type ResponseInputItemApplyPatchCall struct{…}

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

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Operation ResponseInputItemApplyPatchCallOperationUnion

The specific create, delete, or update instruction for the apply_patch tool call.

Accepts one of the following:
type ResponseInputItemApplyPatchCallOperationCreateFile struct{…}

Instruction for creating a new file via the apply_patch tool.

Diff string

Unified diff content to apply when creating the file.

maxLength10485760
Path string

Path of the file to create relative to the workspace root.

minLength1
Type CreateFile

The operation type. Always create_file.

type ResponseInputItemApplyPatchCallOperationDeleteFile struct{…}

Instruction for deleting an existing file via the apply_patch tool.

Path string

Path of the file to delete relative to the workspace root.

minLength1
Type DeleteFile

The operation type. Always delete_file.

type ResponseInputItemApplyPatchCallOperationUpdateFile struct{…}

Instruction for updating an existing file via the apply_patch tool.

Diff string

Unified diff content to apply to the existing file.

maxLength10485760
Path string

Path of the file to update relative to the workspace root.

minLength1
Type UpdateFile

The operation type. Always update_file.

Status string

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallStatusInProgress ResponseInputItemApplyPatchCallStatus = "in_progress"
const ResponseInputItemApplyPatchCallStatusCompleted ResponseInputItemApplyPatchCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

ID stringoptional

The unique ID of the apply patch tool call. Populated when this item is returned via API.

type ResponseInputItemApplyPatchCallOutput struct{…}

The streamed output emitted by an apply patch tool call.

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Status string

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallOutputStatusCompleted ResponseInputItemApplyPatchCallOutputStatus = "completed"
const ResponseInputItemApplyPatchCallOutputStatusFailed ResponseInputItemApplyPatchCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

ID stringoptional

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

Output stringoptional

Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

maxLength10485760
type ResponseInputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseInputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseInputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseInputItemMcpApprovalResponse struct{…}

A response to an MCP approval request.

ApprovalRequestID string

The ID of the approval request being answered.

Approve bool

Whether the request was approved.

Type McpApprovalResponse

The type of the item. Always mcp_approval_response.

ID stringoptional

The unique ID of the approval response

Reason stringoptional

Optional reason for the decision.

type ResponseInputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseInputItemMcpCallStatusInProgress ResponseInputItemMcpCallStatus = "in_progress"
const ResponseInputItemMcpCallStatusCompleted ResponseInputItemMcpCallStatus = "completed"
const ResponseInputItemMcpCallStatusIncomplete ResponseInputItemMcpCallStatus = "incomplete"
const ResponseInputItemMcpCallStatusCalling ResponseInputItemMcpCallStatus = "calling"
const ResponseInputItemMcpCallStatusFailed ResponseInputItemMcpCallStatus = "failed"
type ResponseCustomToolCallOutput struct{…}

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

CallID string

The call ID, used to map this custom tool call output to a custom tool call.

Output ResponseCustomToolCallOutputOutputUnion

The output from the custom tool call generated by your code. Can be a string or an list of output content.

Accepts one of the following:
string
type ResponseCustomToolCallOutputOutputOutputContentList []ResponseCustomToolCallOutputOutputOutputContentListItemUnion

Text, image, or file output of the custom tool call.

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type CustomToolCallOutput

The type of the custom tool call output. Always custom_tool_call_output.

ID stringoptional

The unique ID of the custom tool call output in the OpenAI platform.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

type ResponseInputItemItemReference struct{…}

An internal identifier for an item to reference.

ID string

The ID of the item to reference.

Type stringoptional

The type of item to reference. Always item_reference.

Instructions param.Field[string]optional

A system (or developer) message inserted into the model's context.

When using along with previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.

MaxOutputTokens param.Field[int64]optional

An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.

MaxToolCalls param.Field[int64]optional

The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

Metadata param.Field[Metadata]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Model param.Field[ResponsesModel]optional

Model ID used to generate the response, like gpt-4o or o3. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.

ParallelToolCalls param.Field[bool]optional

Whether to allow the model to run tool calls in parallel.

PreviousResponseID param.Field[string]optional

The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state. Cannot be used in conjunction with conversation.

Prompt param.Field[ResponsePrompt]optional

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

PromptCacheKey param.Field[string]optional

Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the user field. Learn more.

PromptCacheRetention param.Field[ResponseNewParamsPromptCacheRetention]optional

The retention policy for the prompt cache. Set to 24h to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. Learn more.

const ResponseNewParamsPromptCacheRetentionInMemory ResponseNewParamsPromptCacheRetention = "in-memory"
const ResponseNewParamsPromptCacheRetention24h ResponseNewParamsPromptCacheRetention = "24h"
Reasoning param.Field[Reasoning]optional

gpt-5 and o-series models only

Configuration options for reasoning models.

SafetyIdentifier param.Field[string]optional

A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. Learn more.

ServiceTier param.Field[ResponseNewParamsServiceTier]optional

Specifies the processing type used for serving the request.

  • If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
  • If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
  • If set to 'flex' or 'priority', then the request will be processed with the corresponding service tier.
  • When not set, the default behavior is 'auto'.

When the service_tier parameter is set, the response body will include the service_tier value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

const ResponseNewParamsServiceTierAuto ResponseNewParamsServiceTier = "auto"
const ResponseNewParamsServiceTierDefault ResponseNewParamsServiceTier = "default"
const ResponseNewParamsServiceTierFlex ResponseNewParamsServiceTier = "flex"
const ResponseNewParamsServiceTierScale ResponseNewParamsServiceTier = "scale"
const ResponseNewParamsServiceTierPriority ResponseNewParamsServiceTier = "priority"
Store param.Field[bool]optional

Whether to store the generated model response for later retrieval via API.

StreamOptions param.Field[ResponseNewParamsStreamOptions]optional

Options for streaming responses. Only set this when you set stream: true.

IncludeObfuscation booloptional

When true, stream obfuscation will be enabled. Stream obfuscation adds random characters to an obfuscation field on streaming delta events to normalize payload sizes as a mitigation to certain side-channel attacks. These obfuscation fields are included by default, but add a small amount of overhead to the data stream. You can set include_obfuscation to false to optimize for bandwidth if you trust the network links between your application and the OpenAI API.

Temperature param.Field[float64]optional

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.

minimum0
maximum2
Text param.Field[ResponseTextConfig]optional

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

ToolChoice param.Field[ResponseNewParamsToolChoiceUnion]optional

How the model should select which tool (or tools) to use when generating a response. See the tools parameter to see how to specify which tools the model can call.

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.

Accepts one of the following:
const ToolChoiceOptionsNone ToolChoiceOptions = "none"
const ToolChoiceOptionsAuto ToolChoiceOptions = "auto"
const ToolChoiceOptionsRequired ToolChoiceOptions = "required"
type ToolChoiceAllowed struct{…}

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

Mode ToolChoiceAllowedMode

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

auto allows the model to pick from among the allowed tools and generate a message.

required requires the model to call one or more of the allowed tools.

Accepts one of the following:
const ToolChoiceAllowedModeAuto ToolChoiceAllowedMode = "auto"
const ToolChoiceAllowedModeRequired ToolChoiceAllowedMode = "required"
Tools []map[string, any]

A list of tool definitions that the model should be allowed to call.

For the Responses API, the list of tool definitions might look like:

[
  { "type": "function", "name": "get_weather" },
  { "type": "mcp", "server_label": "deepwiki" },
  { "type": "image_generation" }
]
Type AllowedTools

Allowed tool configuration type. Always allowed_tools.

type ToolChoiceTypes struct{…}

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

Type ToolChoiceTypesType

The type of hosted tool the model should to use. Learn more about built-in tools.

Allowed values are:

  • file_search
  • web_search_preview
  • computer_use_preview
  • code_interpreter
  • image_generation
Accepts one of the following:
const ToolChoiceTypesTypeFileSearch ToolChoiceTypesType = "file_search"
const ToolChoiceTypesTypeWebSearchPreview ToolChoiceTypesType = "web_search_preview"
const ToolChoiceTypesTypeComputerUsePreview ToolChoiceTypesType = "computer_use_preview"
const ToolChoiceTypesTypeWebSearchPreview2025_03_11 ToolChoiceTypesType = "web_search_preview_2025_03_11"
const ToolChoiceTypesTypeImageGeneration ToolChoiceTypesType = "image_generation"
const ToolChoiceTypesTypeCodeInterpreter ToolChoiceTypesType = "code_interpreter"
type ToolChoiceFunction struct{…}

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

Name string

The name of the function to call.

Type Function

For function calling, the type is always function.

type ToolChoiceMcp struct{…}

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

ServerLabel string

The label of the MCP server to use.

Type Mcp

For MCP tools, the type is always mcp.

Name stringoptional

The name of the tool to call on the server.

type ToolChoiceCustom struct{…}

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

Name string

The name of the custom tool to call.

Type Custom

For custom tool calling, the type is always custom.

type ToolChoiceApplyPatch struct{…}

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

Type ApplyPatch

The tool to call. Always apply_patch.

type ToolChoiceShell struct{…}

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

Type Shell

The tool to call. Always shell.

Tools param.Field[[]ToolUnion]optional

An array of tools the model may call while generating a response. You can specify which tool to use by setting the tool_choice parameter.

We support the following categories of tools:

  • Built-in tools: Tools that are provided by OpenAI that extend the model's capabilities, like web search or file search. Learn more about built-in tools.
  • MCP Tools: Integrations with third-party systems via custom MCP servers or predefined connectors such as Google Drive and SharePoint. Learn more about MCP Tools.
  • Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code with strongly typed arguments and outputs. Learn more about function calling. You can also use custom tools to call your own code.
type FunctionTool struct{…}

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

Name string

The name of the function to call.

Parameters map[string, any]

A JSON schema object describing the parameters of the function.

Strict bool

Whether to enforce strict parameter validation. Default true.

Type Function

The type of the function tool. Always function.

Description stringoptional

A description of the function. Used by the model to determine whether or not to call the function.

type FileSearchTool struct{…}

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

Type FileSearch

The type of the file search tool. Always file_search.

VectorStoreIDs []string

The IDs of the vector stores to search.

Filters FileSearchToolFiltersUnionoptional

A filter to apply.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
type CompoundFilter struct{…}

Combine multiple filters using and or or.

Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
Type CompoundFilterType

Type of operation: and or or.

Accepts one of the following:
const CompoundFilterTypeAnd CompoundFilterType = "and"
const CompoundFilterTypeOr CompoundFilterType = "or"
MaxNumResults int64optional

The maximum number of results to return. This number should be between 1 and 50 inclusive.

RankingOptions FileSearchToolRankingOptionsoptional

Ranking options for search.

Ranker stringoptional

The ranker to use for the file search.

Accepts one of the following:
const FileSearchToolRankingOptionsRankerAuto FileSearchToolRankingOptionsRanker = "auto"
const FileSearchToolRankingOptionsRankerDefault2024_11_15 FileSearchToolRankingOptionsRanker = "default-2024-11-15"
ScoreThreshold float64optional

The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.

type ComputerTool struct{…}

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

DisplayHeight int64

The height of the computer display.

DisplayWidth int64

The width of the computer display.

Environment ComputerToolEnvironment

The type of computer environment to control.

Accepts one of the following:
const ComputerToolEnvironmentWindows ComputerToolEnvironment = "windows"
const ComputerToolEnvironmentMac ComputerToolEnvironment = "mac"
const ComputerToolEnvironmentLinux ComputerToolEnvironment = "linux"
const ComputerToolEnvironmentUbuntu ComputerToolEnvironment = "ubuntu"
const ComputerToolEnvironmentBrowser ComputerToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type WebSearchTool struct{…}

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

Type WebSearchToolType

The type of the web search tool. One of web_search or web_search_2025_08_26.

Accepts one of the following:
const WebSearchToolTypeWebSearch WebSearchToolType = "web_search"
const WebSearchToolTypeWebSearch2025_08_26 WebSearchToolType = "web_search_2025_08_26"
Filters WebSearchToolFiltersoptional

Filters for the search.

AllowedDomains []stringoptional

Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.

Example: ["pubmed.ncbi.nlm.nih.gov"]

SearchContextSize WebSearchToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchToolSearchContextSizeLow WebSearchToolSearchContextSize = "low"
const WebSearchToolSearchContextSizeMedium WebSearchToolSearchContextSize = "medium"
const WebSearchToolSearchContextSizeHigh WebSearchToolSearchContextSize = "high"
UserLocation WebSearchToolUserLocationoptional

The approximate location of the user.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

Type stringoptional

The type of location approximation. Always approximate.

type ToolMcp struct{…}

Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.

ServerLabel string

A label for this MCP server, used to identify it in tool calls.

Type Mcp

The type of the MCP tool. Always mcp.

AllowedTools ToolMcpAllowedToolsUnionoptional

List of allowed tool names or a filter object.

Accepts one of the following:
type ToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type ToolMcpAllowedToolsMcpToolFilter struct{…}

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Authorization stringoptional

An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.

ConnectorID stringoptional

Identifier for service connectors, like those available in ChatGPT. One of server_url or connector_id must be provided. Learn more about service connectors here.

Currently supported connector_id values are:

  • Dropbox: connector_dropbox
  • Gmail: connector_gmail
  • Google Calendar: connector_googlecalendar
  • Google Drive: connector_googledrive
  • Microsoft Teams: connector_microsoftteams
  • Outlook Calendar: connector_outlookcalendar
  • Outlook Email: connector_outlookemail
  • SharePoint: connector_sharepoint
Accepts one of the following:
const ToolMcpConnectorIDConnectorDropbox ToolMcpConnectorID = "connector_dropbox"
const ToolMcpConnectorIDConnectorGmail ToolMcpConnectorID = "connector_gmail"
const ToolMcpConnectorIDConnectorGooglecalendar ToolMcpConnectorID = "connector_googlecalendar"
const ToolMcpConnectorIDConnectorGoogledrive ToolMcpConnectorID = "connector_googledrive"
const ToolMcpConnectorIDConnectorMicrosoftteams ToolMcpConnectorID = "connector_microsoftteams"
const ToolMcpConnectorIDConnectorOutlookcalendar ToolMcpConnectorID = "connector_outlookcalendar"
const ToolMcpConnectorIDConnectorOutlookemail ToolMcpConnectorID = "connector_outlookemail"
const ToolMcpConnectorIDConnectorSharepoint ToolMcpConnectorID = "connector_sharepoint"
Headers map[string, string]optional

Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.

RequireApproval ToolMcpRequireApprovalUnionoptional

Specify which of the MCP server's tools require approval.

Accepts one of the following:
type ToolMcpRequireApprovalMcpToolApprovalFilter struct{…}

Specify which of the MCP server's tools require approval. Can be always, never, or a filter object associated with tools that require approval.

Always ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysoptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Never ToolMcpRequireApprovalMcpToolApprovalFilterNeveroptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

type ToolMcpRequireApprovalMcpToolApprovalSetting string

Specify a single approval policy for all tools. One of always or never. When set to always, all tools will require approval. When set to never, all tools will not require approval.

Accepts one of the following:
const ToolMcpRequireApprovalMcpToolApprovalSettingAlways ToolMcpRequireApprovalMcpToolApprovalSetting = "always"
const ToolMcpRequireApprovalMcpToolApprovalSettingNever ToolMcpRequireApprovalMcpToolApprovalSetting = "never"
ServerDescription stringoptional

Optional description of the MCP server, used to provide more context.

ServerURL stringoptional

The URL for the MCP server. One of server_url or connector_id must be provided.

type ToolCodeInterpreter struct{…}

A tool that runs Python code to help generate a response to a prompt.

Container ToolCodeInterpreterContainerUnion

The code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional memory_limit setting.

Accepts one of the following:
string
type ToolCodeInterpreterContainerCodeInterpreterContainerAuto struct{…}

Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

Type Auto

Always auto.

FileIDs []stringoptional

An optional list of uploaded files to make available to your code.

MemoryLimit stringoptional

The memory limit for the code interpreter container.

Accepts one of the following:
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
Type CodeInterpreter

The type of the code interpreter tool. Always code_interpreter.

type ToolImageGeneration struct{…}

A tool that generates images using the GPT image models.

Type ImageGeneration

The type of the image generation tool. Always image_generation.

Action stringoptional

Whether to generate a new image or edit an existing image. Default: auto.

Accepts one of the following:
const ToolImageGenerationActionGenerate ToolImageGenerationAction = "generate"
const ToolImageGenerationActionEdit ToolImageGenerationAction = "edit"
const ToolImageGenerationActionAuto ToolImageGenerationAction = "auto"
Background stringoptional

Background type for the generated image. One of transparent, opaque, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationBackgroundTransparent ToolImageGenerationBackground = "transparent"
const ToolImageGenerationBackgroundOpaque ToolImageGenerationBackground = "opaque"
const ToolImageGenerationBackgroundAuto ToolImageGenerationBackground = "auto"
InputFidelity stringoptional

Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for gpt-image-1 and gpt-image-1.5 and later models, unsupported for gpt-image-1-mini. Supports high and low. Defaults to low.

Accepts one of the following:
const ToolImageGenerationInputFidelityHigh ToolImageGenerationInputFidelity = "high"
const ToolImageGenerationInputFidelityLow ToolImageGenerationInputFidelity = "low"
InputImageMask ToolImageGenerationInputImageMaskoptional

Optional mask for inpainting. Contains image_url (string, optional) and file_id (string, optional).

FileID stringoptional

File ID for the mask image.

ImageURL stringoptional

Base64-encoded mask image.

Model stringoptional

The image generation model to use. Default: gpt-image-1.

Accepts one of the following:
string
string
Accepts one of the following:
const ToolImageGenerationModelGPTImage1 ToolImageGenerationModel = "gpt-image-1"
const ToolImageGenerationModelGPTImage1Mini ToolImageGenerationModel = "gpt-image-1-mini"
const ToolImageGenerationModelGPTImage1_5 ToolImageGenerationModel = "gpt-image-1.5"
Moderation stringoptional

Moderation level for the generated image. Default: auto.

Accepts one of the following:
const ToolImageGenerationModerationAuto ToolImageGenerationModeration = "auto"
const ToolImageGenerationModerationLow ToolImageGenerationModeration = "low"
OutputCompression int64optional

Compression level for the output image. Default: 100.

minimum0
maximum100
OutputFormat stringoptional

The output format of the generated image. One of png, webp, or jpeg. Default: png.

Accepts one of the following:
const ToolImageGenerationOutputFormatPNG ToolImageGenerationOutputFormat = "png"
const ToolImageGenerationOutputFormatWebP ToolImageGenerationOutputFormat = "webp"
const ToolImageGenerationOutputFormatJPEG ToolImageGenerationOutputFormat = "jpeg"
PartialImages int64optional

Number of partial images to generate in streaming mode, from 0 (default value) to 3.

minimum0
maximum3
Quality stringoptional

The quality of the generated image. One of low, medium, high, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationQualityLow ToolImageGenerationQuality = "low"
const ToolImageGenerationQualityMedium ToolImageGenerationQuality = "medium"
const ToolImageGenerationQualityHigh ToolImageGenerationQuality = "high"
const ToolImageGenerationQualityAuto ToolImageGenerationQuality = "auto"
Size stringoptional

The size of the generated image. One of 1024x1024, 1024x1536, 1536x1024, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationSize1024x1024 ToolImageGenerationSize = "1024x1024"
const ToolImageGenerationSize1024x1536 ToolImageGenerationSize = "1024x1536"
const ToolImageGenerationSize1536x1024 ToolImageGenerationSize = "1536x1024"
const ToolImageGenerationSizeAuto ToolImageGenerationSize = "auto"
type ToolLocalShell struct{…}

A tool that allows the model to execute shell commands in a local environment.

Type LocalShell

The type of the local shell tool. Always local_shell.

type FunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

type CustomTool struct{…}

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

Name string

The name of the custom tool, used to identify it in tool calls.

Type Custom

The type of the custom tool. Always custom.

Description stringoptional

Optional description of the custom tool, used to provide more context.

The input format for the custom tool. Default is unconstrained text.

Accepts one of the following:
type CustomToolInputFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

type CustomToolInputFormatGrammar struct{…}

A grammar defined by the user.

Definition string

The grammar definition.

Syntax string

The syntax of the grammar definition. One of lark or regex.

Accepts one of the following:
const CustomToolInputFormatGrammarSyntaxLark CustomToolInputFormatGrammarSyntax = "lark"
const CustomToolInputFormatGrammarSyntaxRegex CustomToolInputFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

type WebSearchPreviewTool struct{…}

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

Type WebSearchPreviewToolType

The type of the web search tool. One of web_search_preview or web_search_preview_2025_03_11.

Accepts one of the following:
const WebSearchPreviewToolTypeWebSearchPreview WebSearchPreviewToolType = "web_search_preview"
const WebSearchPreviewToolTypeWebSearchPreview2025_03_11 WebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContextSize WebSearchPreviewToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchPreviewToolSearchContextSizeLow WebSearchPreviewToolSearchContextSize = "low"
const WebSearchPreviewToolSearchContextSizeMedium WebSearchPreviewToolSearchContextSize = "medium"
const WebSearchPreviewToolSearchContextSizeHigh WebSearchPreviewToolSearchContextSize = "high"
UserLocation WebSearchPreviewToolUserLocationoptional

The user's location.

Type Approximate

The type of location approximation. Always approximate.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

type ApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

TopLogprobs param.Field[int64]optional

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.

minimum0
maximum20
TopP param.Field[float64]optional

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

minimum0
maximum1
Truncation param.Field[ResponseNewParamsTruncation]optional

The truncation strategy to use for the model response.

  • auto: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation.
  • disabled (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.
const ResponseNewParamsTruncationAuto ResponseNewParamsTruncation = "auto"
const ResponseNewParamsTruncationDisabled ResponseNewParamsTruncation = "disabled"
DeprecatedUser param.Field[string]optional

This field is being replaced by safety_identifier and prompt_cache_key. Use prompt_cache_key instead to maintain caching optimizations. A stable identifier for your end-users. Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. Learn more.

ReturnsExpand Collapse
type Response struct{…}
ID string

Unique identifier for this Response.

CreatedAt float64

Unix timestamp (in seconds) of when this Response was created.

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

Code ResponseErrorCode

The error code for the response.

Accepts one of the following:
const ResponseErrorCodeServerError ResponseErrorCode = "server_error"
const ResponseErrorCodeRateLimitExceeded ResponseErrorCode = "rate_limit_exceeded"
const ResponseErrorCodeInvalidPrompt ResponseErrorCode = "invalid_prompt"
const ResponseErrorCodeVectorStoreTimeout ResponseErrorCode = "vector_store_timeout"
const ResponseErrorCodeInvalidImage ResponseErrorCode = "invalid_image"
const ResponseErrorCodeInvalidImageFormat ResponseErrorCode = "invalid_image_format"
const ResponseErrorCodeInvalidBase64Image ResponseErrorCode = "invalid_base64_image"
const ResponseErrorCodeInvalidImageURL ResponseErrorCode = "invalid_image_url"
const ResponseErrorCodeImageTooLarge ResponseErrorCode = "image_too_large"
const ResponseErrorCodeImageTooSmall ResponseErrorCode = "image_too_small"
const ResponseErrorCodeImageParseError ResponseErrorCode = "image_parse_error"
const ResponseErrorCodeImageContentPolicyViolation ResponseErrorCode = "image_content_policy_violation"
const ResponseErrorCodeInvalidImageMode ResponseErrorCode = "invalid_image_mode"
const ResponseErrorCodeImageFileTooLarge ResponseErrorCode = "image_file_too_large"
const ResponseErrorCodeUnsupportedImageMediaType ResponseErrorCode = "unsupported_image_media_type"
const ResponseErrorCodeEmptyImageFile ResponseErrorCode = "empty_image_file"
const ResponseErrorCodeFailedToDownloadImage ResponseErrorCode = "failed_to_download_image"
const ResponseErrorCodeImageFileNotFound ResponseErrorCode = "image_file_not_found"
Message string

A human-readable description of the error.

IncompleteDetails ResponseIncompleteDetails

Details about why the response is incomplete.

Reason stringoptional

The reason why the response is incomplete.

Accepts one of the following:
const ResponseIncompleteDetailsReasonMaxOutputTokens ResponseIncompleteDetailsReason = "max_output_tokens"
const ResponseIncompleteDetailsReasonContentFilter ResponseIncompleteDetailsReason = "content_filter"
Instructions ResponseInstructionsUnion

A system (or developer) message inserted into the model's context.

When using along with previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.

Accepts one of the following:
string
type ResponseInstructionsInputItemList []ResponseInputItemUnion

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

Accepts one of the following:
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.

Content EasyInputMessageContentUnion

Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.

Accepts one of the following:
string
type ResponseInputMessageContentList []ResponseInputContentUnion

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role EasyInputMessageRole

The role of the message input. One of user, assistant, system, or developer.

Accepts one of the following:
const EasyInputMessageRoleUser EasyInputMessageRole = "user"
const EasyInputMessageRoleAssistant EasyInputMessageRole = "assistant"
const EasyInputMessageRoleSystem EasyInputMessageRole = "system"
const EasyInputMessageRoleDeveloper EasyInputMessageRole = "developer"
Type EasyInputMessageTypeoptional

The type of the message input. Always message.

type ResponseInputItemMessage 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.

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role string

The role of the message input. One of user, system, or developer.

Accepts one of the following:
const ResponseInputItemMessageRoleUser ResponseInputItemMessageRole = "user"
const ResponseInputItemMessageRoleSystem ResponseInputItemMessageRole = "system"
const ResponseInputItemMessageRoleDeveloper ResponseInputItemMessageRole = "developer"
Status stringoptional

The status of item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemMessageStatusInProgress ResponseInputItemMessageStatus = "in_progress"
const ResponseInputItemMessageStatusCompleted ResponseInputItemMessageStatus = "completed"
const ResponseInputItemMessageStatusIncomplete ResponseInputItemMessageStatus = "incomplete"
Type stringoptional

The type of the message input. Always set to message.

type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

type ResponseInputItemComputerCallOutput struct{…}

The output of a computer tool call.

CallID string

The ID of the computer tool call that produced the output.

maxLength64
minLength1

A computer screenshot image used with the computer use tool.

Type ComputerScreenshot

Specifies the event type. For a computer screenshot, this property is always set to computer_screenshot.

FileID stringoptional

The identifier of an uploaded file that contains the screenshot.

ImageURL stringoptional

The URL of the screenshot image.

Type ComputerCallOutput

The type of the computer tool call output. Always computer_call_output.

ID stringoptional

The ID of the computer tool call output.

AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckoptional

The safety checks reported by the API that have been acknowledged by the developer.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status stringoptional

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseInputItemComputerCallOutputStatusInProgress ResponseInputItemComputerCallOutputStatus = "in_progress"
const ResponseInputItemComputerCallOutputStatusCompleted ResponseInputItemComputerCallOutputStatus = "completed"
const ResponseInputItemComputerCallOutputStatusIncomplete ResponseInputItemComputerCallOutputStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
type ResponseInputItemFunctionCallOutput struct{…}

The output of a function tool call.

CallID string

The unique ID of the function tool call generated by the model.

maxLength64
minLength1
Output ResponseInputItemFunctionCallOutputOutputUnion

Text, image, or file output of the function tool call.

Accepts one of the following:
string
type ResponseFunctionCallOutputItemList []ResponseFunctionCallOutputItemUnion

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

Accepts one of the following:
type ResponseInputTextContent struct{…}

A text input to the model.

Text string

The text input to the model.

maxLength10485760
Type InputText

The type of the input item. Always input_text.

type ResponseInputImageContent struct{…}

An image input to the model. Learn about image inputs

Type InputImage

The type of the input item. Always input_image.

Detail ResponseInputImageContentDetailoptional

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageContentDetailLow ResponseInputImageContentDetail = "low"
const ResponseInputImageContentDetailHigh ResponseInputImageContentDetail = "high"
const ResponseInputImageContentDetailAuto ResponseInputImageContentDetail = "auto"
FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

maxLength20971520
type ResponseInputFileContent struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The base64-encoded data of the file to be sent to the model.

maxLength33554432
FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type FunctionCallOutput

The type of the function tool call output. Always function_call_output.

ID stringoptional

The unique ID of the function tool call output. Populated when this item is returned via API.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemFunctionCallOutputStatusInProgress ResponseInputItemFunctionCallOutputStatus = "in_progress"
const ResponseInputItemFunctionCallOutputStatusCompleted ResponseInputItemFunctionCallOutputStatus = "completed"
const ResponseInputItemFunctionCallOutputStatusIncomplete ResponseInputItemFunctionCallOutputStatus = "incomplete"
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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItemParamResp struct{…}

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

EncryptedContent string

The encrypted content of the compaction summary.

maxLength10485760
Type Compaction

The type of the item. Always compaction.

ID stringoptional

The ID of the compaction item.

type ResponseInputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseInputItemImageGenerationCallStatusInProgress ResponseInputItemImageGenerationCallStatus = "in_progress"
const ResponseInputItemImageGenerationCallStatusCompleted ResponseInputItemImageGenerationCallStatus = "completed"
const ResponseInputItemImageGenerationCallStatusGenerating ResponseInputItemImageGenerationCallStatus = "generating"
const ResponseInputItemImageGenerationCallStatusFailed ResponseInputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseInputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseInputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseInputItemLocalShellCallStatusInProgress ResponseInputItemLocalShellCallStatus = "in_progress"
const ResponseInputItemLocalShellCallStatusCompleted ResponseInputItemLocalShellCallStatus = "completed"
const ResponseInputItemLocalShellCallStatusIncomplete ResponseInputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseInputItemLocalShellCallOutput struct{…}

The output of a local shell tool call.

ID string

The unique ID of the local shell tool call generated by the model.

Output string

A JSON string of the output of the local shell tool call.

Type LocalShellCallOutput

The type of the local shell tool call output. Always local_shell_call_output.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemLocalShellCallOutputStatusInProgress ResponseInputItemLocalShellCallOutputStatus = "in_progress"
const ResponseInputItemLocalShellCallOutputStatusCompleted ResponseInputItemLocalShellCallOutputStatus = "completed"
const ResponseInputItemLocalShellCallOutputStatusIncomplete ResponseInputItemLocalShellCallOutputStatus = "incomplete"
type ResponseInputItemShellCall struct{…}

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

Action ResponseInputItemShellCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string

Ordered shell commands for the execution environment to run.

MaxOutputLength int64optional

Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

TimeoutMs int64optional

Maximum wall-clock time in milliseconds to allow the shell commands to run.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1
Type ShellCall

The type of the item. Always shell_call.

ID stringoptional

The unique ID of the shell tool call. Populated when this item is returned via API.

Status stringoptional

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemShellCallStatusInProgress ResponseInputItemShellCallStatus = "in_progress"
const ResponseInputItemShellCallStatusCompleted ResponseInputItemShellCallStatus = "completed"
const ResponseInputItemShellCallStatusIncomplete ResponseInputItemShellCallStatus = "incomplete"
type ResponseInputItemShellCallOutput struct{…}

The streamed output items emitted by a shell tool call.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1

Captured chunks of stdout and stderr output, along with their associated outcomes.

Outcome ResponseFunctionShellCallOutputContentOutcomeUnion

The exit or timeout outcome associated with this shell call.

Accepts one of the following:
type ResponseFunctionShellCallOutputContentOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellCallOutputContentOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

The exit code returned by the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

Captured stderr output for the shell call.

maxLength10485760
Stdout string

Captured stdout output for the shell call.

maxLength10485760
Type ShellCallOutput

The type of the item. Always shell_call_output.

ID stringoptional

The unique ID of the shell tool call output. Populated when this item is returned via API.

MaxOutputLength int64optional

The maximum number of UTF-8 characters captured for this shell call's combined output.

Status stringoptional

The status of the shell call output.

Accepts one of the following:
const ResponseInputItemShellCallOutputStatusInProgress ResponseInputItemShellCallOutputStatus = "in_progress"
const ResponseInputItemShellCallOutputStatusCompleted ResponseInputItemShellCallOutputStatus = "completed"
const ResponseInputItemShellCallOutputStatusIncomplete ResponseInputItemShellCallOutputStatus = "incomplete"
type ResponseInputItemApplyPatchCall struct{…}

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

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Operation ResponseInputItemApplyPatchCallOperationUnion

The specific create, delete, or update instruction for the apply_patch tool call.

Accepts one of the following:
type ResponseInputItemApplyPatchCallOperationCreateFile struct{…}

Instruction for creating a new file via the apply_patch tool.

Diff string

Unified diff content to apply when creating the file.

maxLength10485760
Path string

Path of the file to create relative to the workspace root.

minLength1
Type CreateFile

The operation type. Always create_file.

type ResponseInputItemApplyPatchCallOperationDeleteFile struct{…}

Instruction for deleting an existing file via the apply_patch tool.

Path string

Path of the file to delete relative to the workspace root.

minLength1
Type DeleteFile

The operation type. Always delete_file.

type ResponseInputItemApplyPatchCallOperationUpdateFile struct{…}

Instruction for updating an existing file via the apply_patch tool.

Diff string

Unified diff content to apply to the existing file.

maxLength10485760
Path string

Path of the file to update relative to the workspace root.

minLength1
Type UpdateFile

The operation type. Always update_file.

Status string

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallStatusInProgress ResponseInputItemApplyPatchCallStatus = "in_progress"
const ResponseInputItemApplyPatchCallStatusCompleted ResponseInputItemApplyPatchCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

ID stringoptional

The unique ID of the apply patch tool call. Populated when this item is returned via API.

type ResponseInputItemApplyPatchCallOutput struct{…}

The streamed output emitted by an apply patch tool call.

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Status string

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallOutputStatusCompleted ResponseInputItemApplyPatchCallOutputStatus = "completed"
const ResponseInputItemApplyPatchCallOutputStatusFailed ResponseInputItemApplyPatchCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

ID stringoptional

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

Output stringoptional

Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

maxLength10485760
type ResponseInputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseInputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseInputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseInputItemMcpApprovalResponse struct{…}

A response to an MCP approval request.

ApprovalRequestID string

The ID of the approval request being answered.

Approve bool

Whether the request was approved.

Type McpApprovalResponse

The type of the item. Always mcp_approval_response.

ID stringoptional

The unique ID of the approval response

Reason stringoptional

Optional reason for the decision.

type ResponseInputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseInputItemMcpCallStatusInProgress ResponseInputItemMcpCallStatus = "in_progress"
const ResponseInputItemMcpCallStatusCompleted ResponseInputItemMcpCallStatus = "completed"
const ResponseInputItemMcpCallStatusIncomplete ResponseInputItemMcpCallStatus = "incomplete"
const ResponseInputItemMcpCallStatusCalling ResponseInputItemMcpCallStatus = "calling"
const ResponseInputItemMcpCallStatusFailed ResponseInputItemMcpCallStatus = "failed"
type ResponseCustomToolCallOutput struct{…}

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

CallID string

The call ID, used to map this custom tool call output to a custom tool call.

Output ResponseCustomToolCallOutputOutputUnion

The output from the custom tool call generated by your code. Can be a string or an list of output content.

Accepts one of the following:
string
type ResponseCustomToolCallOutputOutputOutputContentList []ResponseCustomToolCallOutputOutputOutputContentListItemUnion

Text, image, or file output of the custom tool call.

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type CustomToolCallOutput

The type of the custom tool call output. Always custom_tool_call_output.

ID stringoptional

The unique ID of the custom tool call output in the OpenAI platform.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

type ResponseInputItemItemReference struct{…}

An internal identifier for an item to reference.

ID string

The ID of the item to reference.

Type stringoptional

The type of item to reference. Always item_reference.

Metadata Metadata

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Model ResponsesModel

Model ID used to generate the response, like gpt-4o or o3. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.

Accepts one of the following:
string
type ChatModel string
Accepts one of the following:
const ChatModelGPT5_2 ChatModel = "gpt-5.2"
const ChatModelGPT5_2_2025_12_11 ChatModel = "gpt-5.2-2025-12-11"
const ChatModelGPT5_2ChatLatest ChatModel = "gpt-5.2-chat-latest"
const ChatModelGPT5_2Pro ChatModel = "gpt-5.2-pro"
const ChatModelGPT5_2Pro2025_12_11 ChatModel = "gpt-5.2-pro-2025-12-11"
const ChatModelGPT5_1 ChatModel = "gpt-5.1"
const ChatModelGPT5_1_2025_11_13 ChatModel = "gpt-5.1-2025-11-13"
const ChatModelGPT5_1Codex ChatModel = "gpt-5.1-codex"
const ChatModelGPT5_1Mini ChatModel = "gpt-5.1-mini"
const ChatModelGPT5_1ChatLatest ChatModel = "gpt-5.1-chat-latest"
const ChatModelGPT5 ChatModel = "gpt-5"
const ChatModelGPT5Mini ChatModel = "gpt-5-mini"
const ChatModelGPT5Nano ChatModel = "gpt-5-nano"
const ChatModelGPT5_2025_08_07 ChatModel = "gpt-5-2025-08-07"
const ChatModelGPT5Mini2025_08_07 ChatModel = "gpt-5-mini-2025-08-07"
const ChatModelGPT5Nano2025_08_07 ChatModel = "gpt-5-nano-2025-08-07"
const ChatModelGPT5ChatLatest ChatModel = "gpt-5-chat-latest"
const ChatModelGPT4_1 ChatModel = "gpt-4.1"
const ChatModelGPT4_1Mini ChatModel = "gpt-4.1-mini"
const ChatModelGPT4_1Nano ChatModel = "gpt-4.1-nano"
const ChatModelGPT4_1_2025_04_14 ChatModel = "gpt-4.1-2025-04-14"
const ChatModelGPT4_1Mini2025_04_14 ChatModel = "gpt-4.1-mini-2025-04-14"
const ChatModelGPT4_1Nano2025_04_14 ChatModel = "gpt-4.1-nano-2025-04-14"
const ChatModelO4Mini ChatModel = "o4-mini"
const ChatModelO4Mini2025_04_16 ChatModel = "o4-mini-2025-04-16"
const ChatModelO3 ChatModel = "o3"
const ChatModelO3_2025_04_16 ChatModel = "o3-2025-04-16"
const ChatModelO3Mini ChatModel = "o3-mini"
const ChatModelO3Mini2025_01_31 ChatModel = "o3-mini-2025-01-31"
const ChatModelO1 ChatModel = "o1"
const ChatModelO1_2024_12_17 ChatModel = "o1-2024-12-17"
const ChatModelO1Preview ChatModel = "o1-preview"
const ChatModelO1Preview2024_09_12 ChatModel = "o1-preview-2024-09-12"
const ChatModelO1Mini ChatModel = "o1-mini"
const ChatModelO1Mini2024_09_12 ChatModel = "o1-mini-2024-09-12"
const ChatModelGPT4o ChatModel = "gpt-4o"
const ChatModelGPT4o2024_11_20 ChatModel = "gpt-4o-2024-11-20"
const ChatModelGPT4o2024_08_06 ChatModel = "gpt-4o-2024-08-06"
const ChatModelGPT4o2024_05_13 ChatModel = "gpt-4o-2024-05-13"
const ChatModelGPT4oAudioPreview ChatModel = "gpt-4o-audio-preview"
const ChatModelGPT4oAudioPreview2024_10_01 ChatModel = "gpt-4o-audio-preview-2024-10-01"
const ChatModelGPT4oAudioPreview2024_12_17 ChatModel = "gpt-4o-audio-preview-2024-12-17"
const ChatModelGPT4oAudioPreview2025_06_03 ChatModel = "gpt-4o-audio-preview-2025-06-03"
const ChatModelGPT4oMiniAudioPreview ChatModel = "gpt-4o-mini-audio-preview"
const ChatModelGPT4oMiniAudioPreview2024_12_17 ChatModel = "gpt-4o-mini-audio-preview-2024-12-17"
const ChatModelGPT4oSearchPreview ChatModel = "gpt-4o-search-preview"
const ChatModelGPT4oMiniSearchPreview ChatModel = "gpt-4o-mini-search-preview"
const ChatModelGPT4oSearchPreview2025_03_11 ChatModel = "gpt-4o-search-preview-2025-03-11"
const ChatModelGPT4oMiniSearchPreview2025_03_11 ChatModel = "gpt-4o-mini-search-preview-2025-03-11"
const ChatModelChatgpt4oLatest ChatModel = "chatgpt-4o-latest"
const ChatModelCodexMiniLatest ChatModel = "codex-mini-latest"
const ChatModelGPT4oMini ChatModel = "gpt-4o-mini"
const ChatModelGPT4oMini2024_07_18 ChatModel = "gpt-4o-mini-2024-07-18"
const ChatModelGPT4Turbo ChatModel = "gpt-4-turbo"
const ChatModelGPT4Turbo2024_04_09 ChatModel = "gpt-4-turbo-2024-04-09"
const ChatModelGPT4_0125Preview ChatModel = "gpt-4-0125-preview"
const ChatModelGPT4TurboPreview ChatModel = "gpt-4-turbo-preview"
const ChatModelGPT4_1106Preview ChatModel = "gpt-4-1106-preview"
const ChatModelGPT4VisionPreview ChatModel = "gpt-4-vision-preview"
const ChatModelGPT4 ChatModel = "gpt-4"
const ChatModelGPT4_0314 ChatModel = "gpt-4-0314"
const ChatModelGPT4_0613 ChatModel = "gpt-4-0613"
const ChatModelGPT4_32k ChatModel = "gpt-4-32k"
const ChatModelGPT4_32k0314 ChatModel = "gpt-4-32k-0314"
const ChatModelGPT4_32k0613 ChatModel = "gpt-4-32k-0613"
const ChatModelGPT3_5Turbo ChatModel = "gpt-3.5-turbo"
const ChatModelGPT3_5Turbo16k ChatModel = "gpt-3.5-turbo-16k"
const ChatModelGPT3_5Turbo0301 ChatModel = "gpt-3.5-turbo-0301"
const ChatModelGPT3_5Turbo0613 ChatModel = "gpt-3.5-turbo-0613"
const ChatModelGPT3_5Turbo1106 ChatModel = "gpt-3.5-turbo-1106"
const ChatModelGPT3_5Turbo0125 ChatModel = "gpt-3.5-turbo-0125"
const ChatModelGPT3_5Turbo16k0613 ChatModel = "gpt-3.5-turbo-16k-0613"
type ResponsesModel string
Accepts one of the following:
const ResponsesModelO1Pro ResponsesModel = "o1-pro"
const ResponsesModelO1Pro2025_03_19 ResponsesModel = "o1-pro-2025-03-19"
const ResponsesModelO3Pro ResponsesModel = "o3-pro"
const ResponsesModelO3Pro2025_06_10 ResponsesModel = "o3-pro-2025-06-10"
const ResponsesModelO3DeepResearch ResponsesModel = "o3-deep-research"
const ResponsesModelO3DeepResearch2025_06_26 ResponsesModel = "o3-deep-research-2025-06-26"
const ResponsesModelO4MiniDeepResearch ResponsesModel = "o4-mini-deep-research"
const ResponsesModelO4MiniDeepResearch2025_06_26 ResponsesModel = "o4-mini-deep-research-2025-06-26"
const ResponsesModelComputerUsePreview ResponsesModel = "computer-use-preview"
const ResponsesModelComputerUsePreview2025_03_11 ResponsesModel = "computer-use-preview-2025-03-11"
const ResponsesModelGPT5Codex ResponsesModel = "gpt-5-codex"
const ResponsesModelGPT5Pro ResponsesModel = "gpt-5-pro"
const ResponsesModelGPT5Pro2025_10_06 ResponsesModel = "gpt-5-pro-2025-10-06"
const ResponsesModelGPT5_1CodexMax ResponsesModel = "gpt-5.1-codex-max"
Object Response

The object type of this resource - always set to response.

An array of content items generated by the model.

  • The length and order of items in the output array is dependent on the model's response.
  • Rather than accessing the first item in the output array and assuming it's an assistant message with the content generated by the model, you might consider using the output_text property where supported in SDKs.
Accepts one of the following:
type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItem struct{…}

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

ID string

The unique ID of the compaction item.

EncryptedContent string

The encrypted content that was produced by compaction.

Type Compaction

The type of the item. Always compaction.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseOutputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseOutputItemImageGenerationCallStatusInProgress ResponseOutputItemImageGenerationCallStatus = "in_progress"
const ResponseOutputItemImageGenerationCallStatusCompleted ResponseOutputItemImageGenerationCallStatus = "completed"
const ResponseOutputItemImageGenerationCallStatusGenerating ResponseOutputItemImageGenerationCallStatus = "generating"
const ResponseOutputItemImageGenerationCallStatusFailed ResponseOutputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseOutputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseOutputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseOutputItemLocalShellCallStatusInProgress ResponseOutputItemLocalShellCallStatus = "in_progress"
const ResponseOutputItemLocalShellCallStatusCompleted ResponseOutputItemLocalShellCallStatus = "completed"
const ResponseOutputItemLocalShellCallStatusIncomplete ResponseOutputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseFunctionShellToolCall struct{…}

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

ID string

The unique ID of the shell tool call. Populated when this item is returned via API.

Action ResponseFunctionShellToolCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string
MaxOutputLength int64

Optional maximum number of characters to return from each command.

TimeoutMs int64

Optional timeout in milliseconds for the commands.

CallID string

The unique ID of the shell tool call generated by the model.

Status ResponseFunctionShellToolCallStatus

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallStatusInProgress ResponseFunctionShellToolCallStatus = "in_progress"
const ResponseFunctionShellToolCallStatusCompleted ResponseFunctionShellToolCallStatus = "completed"
const ResponseFunctionShellToolCallStatusIncomplete ResponseFunctionShellToolCallStatus = "incomplete"
Type ShellCall

The type of the item. Always shell_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseFunctionShellToolCallOutput struct{…}

The output of a shell tool call that was emitted.

ID string

The unique ID of the shell call output. Populated when this item is returned via API.

CallID string

The unique ID of the shell tool call generated by the model.

MaxOutputLength int64

The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output.

Output []ResponseFunctionShellToolCallOutputOutput

An array of shell call output contents

Outcome ResponseFunctionShellToolCallOutputOutputOutcomeUnion

Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

Accepts one of the following:
type ResponseFunctionShellToolCallOutputOutputOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellToolCallOutputOutputOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

Exit code from the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

The standard error output that was captured.

Stdout string

The standard output that was captured.

CreatedBy stringoptional

The identifier of the actor that created the item.

Status ResponseFunctionShellToolCallOutputStatus

The status of the shell call output. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallOutputStatusInProgress ResponseFunctionShellToolCallOutputStatus = "in_progress"
const ResponseFunctionShellToolCallOutputStatusCompleted ResponseFunctionShellToolCallOutputStatus = "completed"
const ResponseFunctionShellToolCallOutputStatusIncomplete ResponseFunctionShellToolCallOutputStatus = "incomplete"
Type ShellCallOutput

The type of the shell call output. Always shell_call_output.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseApplyPatchToolCall struct{…}

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

ID string

The unique ID of the apply patch tool call. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Operation ResponseApplyPatchToolCallOperationUnion

One of the create_file, delete_file, or update_file operations applied via apply_patch.

Accepts one of the following:
type ResponseApplyPatchToolCallOperationCreateFile struct{…}

Instruction describing how to create a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to create.

Type CreateFile

Create a new file with the provided diff.

type ResponseApplyPatchToolCallOperationDeleteFile struct{…}

Instruction describing how to delete a file via the apply_patch tool.

Path string

Path of the file to delete.

Type DeleteFile

Delete the specified file.

type ResponseApplyPatchToolCallOperationUpdateFile struct{…}

Instruction describing how to update a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to update.

Type UpdateFile

Update an existing file with the provided diff.

Status ResponseApplyPatchToolCallStatus

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseApplyPatchToolCallStatusInProgress ResponseApplyPatchToolCallStatus = "in_progress"
const ResponseApplyPatchToolCallStatusCompleted ResponseApplyPatchToolCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseApplyPatchToolCallOutput struct{…}

The output emitted by an apply patch tool call.

ID string

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Status ResponseApplyPatchToolCallOutputStatus

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseApplyPatchToolCallOutputStatusCompleted ResponseApplyPatchToolCallOutputStatus = "completed"
const ResponseApplyPatchToolCallOutputStatusFailed ResponseApplyPatchToolCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

CreatedBy stringoptional

The ID of the entity that created this tool call output.

Output stringoptional

Optional textual output returned by the apply patch tool.

type ResponseOutputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseOutputItemMcpCallStatusInProgress ResponseOutputItemMcpCallStatus = "in_progress"
const ResponseOutputItemMcpCallStatusCompleted ResponseOutputItemMcpCallStatus = "completed"
const ResponseOutputItemMcpCallStatusIncomplete ResponseOutputItemMcpCallStatus = "incomplete"
const ResponseOutputItemMcpCallStatusCalling ResponseOutputItemMcpCallStatus = "calling"
const ResponseOutputItemMcpCallStatusFailed ResponseOutputItemMcpCallStatus = "failed"
type ResponseOutputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseOutputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseOutputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

ParallelToolCalls bool

Whether to allow the model to run tool calls in parallel.

Temperature float64

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.

minimum0
maximum2
ToolChoice ResponseToolChoiceUnion

How the model should select which tool (or tools) to use when generating a response. See the tools parameter to see how to specify which tools the model can call.

Accepts one of the following:
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.

Accepts one of the following:
const ToolChoiceOptionsNone ToolChoiceOptions = "none"
const ToolChoiceOptionsAuto ToolChoiceOptions = "auto"
const ToolChoiceOptionsRequired ToolChoiceOptions = "required"
type ToolChoiceAllowed struct{…}

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

Mode ToolChoiceAllowedMode

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

auto allows the model to pick from among the allowed tools and generate a message.

required requires the model to call one or more of the allowed tools.

Accepts one of the following:
const ToolChoiceAllowedModeAuto ToolChoiceAllowedMode = "auto"
const ToolChoiceAllowedModeRequired ToolChoiceAllowedMode = "required"
Tools []map[string, any]

A list of tool definitions that the model should be allowed to call.

For the Responses API, the list of tool definitions might look like:

[
  { "type": "function", "name": "get_weather" },
  { "type": "mcp", "server_label": "deepwiki" },
  { "type": "image_generation" }
]
Type AllowedTools

Allowed tool configuration type. Always allowed_tools.

type ToolChoiceTypes struct{…}

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

Type ToolChoiceTypesType

The type of hosted tool the model should to use. Learn more about built-in tools.

Allowed values are:

  • file_search
  • web_search_preview
  • computer_use_preview
  • code_interpreter
  • image_generation
Accepts one of the following:
const ToolChoiceTypesTypeFileSearch ToolChoiceTypesType = "file_search"
const ToolChoiceTypesTypeWebSearchPreview ToolChoiceTypesType = "web_search_preview"
const ToolChoiceTypesTypeComputerUsePreview ToolChoiceTypesType = "computer_use_preview"
const ToolChoiceTypesTypeWebSearchPreview2025_03_11 ToolChoiceTypesType = "web_search_preview_2025_03_11"
const ToolChoiceTypesTypeImageGeneration ToolChoiceTypesType = "image_generation"
const ToolChoiceTypesTypeCodeInterpreter ToolChoiceTypesType = "code_interpreter"
type ToolChoiceFunction struct{…}

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

Name string

The name of the function to call.

Type Function

For function calling, the type is always function.

type ToolChoiceMcp struct{…}

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

ServerLabel string

The label of the MCP server to use.

Type Mcp

For MCP tools, the type is always mcp.

Name stringoptional

The name of the tool to call on the server.

type ToolChoiceCustom struct{…}

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

Name string

The name of the custom tool to call.

Type Custom

For custom tool calling, the type is always custom.

type ToolChoiceApplyPatch struct{…}

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

Type ApplyPatch

The tool to call. Always apply_patch.

type ToolChoiceShell struct{…}

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

Type Shell

The tool to call. Always shell.

Tools []ToolUnion

An array of tools the model may call while generating a response. You can specify which tool to use by setting the tool_choice parameter.

We support the following categories of tools:

  • Built-in tools: Tools that are provided by OpenAI that extend the model's capabilities, like web search or file search. Learn more about built-in tools.
  • MCP Tools: Integrations with third-party systems via custom MCP servers or predefined connectors such as Google Drive and SharePoint. Learn more about MCP Tools.
  • Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code with strongly typed arguments and outputs. Learn more about function calling. You can also use custom tools to call your own code.
Accepts one of the following:
type FunctionTool struct{…}

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

Name string

The name of the function to call.

Parameters map[string, any]

A JSON schema object describing the parameters of the function.

Strict bool

Whether to enforce strict parameter validation. Default true.

Type Function

The type of the function tool. Always function.

Description stringoptional

A description of the function. Used by the model to determine whether or not to call the function.

type FileSearchTool struct{…}

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

Type FileSearch

The type of the file search tool. Always file_search.

VectorStoreIDs []string

The IDs of the vector stores to search.

Filters FileSearchToolFiltersUnionoptional

A filter to apply.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
type CompoundFilter struct{…}

Combine multiple filters using and or or.

Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
Type CompoundFilterType

Type of operation: and or or.

Accepts one of the following:
const CompoundFilterTypeAnd CompoundFilterType = "and"
const CompoundFilterTypeOr CompoundFilterType = "or"
MaxNumResults int64optional

The maximum number of results to return. This number should be between 1 and 50 inclusive.

RankingOptions FileSearchToolRankingOptionsoptional

Ranking options for search.

Ranker stringoptional

The ranker to use for the file search.

Accepts one of the following:
const FileSearchToolRankingOptionsRankerAuto FileSearchToolRankingOptionsRanker = "auto"
const FileSearchToolRankingOptionsRankerDefault2024_11_15 FileSearchToolRankingOptionsRanker = "default-2024-11-15"
ScoreThreshold float64optional

The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.

type ComputerTool struct{…}

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

DisplayHeight int64

The height of the computer display.

DisplayWidth int64

The width of the computer display.

Environment ComputerToolEnvironment

The type of computer environment to control.

Accepts one of the following:
const ComputerToolEnvironmentWindows ComputerToolEnvironment = "windows"
const ComputerToolEnvironmentMac ComputerToolEnvironment = "mac"
const ComputerToolEnvironmentLinux ComputerToolEnvironment = "linux"
const ComputerToolEnvironmentUbuntu ComputerToolEnvironment = "ubuntu"
const ComputerToolEnvironmentBrowser ComputerToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type WebSearchTool struct{…}

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

Type WebSearchToolType

The type of the web search tool. One of web_search or web_search_2025_08_26.

Accepts one of the following:
const WebSearchToolTypeWebSearch WebSearchToolType = "web_search"
const WebSearchToolTypeWebSearch2025_08_26 WebSearchToolType = "web_search_2025_08_26"
Filters WebSearchToolFiltersoptional

Filters for the search.

AllowedDomains []stringoptional

Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.

Example: ["pubmed.ncbi.nlm.nih.gov"]

SearchContextSize WebSearchToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchToolSearchContextSizeLow WebSearchToolSearchContextSize = "low"
const WebSearchToolSearchContextSizeMedium WebSearchToolSearchContextSize = "medium"
const WebSearchToolSearchContextSizeHigh WebSearchToolSearchContextSize = "high"
UserLocation WebSearchToolUserLocationoptional

The approximate location of the user.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

Type stringoptional

The type of location approximation. Always approximate.

type ToolMcp struct{…}

Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.

ServerLabel string

A label for this MCP server, used to identify it in tool calls.

Type Mcp

The type of the MCP tool. Always mcp.

AllowedTools ToolMcpAllowedToolsUnionoptional

List of allowed tool names or a filter object.

Accepts one of the following:
type ToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type ToolMcpAllowedToolsMcpToolFilter struct{…}

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Authorization stringoptional

An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.

ConnectorID stringoptional

Identifier for service connectors, like those available in ChatGPT. One of server_url or connector_id must be provided. Learn more about service connectors here.

Currently supported connector_id values are:

  • Dropbox: connector_dropbox
  • Gmail: connector_gmail
  • Google Calendar: connector_googlecalendar
  • Google Drive: connector_googledrive
  • Microsoft Teams: connector_microsoftteams
  • Outlook Calendar: connector_outlookcalendar
  • Outlook Email: connector_outlookemail
  • SharePoint: connector_sharepoint
Accepts one of the following:
const ToolMcpConnectorIDConnectorDropbox ToolMcpConnectorID = "connector_dropbox"
const ToolMcpConnectorIDConnectorGmail ToolMcpConnectorID = "connector_gmail"
const ToolMcpConnectorIDConnectorGooglecalendar ToolMcpConnectorID = "connector_googlecalendar"
const ToolMcpConnectorIDConnectorGoogledrive ToolMcpConnectorID = "connector_googledrive"
const ToolMcpConnectorIDConnectorMicrosoftteams ToolMcpConnectorID = "connector_microsoftteams"
const ToolMcpConnectorIDConnectorOutlookcalendar ToolMcpConnectorID = "connector_outlookcalendar"
const ToolMcpConnectorIDConnectorOutlookemail ToolMcpConnectorID = "connector_outlookemail"
const ToolMcpConnectorIDConnectorSharepoint ToolMcpConnectorID = "connector_sharepoint"
Headers map[string, string]optional

Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.

RequireApproval ToolMcpRequireApprovalUnionoptional

Specify which of the MCP server's tools require approval.

Accepts one of the following:
type ToolMcpRequireApprovalMcpToolApprovalFilter struct{…}

Specify which of the MCP server's tools require approval. Can be always, never, or a filter object associated with tools that require approval.

Always ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysoptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Never ToolMcpRequireApprovalMcpToolApprovalFilterNeveroptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

type ToolMcpRequireApprovalMcpToolApprovalSetting string

Specify a single approval policy for all tools. One of always or never. When set to always, all tools will require approval. When set to never, all tools will not require approval.

Accepts one of the following:
const ToolMcpRequireApprovalMcpToolApprovalSettingAlways ToolMcpRequireApprovalMcpToolApprovalSetting = "always"
const ToolMcpRequireApprovalMcpToolApprovalSettingNever ToolMcpRequireApprovalMcpToolApprovalSetting = "never"
ServerDescription stringoptional

Optional description of the MCP server, used to provide more context.

ServerURL stringoptional

The URL for the MCP server. One of server_url or connector_id must be provided.

type ToolCodeInterpreter struct{…}

A tool that runs Python code to help generate a response to a prompt.

Container ToolCodeInterpreterContainerUnion

The code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional memory_limit setting.

Accepts one of the following:
string
type ToolCodeInterpreterContainerCodeInterpreterContainerAuto struct{…}

Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

Type Auto

Always auto.

FileIDs []stringoptional

An optional list of uploaded files to make available to your code.

MemoryLimit stringoptional

The memory limit for the code interpreter container.

Accepts one of the following:
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
Type CodeInterpreter

The type of the code interpreter tool. Always code_interpreter.

type ToolImageGeneration struct{…}

A tool that generates images using the GPT image models.

Type ImageGeneration

The type of the image generation tool. Always image_generation.

Action stringoptional

Whether to generate a new image or edit an existing image. Default: auto.

Accepts one of the following:
const ToolImageGenerationActionGenerate ToolImageGenerationAction = "generate"
const ToolImageGenerationActionEdit ToolImageGenerationAction = "edit"
const ToolImageGenerationActionAuto ToolImageGenerationAction = "auto"
Background stringoptional

Background type for the generated image. One of transparent, opaque, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationBackgroundTransparent ToolImageGenerationBackground = "transparent"
const ToolImageGenerationBackgroundOpaque ToolImageGenerationBackground = "opaque"
const ToolImageGenerationBackgroundAuto ToolImageGenerationBackground = "auto"
InputFidelity stringoptional

Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for gpt-image-1 and gpt-image-1.5 and later models, unsupported for gpt-image-1-mini. Supports high and low. Defaults to low.

Accepts one of the following:
const ToolImageGenerationInputFidelityHigh ToolImageGenerationInputFidelity = "high"
const ToolImageGenerationInputFidelityLow ToolImageGenerationInputFidelity = "low"
InputImageMask ToolImageGenerationInputImageMaskoptional

Optional mask for inpainting. Contains image_url (string, optional) and file_id (string, optional).

FileID stringoptional

File ID for the mask image.

ImageURL stringoptional

Base64-encoded mask image.

Model stringoptional

The image generation model to use. Default: gpt-image-1.

Accepts one of the following:
string
string
Accepts one of the following:
const ToolImageGenerationModelGPTImage1 ToolImageGenerationModel = "gpt-image-1"
const ToolImageGenerationModelGPTImage1Mini ToolImageGenerationModel = "gpt-image-1-mini"
const ToolImageGenerationModelGPTImage1_5 ToolImageGenerationModel = "gpt-image-1.5"
Moderation stringoptional

Moderation level for the generated image. Default: auto.

Accepts one of the following:
const ToolImageGenerationModerationAuto ToolImageGenerationModeration = "auto"
const ToolImageGenerationModerationLow ToolImageGenerationModeration = "low"
OutputCompression int64optional

Compression level for the output image. Default: 100.

minimum0
maximum100
OutputFormat stringoptional

The output format of the generated image. One of png, webp, or jpeg. Default: png.

Accepts one of the following:
const ToolImageGenerationOutputFormatPNG ToolImageGenerationOutputFormat = "png"
const ToolImageGenerationOutputFormatWebP ToolImageGenerationOutputFormat = "webp"
const ToolImageGenerationOutputFormatJPEG ToolImageGenerationOutputFormat = "jpeg"
PartialImages int64optional

Number of partial images to generate in streaming mode, from 0 (default value) to 3.

minimum0
maximum3
Quality stringoptional

The quality of the generated image. One of low, medium, high, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationQualityLow ToolImageGenerationQuality = "low"
const ToolImageGenerationQualityMedium ToolImageGenerationQuality = "medium"
const ToolImageGenerationQualityHigh ToolImageGenerationQuality = "high"
const ToolImageGenerationQualityAuto ToolImageGenerationQuality = "auto"
Size stringoptional

The size of the generated image. One of 1024x1024, 1024x1536, 1536x1024, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationSize1024x1024 ToolImageGenerationSize = "1024x1024"
const ToolImageGenerationSize1024x1536 ToolImageGenerationSize = "1024x1536"
const ToolImageGenerationSize1536x1024 ToolImageGenerationSize = "1536x1024"
const ToolImageGenerationSizeAuto ToolImageGenerationSize = "auto"
type ToolLocalShell struct{…}

A tool that allows the model to execute shell commands in a local environment.

Type LocalShell

The type of the local shell tool. Always local_shell.

type FunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

type CustomTool struct{…}

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

Name string

The name of the custom tool, used to identify it in tool calls.

Type Custom

The type of the custom tool. Always custom.

Description stringoptional

Optional description of the custom tool, used to provide more context.

The input format for the custom tool. Default is unconstrained text.

Accepts one of the following:
type CustomToolInputFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

type CustomToolInputFormatGrammar struct{…}

A grammar defined by the user.

Definition string

The grammar definition.

Syntax string

The syntax of the grammar definition. One of lark or regex.

Accepts one of the following:
const CustomToolInputFormatGrammarSyntaxLark CustomToolInputFormatGrammarSyntax = "lark"
const CustomToolInputFormatGrammarSyntaxRegex CustomToolInputFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

type WebSearchPreviewTool struct{…}

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

Type WebSearchPreviewToolType

The type of the web search tool. One of web_search_preview or web_search_preview_2025_03_11.

Accepts one of the following:
const WebSearchPreviewToolTypeWebSearchPreview WebSearchPreviewToolType = "web_search_preview"
const WebSearchPreviewToolTypeWebSearchPreview2025_03_11 WebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContextSize WebSearchPreviewToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchPreviewToolSearchContextSizeLow WebSearchPreviewToolSearchContextSize = "low"
const WebSearchPreviewToolSearchContextSizeMedium WebSearchPreviewToolSearchContextSize = "medium"
const WebSearchPreviewToolSearchContextSizeHigh WebSearchPreviewToolSearchContextSize = "high"
UserLocation WebSearchPreviewToolUserLocationoptional

The user's location.

Type Approximate

The type of location approximation. Always approximate.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

type ApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

TopP float64

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

minimum0
maximum1
Background booloptional

Whether to run the model response in the background. Learn more.

CompletedAt float64optional

Unix timestamp (in seconds) of when this Response was completed. Only present when the status is completed.

Conversation ResponseConversationoptional

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

ID string

The unique ID of the conversation that this response was associated with.

MaxOutputTokens int64optional

An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.

MaxToolCalls int64optional

The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

PreviousResponseID stringoptional

The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state. Cannot be used in conjunction with conversation.

Prompt ResponsePromptoptional

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

ID string

The unique identifier of the prompt template to use.

Variables map[string, ResponsePromptVariableUnion]optional

Optional map of values to substitute in for variables in your prompt. The substitution values can either be strings, or other Response input types like images or files.

Accepts one of the following:
string
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Version stringoptional

Optional version of the prompt template.

PromptCacheKey stringoptional

Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the user field. Learn more.

PromptCacheRetention ResponsePromptCacheRetentionoptional

The retention policy for the prompt cache. Set to 24h to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. Learn more.

Accepts one of the following:
const ResponsePromptCacheRetentionInMemory ResponsePromptCacheRetention = "in-memory"
const ResponsePromptCacheRetention24h ResponsePromptCacheRetention = "24h"
Reasoning Reasoningoptional

gpt-5 and o-series models only

Configuration options for reasoning models.

Effort ReasoningEffortoptional

Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, and xhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.

  • gpt-5.1 defaults to none, which does not perform reasoning. The supported reasoning values for gpt-5.1 are none, low, medium, and high. Tool calls are supported for all reasoning values in gpt-5.1.
  • All models before gpt-5.1 default to medium reasoning effort, and do not support none.
  • The gpt-5-pro model defaults to (and only supports) high reasoning effort.
  • xhigh is supported for all models after gpt-5.1-codex-max.
Accepts one of the following:
const ReasoningEffortNone ReasoningEffort = "none"
const ReasoningEffortMinimal ReasoningEffort = "minimal"
const ReasoningEffortLow ReasoningEffort = "low"
const ReasoningEffortMedium ReasoningEffort = "medium"
const ReasoningEffortHigh ReasoningEffort = "high"
const ReasoningEffortXhigh ReasoningEffort = "xhigh"
DeprecatedGenerateSummary ReasoningGenerateSummaryoptional

Deprecated: use summary instead.

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.

Accepts one of the following:
const ReasoningGenerateSummaryAuto ReasoningGenerateSummary = "auto"
const ReasoningGenerateSummaryConcise ReasoningGenerateSummary = "concise"
const ReasoningGenerateSummaryDetailed ReasoningGenerateSummary = "detailed"
Summary ReasoningSummaryoptional

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.

concise is supported for computer-use-preview models and all reasoning models after gpt-5.

Accepts one of the following:
const ReasoningSummaryAuto ReasoningSummary = "auto"
const ReasoningSummaryConcise ReasoningSummary = "concise"
const ReasoningSummaryDetailed ReasoningSummary = "detailed"
SafetyIdentifier stringoptional

A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. Learn more.

ServiceTier ResponseServiceTieroptional

Specifies the processing type used for serving the request.

  • If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
  • If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
  • If set to 'flex' or 'priority', then the request will be processed with the corresponding service tier.
  • When not set, the default behavior is 'auto'.

When the service_tier parameter is set, the response body will include the service_tier value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

Accepts one of the following:
const ResponseServiceTierAuto ResponseServiceTier = "auto"
const ResponseServiceTierDefault ResponseServiceTier = "default"
const ResponseServiceTierFlex ResponseServiceTier = "flex"
const ResponseServiceTierScale ResponseServiceTier = "scale"
const ResponseServiceTierPriority ResponseServiceTier = "priority"
Status ResponseStatusoptional

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

Accepts one of the following:
const ResponseStatusCompleted ResponseStatus = "completed"
const ResponseStatusFailed ResponseStatus = "failed"
const ResponseStatusInProgress ResponseStatus = "in_progress"
const ResponseStatusCancelled ResponseStatus = "cancelled"
const ResponseStatusQueued ResponseStatus = "queued"
const ResponseStatusIncomplete ResponseStatus = "incomplete"
Text ResponseTextConfigoptional

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

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.

Accepts one of the following:
type ResponseFormatText struct{…}

Default response format. Used to generate text responses.

Type Text

The type of response format being defined. Always text.

type ResponseFormatTextJSONSchemaConfig struct{…}

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

Name string

The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.

Schema map[string, any]

The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.

Type JSONSchema

The type of response format being defined. Always json_schema.

Description stringoptional

A description of what the response format is for, used by the model to determine how to respond in the format.

Strict booloptional

Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true. To learn more, read the Structured Outputs guide.

type ResponseFormatJSONObject struct{…}

JSON object response format. An older method of generating JSON responses. Using json_schema is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.

Type JSONObject

The type of response format being defined. Always json_object.

Verbosity ResponseTextConfigVerbosityoptional

Constrains the verbosity of the model's response. Lower values will result in more concise responses, while higher values will result in more verbose responses. Currently supported values are low, medium, and high.

Accepts one of the following:
const ResponseTextConfigVerbosityLow ResponseTextConfigVerbosity = "low"
const ResponseTextConfigVerbosityMedium ResponseTextConfigVerbosity = "medium"
const ResponseTextConfigVerbosityHigh ResponseTextConfigVerbosity = "high"
TopLogprobs int64optional

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.

minimum0
maximum20
Truncation ResponseTruncationoptional

The truncation strategy to use for the model response.

  • auto: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation.
  • disabled (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.
Accepts one of the following:
const ResponseTruncationAuto ResponseTruncation = "auto"
const ResponseTruncationDisabled ResponseTruncation = "disabled"
Usage ResponseUsageoptional

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

InputTokens int64

The number of input tokens.

InputTokensDetails ResponseUsageInputTokensDetails

A detailed breakdown of the input tokens.

CachedTokens int64

The number of tokens that were retrieved from the cache. More on prompt caching.

OutputTokens int64

The number of output tokens.

OutputTokensDetails ResponseUsageOutputTokensDetails

A detailed breakdown of the output tokens.

ReasoningTokens int64

The number of reasoning tokens.

TotalTokens int64

The total number of tokens used.

DeprecatedUser stringoptional

This field is being replaced by safety_identifier and prompt_cache_key. Use prompt_cache_key instead to maintain caching optimizations. A stable identifier for your end-users. Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. Learn more.

type ResponseStreamEventUnion interface{…}

Emitted when there is a partial audio response.

Accepts one of the following:
type ResponseAudioDeltaEvent struct{…}

Emitted when there is a partial audio response.

Delta string

A chunk of Base64 encoded response audio bytes.

SequenceNumber int64

A sequence number for this chunk of the stream response.

Type ResponseAudioDelta

The type of the event. Always response.audio.delta.

type ResponseAudioDoneEvent struct{…}

Emitted when the audio response is complete.

SequenceNumber int64

The sequence number of the delta.

Type ResponseAudioDone

The type of the event. Always response.audio.done.

type ResponseAudioTranscriptDeltaEvent struct{…}

Emitted when there is a partial transcript of audio.

Delta string

The partial transcript of the audio response.

SequenceNumber int64

The sequence number of this event.

Type ResponseAudioTranscriptDelta

The type of the event. Always response.audio.transcript.delta.

type ResponseAudioTranscriptDoneEvent struct{…}

Emitted when the full audio transcript is completed.

SequenceNumber int64

The sequence number of this event.

Type ResponseAudioTranscriptDone

The type of the event. Always response.audio.transcript.done.

type ResponseCodeInterpreterCallCodeDeltaEvent struct{…}

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

Delta string

The partial code snippet being streamed by the code interpreter.

ItemID string

The unique identifier of the code interpreter tool call item.

OutputIndex int64

The index of the output item in the response for which the code is being streamed.

SequenceNumber int64

The sequence number of this event, used to order streaming events.

Type ResponseCodeInterpreterCallCodeDelta

The type of the event. Always response.code_interpreter_call_code.delta.

type ResponseCodeInterpreterCallCodeDoneEvent struct{…}

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

Code string

The final code snippet output by the code interpreter.

ItemID string

The unique identifier of the code interpreter tool call item.

OutputIndex int64

The index of the output item in the response for which the code is finalized.

SequenceNumber int64

The sequence number of this event, used to order streaming events.

Type ResponseCodeInterpreterCallCodeDone

The type of the event. Always response.code_interpreter_call_code.done.

type ResponseCodeInterpreterCallCompletedEvent struct{…}

Emitted when the code interpreter call is completed.

ItemID string

The unique identifier of the code interpreter tool call item.

OutputIndex int64

The index of the output item in the response for which the code interpreter call is completed.

SequenceNumber int64

The sequence number of this event, used to order streaming events.

Type ResponseCodeInterpreterCallCompleted

The type of the event. Always response.code_interpreter_call.completed.

type ResponseCodeInterpreterCallInProgressEvent struct{…}

Emitted when a code interpreter call is in progress.

ItemID string

The unique identifier of the code interpreter tool call item.

OutputIndex int64

The index of the output item in the response for which the code interpreter call is in progress.

SequenceNumber int64

The sequence number of this event, used to order streaming events.

Type ResponseCodeInterpreterCallInProgress

The type of the event. Always response.code_interpreter_call.in_progress.

type ResponseCodeInterpreterCallInterpretingEvent struct{…}

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

ItemID string

The unique identifier of the code interpreter tool call item.

OutputIndex int64

The index of the output item in the response for which the code interpreter is interpreting code.

SequenceNumber int64

The sequence number of this event, used to order streaming events.

Type ResponseCodeInterpreterCallInterpreting

The type of the event. Always response.code_interpreter_call.interpreting.

type ResponseCompletedEvent struct{…}

Emitted when the model response is complete.

Response Response

Properties of the completed response.

ID string

Unique identifier for this Response.

CreatedAt float64

Unix timestamp (in seconds) of when this Response was created.

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

Code ResponseErrorCode

The error code for the response.

Accepts one of the following:
const ResponseErrorCodeServerError ResponseErrorCode = "server_error"
const ResponseErrorCodeRateLimitExceeded ResponseErrorCode = "rate_limit_exceeded"
const ResponseErrorCodeInvalidPrompt ResponseErrorCode = "invalid_prompt"
const ResponseErrorCodeVectorStoreTimeout ResponseErrorCode = "vector_store_timeout"
const ResponseErrorCodeInvalidImage ResponseErrorCode = "invalid_image"
const ResponseErrorCodeInvalidImageFormat ResponseErrorCode = "invalid_image_format"
const ResponseErrorCodeInvalidBase64Image ResponseErrorCode = "invalid_base64_image"
const ResponseErrorCodeInvalidImageURL ResponseErrorCode = "invalid_image_url"
const ResponseErrorCodeImageTooLarge ResponseErrorCode = "image_too_large"
const ResponseErrorCodeImageTooSmall ResponseErrorCode = "image_too_small"
const ResponseErrorCodeImageParseError ResponseErrorCode = "image_parse_error"
const ResponseErrorCodeImageContentPolicyViolation ResponseErrorCode = "image_content_policy_violation"
const ResponseErrorCodeInvalidImageMode ResponseErrorCode = "invalid_image_mode"
const ResponseErrorCodeImageFileTooLarge ResponseErrorCode = "image_file_too_large"
const ResponseErrorCodeUnsupportedImageMediaType ResponseErrorCode = "unsupported_image_media_type"
const ResponseErrorCodeEmptyImageFile ResponseErrorCode = "empty_image_file"
const ResponseErrorCodeFailedToDownloadImage ResponseErrorCode = "failed_to_download_image"
const ResponseErrorCodeImageFileNotFound ResponseErrorCode = "image_file_not_found"
Message string

A human-readable description of the error.

IncompleteDetails ResponseIncompleteDetails

Details about why the response is incomplete.

Reason stringoptional

The reason why the response is incomplete.

Accepts one of the following:
const ResponseIncompleteDetailsReasonMaxOutputTokens ResponseIncompleteDetailsReason = "max_output_tokens"
const ResponseIncompleteDetailsReasonContentFilter ResponseIncompleteDetailsReason = "content_filter"
Instructions ResponseInstructionsUnion

A system (or developer) message inserted into the model's context.

When using along with previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.

Accepts one of the following:
string
type ResponseInstructionsInputItemList []ResponseInputItemUnion

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

Accepts one of the following:
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.

Content EasyInputMessageContentUnion

Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.

Accepts one of the following:
string
type ResponseInputMessageContentList []ResponseInputContentUnion

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role EasyInputMessageRole

The role of the message input. One of user, assistant, system, or developer.

Accepts one of the following:
const EasyInputMessageRoleUser EasyInputMessageRole = "user"
const EasyInputMessageRoleAssistant EasyInputMessageRole = "assistant"
const EasyInputMessageRoleSystem EasyInputMessageRole = "system"
const EasyInputMessageRoleDeveloper EasyInputMessageRole = "developer"
Type EasyInputMessageTypeoptional

The type of the message input. Always message.

type ResponseInputItemMessage 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.

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role string

The role of the message input. One of user, system, or developer.

Accepts one of the following:
const ResponseInputItemMessageRoleUser ResponseInputItemMessageRole = "user"
const ResponseInputItemMessageRoleSystem ResponseInputItemMessageRole = "system"
const ResponseInputItemMessageRoleDeveloper ResponseInputItemMessageRole = "developer"
Status stringoptional

The status of item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemMessageStatusInProgress ResponseInputItemMessageStatus = "in_progress"
const ResponseInputItemMessageStatusCompleted ResponseInputItemMessageStatus = "completed"
const ResponseInputItemMessageStatusIncomplete ResponseInputItemMessageStatus = "incomplete"
Type stringoptional

The type of the message input. Always set to message.

type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

type ResponseInputItemComputerCallOutput struct{…}

The output of a computer tool call.

CallID string

The ID of the computer tool call that produced the output.

maxLength64
minLength1

A computer screenshot image used with the computer use tool.

Type ComputerScreenshot

Specifies the event type. For a computer screenshot, this property is always set to computer_screenshot.

FileID stringoptional

The identifier of an uploaded file that contains the screenshot.

ImageURL stringoptional

The URL of the screenshot image.

Type ComputerCallOutput

The type of the computer tool call output. Always computer_call_output.

ID stringoptional

The ID of the computer tool call output.

AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckoptional

The safety checks reported by the API that have been acknowledged by the developer.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status stringoptional

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseInputItemComputerCallOutputStatusInProgress ResponseInputItemComputerCallOutputStatus = "in_progress"
const ResponseInputItemComputerCallOutputStatusCompleted ResponseInputItemComputerCallOutputStatus = "completed"
const ResponseInputItemComputerCallOutputStatusIncomplete ResponseInputItemComputerCallOutputStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
type ResponseInputItemFunctionCallOutput struct{…}

The output of a function tool call.

CallID string

The unique ID of the function tool call generated by the model.

maxLength64
minLength1
Output ResponseInputItemFunctionCallOutputOutputUnion

Text, image, or file output of the function tool call.

Accepts one of the following:
string
type ResponseFunctionCallOutputItemList []ResponseFunctionCallOutputItemUnion

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

Accepts one of the following:
type ResponseInputTextContent struct{…}

A text input to the model.

Text string

The text input to the model.

maxLength10485760
Type InputText

The type of the input item. Always input_text.

type ResponseInputImageContent struct{…}

An image input to the model. Learn about image inputs

Type InputImage

The type of the input item. Always input_image.

Detail ResponseInputImageContentDetailoptional

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageContentDetailLow ResponseInputImageContentDetail = "low"
const ResponseInputImageContentDetailHigh ResponseInputImageContentDetail = "high"
const ResponseInputImageContentDetailAuto ResponseInputImageContentDetail = "auto"
FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

maxLength20971520
type ResponseInputFileContent struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The base64-encoded data of the file to be sent to the model.

maxLength33554432
FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type FunctionCallOutput

The type of the function tool call output. Always function_call_output.

ID stringoptional

The unique ID of the function tool call output. Populated when this item is returned via API.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemFunctionCallOutputStatusInProgress ResponseInputItemFunctionCallOutputStatus = "in_progress"
const ResponseInputItemFunctionCallOutputStatusCompleted ResponseInputItemFunctionCallOutputStatus = "completed"
const ResponseInputItemFunctionCallOutputStatusIncomplete ResponseInputItemFunctionCallOutputStatus = "incomplete"
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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItemParamResp struct{…}

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

EncryptedContent string

The encrypted content of the compaction summary.

maxLength10485760
Type Compaction

The type of the item. Always compaction.

ID stringoptional

The ID of the compaction item.

type ResponseInputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseInputItemImageGenerationCallStatusInProgress ResponseInputItemImageGenerationCallStatus = "in_progress"
const ResponseInputItemImageGenerationCallStatusCompleted ResponseInputItemImageGenerationCallStatus = "completed"
const ResponseInputItemImageGenerationCallStatusGenerating ResponseInputItemImageGenerationCallStatus = "generating"
const ResponseInputItemImageGenerationCallStatusFailed ResponseInputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseInputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseInputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseInputItemLocalShellCallStatusInProgress ResponseInputItemLocalShellCallStatus = "in_progress"
const ResponseInputItemLocalShellCallStatusCompleted ResponseInputItemLocalShellCallStatus = "completed"
const ResponseInputItemLocalShellCallStatusIncomplete ResponseInputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseInputItemLocalShellCallOutput struct{…}

The output of a local shell tool call.

ID string

The unique ID of the local shell tool call generated by the model.

Output string

A JSON string of the output of the local shell tool call.

Type LocalShellCallOutput

The type of the local shell tool call output. Always local_shell_call_output.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemLocalShellCallOutputStatusInProgress ResponseInputItemLocalShellCallOutputStatus = "in_progress"
const ResponseInputItemLocalShellCallOutputStatusCompleted ResponseInputItemLocalShellCallOutputStatus = "completed"
const ResponseInputItemLocalShellCallOutputStatusIncomplete ResponseInputItemLocalShellCallOutputStatus = "incomplete"
type ResponseInputItemShellCall struct{…}

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

Action ResponseInputItemShellCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string

Ordered shell commands for the execution environment to run.

MaxOutputLength int64optional

Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

TimeoutMs int64optional

Maximum wall-clock time in milliseconds to allow the shell commands to run.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1
Type ShellCall

The type of the item. Always shell_call.

ID stringoptional

The unique ID of the shell tool call. Populated when this item is returned via API.

Status stringoptional

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemShellCallStatusInProgress ResponseInputItemShellCallStatus = "in_progress"
const ResponseInputItemShellCallStatusCompleted ResponseInputItemShellCallStatus = "completed"
const ResponseInputItemShellCallStatusIncomplete ResponseInputItemShellCallStatus = "incomplete"
type ResponseInputItemShellCallOutput struct{…}

The streamed output items emitted by a shell tool call.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1

Captured chunks of stdout and stderr output, along with their associated outcomes.

Outcome ResponseFunctionShellCallOutputContentOutcomeUnion

The exit or timeout outcome associated with this shell call.

Accepts one of the following:
type ResponseFunctionShellCallOutputContentOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellCallOutputContentOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

The exit code returned by the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

Captured stderr output for the shell call.

maxLength10485760
Stdout string

Captured stdout output for the shell call.

maxLength10485760
Type ShellCallOutput

The type of the item. Always shell_call_output.

ID stringoptional

The unique ID of the shell tool call output. Populated when this item is returned via API.

MaxOutputLength int64optional

The maximum number of UTF-8 characters captured for this shell call's combined output.

Status stringoptional

The status of the shell call output.

Accepts one of the following:
const ResponseInputItemShellCallOutputStatusInProgress ResponseInputItemShellCallOutputStatus = "in_progress"
const ResponseInputItemShellCallOutputStatusCompleted ResponseInputItemShellCallOutputStatus = "completed"
const ResponseInputItemShellCallOutputStatusIncomplete ResponseInputItemShellCallOutputStatus = "incomplete"
type ResponseInputItemApplyPatchCall struct{…}

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

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Operation ResponseInputItemApplyPatchCallOperationUnion

The specific create, delete, or update instruction for the apply_patch tool call.

Accepts one of the following:
type ResponseInputItemApplyPatchCallOperationCreateFile struct{…}

Instruction for creating a new file via the apply_patch tool.

Diff string

Unified diff content to apply when creating the file.

maxLength10485760
Path string

Path of the file to create relative to the workspace root.

minLength1
Type CreateFile

The operation type. Always create_file.

type ResponseInputItemApplyPatchCallOperationDeleteFile struct{…}

Instruction for deleting an existing file via the apply_patch tool.

Path string

Path of the file to delete relative to the workspace root.

minLength1
Type DeleteFile

The operation type. Always delete_file.

type ResponseInputItemApplyPatchCallOperationUpdateFile struct{…}

Instruction for updating an existing file via the apply_patch tool.

Diff string

Unified diff content to apply to the existing file.

maxLength10485760
Path string

Path of the file to update relative to the workspace root.

minLength1
Type UpdateFile

The operation type. Always update_file.

Status string

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallStatusInProgress ResponseInputItemApplyPatchCallStatus = "in_progress"
const ResponseInputItemApplyPatchCallStatusCompleted ResponseInputItemApplyPatchCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

ID stringoptional

The unique ID of the apply patch tool call. Populated when this item is returned via API.

type ResponseInputItemApplyPatchCallOutput struct{…}

The streamed output emitted by an apply patch tool call.

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Status string

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallOutputStatusCompleted ResponseInputItemApplyPatchCallOutputStatus = "completed"
const ResponseInputItemApplyPatchCallOutputStatusFailed ResponseInputItemApplyPatchCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

ID stringoptional

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

Output stringoptional

Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

maxLength10485760
type ResponseInputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseInputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseInputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseInputItemMcpApprovalResponse struct{…}

A response to an MCP approval request.

ApprovalRequestID string

The ID of the approval request being answered.

Approve bool

Whether the request was approved.

Type McpApprovalResponse

The type of the item. Always mcp_approval_response.

ID stringoptional

The unique ID of the approval response

Reason stringoptional

Optional reason for the decision.

type ResponseInputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseInputItemMcpCallStatusInProgress ResponseInputItemMcpCallStatus = "in_progress"
const ResponseInputItemMcpCallStatusCompleted ResponseInputItemMcpCallStatus = "completed"
const ResponseInputItemMcpCallStatusIncomplete ResponseInputItemMcpCallStatus = "incomplete"
const ResponseInputItemMcpCallStatusCalling ResponseInputItemMcpCallStatus = "calling"
const ResponseInputItemMcpCallStatusFailed ResponseInputItemMcpCallStatus = "failed"
type ResponseCustomToolCallOutput struct{…}

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

CallID string

The call ID, used to map this custom tool call output to a custom tool call.

Output ResponseCustomToolCallOutputOutputUnion

The output from the custom tool call generated by your code. Can be a string or an list of output content.

Accepts one of the following:
string
type ResponseCustomToolCallOutputOutputOutputContentList []ResponseCustomToolCallOutputOutputOutputContentListItemUnion

Text, image, or file output of the custom tool call.

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type CustomToolCallOutput

The type of the custom tool call output. Always custom_tool_call_output.

ID stringoptional

The unique ID of the custom tool call output in the OpenAI platform.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

type ResponseInputItemItemReference struct{…}

An internal identifier for an item to reference.

ID string

The ID of the item to reference.

Type stringoptional

The type of item to reference. Always item_reference.

Metadata Metadata

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Model ResponsesModel

Model ID used to generate the response, like gpt-4o or o3. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.

Accepts one of the following:
string
type ChatModel string
Accepts one of the following:
const ChatModelGPT5_2 ChatModel = "gpt-5.2"
const ChatModelGPT5_2_2025_12_11 ChatModel = "gpt-5.2-2025-12-11"
const ChatModelGPT5_2ChatLatest ChatModel = "gpt-5.2-chat-latest"
const ChatModelGPT5_2Pro ChatModel = "gpt-5.2-pro"
const ChatModelGPT5_2Pro2025_12_11 ChatModel = "gpt-5.2-pro-2025-12-11"
const ChatModelGPT5_1 ChatModel = "gpt-5.1"
const ChatModelGPT5_1_2025_11_13 ChatModel = "gpt-5.1-2025-11-13"
const ChatModelGPT5_1Codex ChatModel = "gpt-5.1-codex"
const ChatModelGPT5_1Mini ChatModel = "gpt-5.1-mini"
const ChatModelGPT5_1ChatLatest ChatModel = "gpt-5.1-chat-latest"
const ChatModelGPT5 ChatModel = "gpt-5"
const ChatModelGPT5Mini ChatModel = "gpt-5-mini"
const ChatModelGPT5Nano ChatModel = "gpt-5-nano"
const ChatModelGPT5_2025_08_07 ChatModel = "gpt-5-2025-08-07"
const ChatModelGPT5Mini2025_08_07 ChatModel = "gpt-5-mini-2025-08-07"
const ChatModelGPT5Nano2025_08_07 ChatModel = "gpt-5-nano-2025-08-07"
const ChatModelGPT5ChatLatest ChatModel = "gpt-5-chat-latest"
const ChatModelGPT4_1 ChatModel = "gpt-4.1"
const ChatModelGPT4_1Mini ChatModel = "gpt-4.1-mini"
const ChatModelGPT4_1Nano ChatModel = "gpt-4.1-nano"
const ChatModelGPT4_1_2025_04_14 ChatModel = "gpt-4.1-2025-04-14"
const ChatModelGPT4_1Mini2025_04_14 ChatModel = "gpt-4.1-mini-2025-04-14"
const ChatModelGPT4_1Nano2025_04_14 ChatModel = "gpt-4.1-nano-2025-04-14"
const ChatModelO4Mini ChatModel = "o4-mini"
const ChatModelO4Mini2025_04_16 ChatModel = "o4-mini-2025-04-16"
const ChatModelO3 ChatModel = "o3"
const ChatModelO3_2025_04_16 ChatModel = "o3-2025-04-16"
const ChatModelO3Mini ChatModel = "o3-mini"
const ChatModelO3Mini2025_01_31 ChatModel = "o3-mini-2025-01-31"
const ChatModelO1 ChatModel = "o1"
const ChatModelO1_2024_12_17 ChatModel = "o1-2024-12-17"
const ChatModelO1Preview ChatModel = "o1-preview"
const ChatModelO1Preview2024_09_12 ChatModel = "o1-preview-2024-09-12"
const ChatModelO1Mini ChatModel = "o1-mini"
const ChatModelO1Mini2024_09_12 ChatModel = "o1-mini-2024-09-12"
const ChatModelGPT4o ChatModel = "gpt-4o"
const ChatModelGPT4o2024_11_20 ChatModel = "gpt-4o-2024-11-20"
const ChatModelGPT4o2024_08_06 ChatModel = "gpt-4o-2024-08-06"
const ChatModelGPT4o2024_05_13 ChatModel = "gpt-4o-2024-05-13"
const ChatModelGPT4oAudioPreview ChatModel = "gpt-4o-audio-preview"
const ChatModelGPT4oAudioPreview2024_10_01 ChatModel = "gpt-4o-audio-preview-2024-10-01"
const ChatModelGPT4oAudioPreview2024_12_17 ChatModel = "gpt-4o-audio-preview-2024-12-17"
const ChatModelGPT4oAudioPreview2025_06_03 ChatModel = "gpt-4o-audio-preview-2025-06-03"
const ChatModelGPT4oMiniAudioPreview ChatModel = "gpt-4o-mini-audio-preview"
const ChatModelGPT4oMiniAudioPreview2024_12_17 ChatModel = "gpt-4o-mini-audio-preview-2024-12-17"
const ChatModelGPT4oSearchPreview ChatModel = "gpt-4o-search-preview"
const ChatModelGPT4oMiniSearchPreview ChatModel = "gpt-4o-mini-search-preview"
const ChatModelGPT4oSearchPreview2025_03_11 ChatModel = "gpt-4o-search-preview-2025-03-11"
const ChatModelGPT4oMiniSearchPreview2025_03_11 ChatModel = "gpt-4o-mini-search-preview-2025-03-11"
const ChatModelChatgpt4oLatest ChatModel = "chatgpt-4o-latest"
const ChatModelCodexMiniLatest ChatModel = "codex-mini-latest"
const ChatModelGPT4oMini ChatModel = "gpt-4o-mini"
const ChatModelGPT4oMini2024_07_18 ChatModel = "gpt-4o-mini-2024-07-18"
const ChatModelGPT4Turbo ChatModel = "gpt-4-turbo"
const ChatModelGPT4Turbo2024_04_09 ChatModel = "gpt-4-turbo-2024-04-09"
const ChatModelGPT4_0125Preview ChatModel = "gpt-4-0125-preview"
const ChatModelGPT4TurboPreview ChatModel = "gpt-4-turbo-preview"
const ChatModelGPT4_1106Preview ChatModel = "gpt-4-1106-preview"
const ChatModelGPT4VisionPreview ChatModel = "gpt-4-vision-preview"
const ChatModelGPT4 ChatModel = "gpt-4"
const ChatModelGPT4_0314 ChatModel = "gpt-4-0314"
const ChatModelGPT4_0613 ChatModel = "gpt-4-0613"
const ChatModelGPT4_32k ChatModel = "gpt-4-32k"
const ChatModelGPT4_32k0314 ChatModel = "gpt-4-32k-0314"
const ChatModelGPT4_32k0613 ChatModel = "gpt-4-32k-0613"
const ChatModelGPT3_5Turbo ChatModel = "gpt-3.5-turbo"
const ChatModelGPT3_5Turbo16k ChatModel = "gpt-3.5-turbo-16k"
const ChatModelGPT3_5Turbo0301 ChatModel = "gpt-3.5-turbo-0301"
const ChatModelGPT3_5Turbo0613 ChatModel = "gpt-3.5-turbo-0613"
const ChatModelGPT3_5Turbo1106 ChatModel = "gpt-3.5-turbo-1106"
const ChatModelGPT3_5Turbo0125 ChatModel = "gpt-3.5-turbo-0125"
const ChatModelGPT3_5Turbo16k0613 ChatModel = "gpt-3.5-turbo-16k-0613"
type ResponsesModel string
Accepts one of the following:
const ResponsesModelO1Pro ResponsesModel = "o1-pro"
const ResponsesModelO1Pro2025_03_19 ResponsesModel = "o1-pro-2025-03-19"
const ResponsesModelO3Pro ResponsesModel = "o3-pro"
const ResponsesModelO3Pro2025_06_10 ResponsesModel = "o3-pro-2025-06-10"
const ResponsesModelO3DeepResearch ResponsesModel = "o3-deep-research"
const ResponsesModelO3DeepResearch2025_06_26 ResponsesModel = "o3-deep-research-2025-06-26"
const ResponsesModelO4MiniDeepResearch ResponsesModel = "o4-mini-deep-research"
const ResponsesModelO4MiniDeepResearch2025_06_26 ResponsesModel = "o4-mini-deep-research-2025-06-26"
const ResponsesModelComputerUsePreview ResponsesModel = "computer-use-preview"
const ResponsesModelComputerUsePreview2025_03_11 ResponsesModel = "computer-use-preview-2025-03-11"
const ResponsesModelGPT5Codex ResponsesModel = "gpt-5-codex"
const ResponsesModelGPT5Pro ResponsesModel = "gpt-5-pro"
const ResponsesModelGPT5Pro2025_10_06 ResponsesModel = "gpt-5-pro-2025-10-06"
const ResponsesModelGPT5_1CodexMax ResponsesModel = "gpt-5.1-codex-max"
Object Response

The object type of this resource - always set to response.

An array of content items generated by the model.

  • The length and order of items in the output array is dependent on the model's response.
  • Rather than accessing the first item in the output array and assuming it's an assistant message with the content generated by the model, you might consider using the output_text property where supported in SDKs.
Accepts one of the following:
type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItem struct{…}

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

ID string

The unique ID of the compaction item.

EncryptedContent string

The encrypted content that was produced by compaction.

Type Compaction

The type of the item. Always compaction.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseOutputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseOutputItemImageGenerationCallStatusInProgress ResponseOutputItemImageGenerationCallStatus = "in_progress"
const ResponseOutputItemImageGenerationCallStatusCompleted ResponseOutputItemImageGenerationCallStatus = "completed"
const ResponseOutputItemImageGenerationCallStatusGenerating ResponseOutputItemImageGenerationCallStatus = "generating"
const ResponseOutputItemImageGenerationCallStatusFailed ResponseOutputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseOutputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseOutputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseOutputItemLocalShellCallStatusInProgress ResponseOutputItemLocalShellCallStatus = "in_progress"
const ResponseOutputItemLocalShellCallStatusCompleted ResponseOutputItemLocalShellCallStatus = "completed"
const ResponseOutputItemLocalShellCallStatusIncomplete ResponseOutputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseFunctionShellToolCall struct{…}

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

ID string

The unique ID of the shell tool call. Populated when this item is returned via API.

Action ResponseFunctionShellToolCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string
MaxOutputLength int64

Optional maximum number of characters to return from each command.

TimeoutMs int64

Optional timeout in milliseconds for the commands.

CallID string

The unique ID of the shell tool call generated by the model.

Status ResponseFunctionShellToolCallStatus

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallStatusInProgress ResponseFunctionShellToolCallStatus = "in_progress"
const ResponseFunctionShellToolCallStatusCompleted ResponseFunctionShellToolCallStatus = "completed"
const ResponseFunctionShellToolCallStatusIncomplete ResponseFunctionShellToolCallStatus = "incomplete"
Type ShellCall

The type of the item. Always shell_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseFunctionShellToolCallOutput struct{…}

The output of a shell tool call that was emitted.

ID string

The unique ID of the shell call output. Populated when this item is returned via API.

CallID string

The unique ID of the shell tool call generated by the model.

MaxOutputLength int64

The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output.

Output []ResponseFunctionShellToolCallOutputOutput

An array of shell call output contents

Outcome ResponseFunctionShellToolCallOutputOutputOutcomeUnion

Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

Accepts one of the following:
type ResponseFunctionShellToolCallOutputOutputOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellToolCallOutputOutputOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

Exit code from the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

The standard error output that was captured.

Stdout string

The standard output that was captured.

CreatedBy stringoptional

The identifier of the actor that created the item.

Status ResponseFunctionShellToolCallOutputStatus

The status of the shell call output. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallOutputStatusInProgress ResponseFunctionShellToolCallOutputStatus = "in_progress"
const ResponseFunctionShellToolCallOutputStatusCompleted ResponseFunctionShellToolCallOutputStatus = "completed"
const ResponseFunctionShellToolCallOutputStatusIncomplete ResponseFunctionShellToolCallOutputStatus = "incomplete"
Type ShellCallOutput

The type of the shell call output. Always shell_call_output.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseApplyPatchToolCall struct{…}

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

ID string

The unique ID of the apply patch tool call. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Operation ResponseApplyPatchToolCallOperationUnion

One of the create_file, delete_file, or update_file operations applied via apply_patch.

Accepts one of the following:
type ResponseApplyPatchToolCallOperationCreateFile struct{…}

Instruction describing how to create a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to create.

Type CreateFile

Create a new file with the provided diff.

type ResponseApplyPatchToolCallOperationDeleteFile struct{…}

Instruction describing how to delete a file via the apply_patch tool.

Path string

Path of the file to delete.

Type DeleteFile

Delete the specified file.

type ResponseApplyPatchToolCallOperationUpdateFile struct{…}

Instruction describing how to update a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to update.

Type UpdateFile

Update an existing file with the provided diff.

Status ResponseApplyPatchToolCallStatus

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseApplyPatchToolCallStatusInProgress ResponseApplyPatchToolCallStatus = "in_progress"
const ResponseApplyPatchToolCallStatusCompleted ResponseApplyPatchToolCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseApplyPatchToolCallOutput struct{…}

The output emitted by an apply patch tool call.

ID string

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Status ResponseApplyPatchToolCallOutputStatus

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseApplyPatchToolCallOutputStatusCompleted ResponseApplyPatchToolCallOutputStatus = "completed"
const ResponseApplyPatchToolCallOutputStatusFailed ResponseApplyPatchToolCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

CreatedBy stringoptional

The ID of the entity that created this tool call output.

Output stringoptional

Optional textual output returned by the apply patch tool.

type ResponseOutputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseOutputItemMcpCallStatusInProgress ResponseOutputItemMcpCallStatus = "in_progress"
const ResponseOutputItemMcpCallStatusCompleted ResponseOutputItemMcpCallStatus = "completed"
const ResponseOutputItemMcpCallStatusIncomplete ResponseOutputItemMcpCallStatus = "incomplete"
const ResponseOutputItemMcpCallStatusCalling ResponseOutputItemMcpCallStatus = "calling"
const ResponseOutputItemMcpCallStatusFailed ResponseOutputItemMcpCallStatus = "failed"
type ResponseOutputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseOutputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseOutputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

ParallelToolCalls bool

Whether to allow the model to run tool calls in parallel.

Temperature float64

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.

minimum0
maximum2
ToolChoice ResponseToolChoiceUnion

How the model should select which tool (or tools) to use when generating a response. See the tools parameter to see how to specify which tools the model can call.

Accepts one of the following:
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.

Accepts one of the following:
const ToolChoiceOptionsNone ToolChoiceOptions = "none"
const ToolChoiceOptionsAuto ToolChoiceOptions = "auto"
const ToolChoiceOptionsRequired ToolChoiceOptions = "required"
type ToolChoiceAllowed struct{…}

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

Mode ToolChoiceAllowedMode

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

auto allows the model to pick from among the allowed tools and generate a message.

required requires the model to call one or more of the allowed tools.

Accepts one of the following:
const ToolChoiceAllowedModeAuto ToolChoiceAllowedMode = "auto"
const ToolChoiceAllowedModeRequired ToolChoiceAllowedMode = "required"
Tools []map[string, any]

A list of tool definitions that the model should be allowed to call.

For the Responses API, the list of tool definitions might look like:

[
  { "type": "function", "name": "get_weather" },
  { "type": "mcp", "server_label": "deepwiki" },
  { "type": "image_generation" }
]
Type AllowedTools

Allowed tool configuration type. Always allowed_tools.

type ToolChoiceTypes struct{…}

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

Type ToolChoiceTypesType

The type of hosted tool the model should to use. Learn more about built-in tools.

Allowed values are:

  • file_search
  • web_search_preview
  • computer_use_preview
  • code_interpreter
  • image_generation
Accepts one of the following:
const ToolChoiceTypesTypeFileSearch ToolChoiceTypesType = "file_search"
const ToolChoiceTypesTypeWebSearchPreview ToolChoiceTypesType = "web_search_preview"
const ToolChoiceTypesTypeComputerUsePreview ToolChoiceTypesType = "computer_use_preview"
const ToolChoiceTypesTypeWebSearchPreview2025_03_11 ToolChoiceTypesType = "web_search_preview_2025_03_11"
const ToolChoiceTypesTypeImageGeneration ToolChoiceTypesType = "image_generation"
const ToolChoiceTypesTypeCodeInterpreter ToolChoiceTypesType = "code_interpreter"
type ToolChoiceFunction struct{…}

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

Name string

The name of the function to call.

Type Function

For function calling, the type is always function.

type ToolChoiceMcp struct{…}

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

ServerLabel string

The label of the MCP server to use.

Type Mcp

For MCP tools, the type is always mcp.

Name stringoptional

The name of the tool to call on the server.

type ToolChoiceCustom struct{…}

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

Name string

The name of the custom tool to call.

Type Custom

For custom tool calling, the type is always custom.

type ToolChoiceApplyPatch struct{…}

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

Type ApplyPatch

The tool to call. Always apply_patch.

type ToolChoiceShell struct{…}

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

Type Shell

The tool to call. Always shell.

Tools []ToolUnion

An array of tools the model may call while generating a response. You can specify which tool to use by setting the tool_choice parameter.

We support the following categories of tools:

  • Built-in tools: Tools that are provided by OpenAI that extend the model's capabilities, like web search or file search. Learn more about built-in tools.
  • MCP Tools: Integrations with third-party systems via custom MCP servers or predefined connectors such as Google Drive and SharePoint. Learn more about MCP Tools.
  • Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code with strongly typed arguments and outputs. Learn more about function calling. You can also use custom tools to call your own code.
Accepts one of the following:
type FunctionTool struct{…}

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

Name string

The name of the function to call.

Parameters map[string, any]

A JSON schema object describing the parameters of the function.

Strict bool

Whether to enforce strict parameter validation. Default true.

Type Function

The type of the function tool. Always function.

Description stringoptional

A description of the function. Used by the model to determine whether or not to call the function.

type FileSearchTool struct{…}

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

Type FileSearch

The type of the file search tool. Always file_search.

VectorStoreIDs []string

The IDs of the vector stores to search.

Filters FileSearchToolFiltersUnionoptional

A filter to apply.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
type CompoundFilter struct{…}

Combine multiple filters using and or or.

Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
Type CompoundFilterType

Type of operation: and or or.

Accepts one of the following:
const CompoundFilterTypeAnd CompoundFilterType = "and"
const CompoundFilterTypeOr CompoundFilterType = "or"
MaxNumResults int64optional

The maximum number of results to return. This number should be between 1 and 50 inclusive.

RankingOptions FileSearchToolRankingOptionsoptional

Ranking options for search.

Ranker stringoptional

The ranker to use for the file search.

Accepts one of the following:
const FileSearchToolRankingOptionsRankerAuto FileSearchToolRankingOptionsRanker = "auto"
const FileSearchToolRankingOptionsRankerDefault2024_11_15 FileSearchToolRankingOptionsRanker = "default-2024-11-15"
ScoreThreshold float64optional

The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.

type ComputerTool struct{…}

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

DisplayHeight int64

The height of the computer display.

DisplayWidth int64

The width of the computer display.

Environment ComputerToolEnvironment

The type of computer environment to control.

Accepts one of the following:
const ComputerToolEnvironmentWindows ComputerToolEnvironment = "windows"
const ComputerToolEnvironmentMac ComputerToolEnvironment = "mac"
const ComputerToolEnvironmentLinux ComputerToolEnvironment = "linux"
const ComputerToolEnvironmentUbuntu ComputerToolEnvironment = "ubuntu"
const ComputerToolEnvironmentBrowser ComputerToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type WebSearchTool struct{…}

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

Type WebSearchToolType

The type of the web search tool. One of web_search or web_search_2025_08_26.

Accepts one of the following:
const WebSearchToolTypeWebSearch WebSearchToolType = "web_search"
const WebSearchToolTypeWebSearch2025_08_26 WebSearchToolType = "web_search_2025_08_26"
Filters WebSearchToolFiltersoptional

Filters for the search.

AllowedDomains []stringoptional

Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.

Example: ["pubmed.ncbi.nlm.nih.gov"]

SearchContextSize WebSearchToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchToolSearchContextSizeLow WebSearchToolSearchContextSize = "low"
const WebSearchToolSearchContextSizeMedium WebSearchToolSearchContextSize = "medium"
const WebSearchToolSearchContextSizeHigh WebSearchToolSearchContextSize = "high"
UserLocation WebSearchToolUserLocationoptional

The approximate location of the user.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

Type stringoptional

The type of location approximation. Always approximate.

type ToolMcp struct{…}

Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.

ServerLabel string

A label for this MCP server, used to identify it in tool calls.

Type Mcp

The type of the MCP tool. Always mcp.

AllowedTools ToolMcpAllowedToolsUnionoptional

List of allowed tool names or a filter object.

Accepts one of the following:
type ToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type ToolMcpAllowedToolsMcpToolFilter struct{…}

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Authorization stringoptional

An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.

ConnectorID stringoptional

Identifier for service connectors, like those available in ChatGPT. One of server_url or connector_id must be provided. Learn more about service connectors here.

Currently supported connector_id values are:

  • Dropbox: connector_dropbox
  • Gmail: connector_gmail
  • Google Calendar: connector_googlecalendar
  • Google Drive: connector_googledrive
  • Microsoft Teams: connector_microsoftteams
  • Outlook Calendar: connector_outlookcalendar
  • Outlook Email: connector_outlookemail
  • SharePoint: connector_sharepoint
Accepts one of the following:
const ToolMcpConnectorIDConnectorDropbox ToolMcpConnectorID = "connector_dropbox"
const ToolMcpConnectorIDConnectorGmail ToolMcpConnectorID = "connector_gmail"
const ToolMcpConnectorIDConnectorGooglecalendar ToolMcpConnectorID = "connector_googlecalendar"
const ToolMcpConnectorIDConnectorGoogledrive ToolMcpConnectorID = "connector_googledrive"
const ToolMcpConnectorIDConnectorMicrosoftteams ToolMcpConnectorID = "connector_microsoftteams"
const ToolMcpConnectorIDConnectorOutlookcalendar ToolMcpConnectorID = "connector_outlookcalendar"
const ToolMcpConnectorIDConnectorOutlookemail ToolMcpConnectorID = "connector_outlookemail"
const ToolMcpConnectorIDConnectorSharepoint ToolMcpConnectorID = "connector_sharepoint"
Headers map[string, string]optional

Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.

RequireApproval ToolMcpRequireApprovalUnionoptional

Specify which of the MCP server's tools require approval.

Accepts one of the following:
type ToolMcpRequireApprovalMcpToolApprovalFilter struct{…}

Specify which of the MCP server's tools require approval. Can be always, never, or a filter object associated with tools that require approval.

Always ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysoptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Never ToolMcpRequireApprovalMcpToolApprovalFilterNeveroptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

type ToolMcpRequireApprovalMcpToolApprovalSetting string

Specify a single approval policy for all tools. One of always or never. When set to always, all tools will require approval. When set to never, all tools will not require approval.

Accepts one of the following:
const ToolMcpRequireApprovalMcpToolApprovalSettingAlways ToolMcpRequireApprovalMcpToolApprovalSetting = "always"
const ToolMcpRequireApprovalMcpToolApprovalSettingNever ToolMcpRequireApprovalMcpToolApprovalSetting = "never"
ServerDescription stringoptional

Optional description of the MCP server, used to provide more context.

ServerURL stringoptional

The URL for the MCP server. One of server_url or connector_id must be provided.

type ToolCodeInterpreter struct{…}

A tool that runs Python code to help generate a response to a prompt.

Container ToolCodeInterpreterContainerUnion

The code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional memory_limit setting.

Accepts one of the following:
string
type ToolCodeInterpreterContainerCodeInterpreterContainerAuto struct{…}

Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

Type Auto

Always auto.

FileIDs []stringoptional

An optional list of uploaded files to make available to your code.

MemoryLimit stringoptional

The memory limit for the code interpreter container.

Accepts one of the following:
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
Type CodeInterpreter

The type of the code interpreter tool. Always code_interpreter.

type ToolImageGeneration struct{…}

A tool that generates images using the GPT image models.

Type ImageGeneration

The type of the image generation tool. Always image_generation.

Action stringoptional

Whether to generate a new image or edit an existing image. Default: auto.

Accepts one of the following:
const ToolImageGenerationActionGenerate ToolImageGenerationAction = "generate"
const ToolImageGenerationActionEdit ToolImageGenerationAction = "edit"
const ToolImageGenerationActionAuto ToolImageGenerationAction = "auto"
Background stringoptional

Background type for the generated image. One of transparent, opaque, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationBackgroundTransparent ToolImageGenerationBackground = "transparent"
const ToolImageGenerationBackgroundOpaque ToolImageGenerationBackground = "opaque"
const ToolImageGenerationBackgroundAuto ToolImageGenerationBackground = "auto"
InputFidelity stringoptional

Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for gpt-image-1 and gpt-image-1.5 and later models, unsupported for gpt-image-1-mini. Supports high and low. Defaults to low.

Accepts one of the following:
const ToolImageGenerationInputFidelityHigh ToolImageGenerationInputFidelity = "high"
const ToolImageGenerationInputFidelityLow ToolImageGenerationInputFidelity = "low"
InputImageMask ToolImageGenerationInputImageMaskoptional

Optional mask for inpainting. Contains image_url (string, optional) and file_id (string, optional).

FileID stringoptional

File ID for the mask image.

ImageURL stringoptional

Base64-encoded mask image.

Model stringoptional

The image generation model to use. Default: gpt-image-1.

Accepts one of the following:
string
string
Accepts one of the following:
const ToolImageGenerationModelGPTImage1 ToolImageGenerationModel = "gpt-image-1"
const ToolImageGenerationModelGPTImage1Mini ToolImageGenerationModel = "gpt-image-1-mini"
const ToolImageGenerationModelGPTImage1_5 ToolImageGenerationModel = "gpt-image-1.5"
Moderation stringoptional

Moderation level for the generated image. Default: auto.

Accepts one of the following:
const ToolImageGenerationModerationAuto ToolImageGenerationModeration = "auto"
const ToolImageGenerationModerationLow ToolImageGenerationModeration = "low"
OutputCompression int64optional

Compression level for the output image. Default: 100.

minimum0
maximum100
OutputFormat stringoptional

The output format of the generated image. One of png, webp, or jpeg. Default: png.

Accepts one of the following:
const ToolImageGenerationOutputFormatPNG ToolImageGenerationOutputFormat = "png"
const ToolImageGenerationOutputFormatWebP ToolImageGenerationOutputFormat = "webp"
const ToolImageGenerationOutputFormatJPEG ToolImageGenerationOutputFormat = "jpeg"
PartialImages int64optional

Number of partial images to generate in streaming mode, from 0 (default value) to 3.

minimum0
maximum3
Quality stringoptional

The quality of the generated image. One of low, medium, high, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationQualityLow ToolImageGenerationQuality = "low"
const ToolImageGenerationQualityMedium ToolImageGenerationQuality = "medium"
const ToolImageGenerationQualityHigh ToolImageGenerationQuality = "high"
const ToolImageGenerationQualityAuto ToolImageGenerationQuality = "auto"
Size stringoptional

The size of the generated image. One of 1024x1024, 1024x1536, 1536x1024, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationSize1024x1024 ToolImageGenerationSize = "1024x1024"
const ToolImageGenerationSize1024x1536 ToolImageGenerationSize = "1024x1536"
const ToolImageGenerationSize1536x1024 ToolImageGenerationSize = "1536x1024"
const ToolImageGenerationSizeAuto ToolImageGenerationSize = "auto"
type ToolLocalShell struct{…}

A tool that allows the model to execute shell commands in a local environment.

Type LocalShell

The type of the local shell tool. Always local_shell.

type FunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

type CustomTool struct{…}

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

Name string

The name of the custom tool, used to identify it in tool calls.

Type Custom

The type of the custom tool. Always custom.

Description stringoptional

Optional description of the custom tool, used to provide more context.

The input format for the custom tool. Default is unconstrained text.

Accepts one of the following:
type CustomToolInputFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

type CustomToolInputFormatGrammar struct{…}

A grammar defined by the user.

Definition string

The grammar definition.

Syntax string

The syntax of the grammar definition. One of lark or regex.

Accepts one of the following:
const CustomToolInputFormatGrammarSyntaxLark CustomToolInputFormatGrammarSyntax = "lark"
const CustomToolInputFormatGrammarSyntaxRegex CustomToolInputFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

type WebSearchPreviewTool struct{…}

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

Type WebSearchPreviewToolType

The type of the web search tool. One of web_search_preview or web_search_preview_2025_03_11.

Accepts one of the following:
const WebSearchPreviewToolTypeWebSearchPreview WebSearchPreviewToolType = "web_search_preview"
const WebSearchPreviewToolTypeWebSearchPreview2025_03_11 WebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContextSize WebSearchPreviewToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchPreviewToolSearchContextSizeLow WebSearchPreviewToolSearchContextSize = "low"
const WebSearchPreviewToolSearchContextSizeMedium WebSearchPreviewToolSearchContextSize = "medium"
const WebSearchPreviewToolSearchContextSizeHigh WebSearchPreviewToolSearchContextSize = "high"
UserLocation WebSearchPreviewToolUserLocationoptional

The user's location.

Type Approximate

The type of location approximation. Always approximate.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

type ApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

TopP float64

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

minimum0
maximum1
Background booloptional

Whether to run the model response in the background. Learn more.

CompletedAt float64optional

Unix timestamp (in seconds) of when this Response was completed. Only present when the status is completed.

Conversation ResponseConversationoptional

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

ID string

The unique ID of the conversation that this response was associated with.

MaxOutputTokens int64optional

An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.

MaxToolCalls int64optional

The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

PreviousResponseID stringoptional

The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state. Cannot be used in conjunction with conversation.

Prompt ResponsePromptoptional

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

ID string

The unique identifier of the prompt template to use.

Variables map[string, ResponsePromptVariableUnion]optional

Optional map of values to substitute in for variables in your prompt. The substitution values can either be strings, or other Response input types like images or files.

Accepts one of the following:
string
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Version stringoptional

Optional version of the prompt template.

PromptCacheKey stringoptional

Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the user field. Learn more.

PromptCacheRetention ResponsePromptCacheRetentionoptional

The retention policy for the prompt cache. Set to 24h to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. Learn more.

Accepts one of the following:
const ResponsePromptCacheRetentionInMemory ResponsePromptCacheRetention = "in-memory"
const ResponsePromptCacheRetention24h ResponsePromptCacheRetention = "24h"
Reasoning Reasoningoptional

gpt-5 and o-series models only

Configuration options for reasoning models.

Effort ReasoningEffortoptional

Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, and xhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.

  • gpt-5.1 defaults to none, which does not perform reasoning. The supported reasoning values for gpt-5.1 are none, low, medium, and high. Tool calls are supported for all reasoning values in gpt-5.1.
  • All models before gpt-5.1 default to medium reasoning effort, and do not support none.
  • The gpt-5-pro model defaults to (and only supports) high reasoning effort.
  • xhigh is supported for all models after gpt-5.1-codex-max.
Accepts one of the following:
const ReasoningEffortNone ReasoningEffort = "none"
const ReasoningEffortMinimal ReasoningEffort = "minimal"
const ReasoningEffortLow ReasoningEffort = "low"
const ReasoningEffortMedium ReasoningEffort = "medium"
const ReasoningEffortHigh ReasoningEffort = "high"
const ReasoningEffortXhigh ReasoningEffort = "xhigh"
DeprecatedGenerateSummary ReasoningGenerateSummaryoptional

Deprecated: use summary instead.

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.

Accepts one of the following:
const ReasoningGenerateSummaryAuto ReasoningGenerateSummary = "auto"
const ReasoningGenerateSummaryConcise ReasoningGenerateSummary = "concise"
const ReasoningGenerateSummaryDetailed ReasoningGenerateSummary = "detailed"
Summary ReasoningSummaryoptional

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.

concise is supported for computer-use-preview models and all reasoning models after gpt-5.

Accepts one of the following:
const ReasoningSummaryAuto ReasoningSummary = "auto"
const ReasoningSummaryConcise ReasoningSummary = "concise"
const ReasoningSummaryDetailed ReasoningSummary = "detailed"
SafetyIdentifier stringoptional

A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. Learn more.

ServiceTier ResponseServiceTieroptional

Specifies the processing type used for serving the request.

  • If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
  • If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
  • If set to 'flex' or 'priority', then the request will be processed with the corresponding service tier.
  • When not set, the default behavior is 'auto'.

When the service_tier parameter is set, the response body will include the service_tier value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

Accepts one of the following:
const ResponseServiceTierAuto ResponseServiceTier = "auto"
const ResponseServiceTierDefault ResponseServiceTier = "default"
const ResponseServiceTierFlex ResponseServiceTier = "flex"
const ResponseServiceTierScale ResponseServiceTier = "scale"
const ResponseServiceTierPriority ResponseServiceTier = "priority"
Status ResponseStatusoptional

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

Accepts one of the following:
const ResponseStatusCompleted ResponseStatus = "completed"
const ResponseStatusFailed ResponseStatus = "failed"
const ResponseStatusInProgress ResponseStatus = "in_progress"
const ResponseStatusCancelled ResponseStatus = "cancelled"
const ResponseStatusQueued ResponseStatus = "queued"
const ResponseStatusIncomplete ResponseStatus = "incomplete"
Text ResponseTextConfigoptional

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

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.

Accepts one of the following:
type ResponseFormatText struct{…}

Default response format. Used to generate text responses.

Type Text

The type of response format being defined. Always text.

type ResponseFormatTextJSONSchemaConfig struct{…}

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

Name string

The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.

Schema map[string, any]

The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.

Type JSONSchema

The type of response format being defined. Always json_schema.

Description stringoptional

A description of what the response format is for, used by the model to determine how to respond in the format.

Strict booloptional

Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true. To learn more, read the Structured Outputs guide.

type ResponseFormatJSONObject struct{…}

JSON object response format. An older method of generating JSON responses. Using json_schema is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.

Type JSONObject

The type of response format being defined. Always json_object.

Verbosity ResponseTextConfigVerbosityoptional

Constrains the verbosity of the model's response. Lower values will result in more concise responses, while higher values will result in more verbose responses. Currently supported values are low, medium, and high.

Accepts one of the following:
const ResponseTextConfigVerbosityLow ResponseTextConfigVerbosity = "low"
const ResponseTextConfigVerbosityMedium ResponseTextConfigVerbosity = "medium"
const ResponseTextConfigVerbosityHigh ResponseTextConfigVerbosity = "high"
TopLogprobs int64optional

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.

minimum0
maximum20
Truncation ResponseTruncationoptional

The truncation strategy to use for the model response.

  • auto: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation.
  • disabled (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.
Accepts one of the following:
const ResponseTruncationAuto ResponseTruncation = "auto"
const ResponseTruncationDisabled ResponseTruncation = "disabled"
Usage ResponseUsageoptional

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

InputTokens int64

The number of input tokens.

InputTokensDetails ResponseUsageInputTokensDetails

A detailed breakdown of the input tokens.

CachedTokens int64

The number of tokens that were retrieved from the cache. More on prompt caching.

OutputTokens int64

The number of output tokens.

OutputTokensDetails ResponseUsageOutputTokensDetails

A detailed breakdown of the output tokens.

ReasoningTokens int64

The number of reasoning tokens.

TotalTokens int64

The total number of tokens used.

DeprecatedUser stringoptional

This field is being replaced by safety_identifier and prompt_cache_key. Use prompt_cache_key instead to maintain caching optimizations. A stable identifier for your end-users. Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. Learn more.

SequenceNumber int64

The sequence number for this event.

Type ResponseCompleted

The type of the event. Always response.completed.

type ResponseContentPartAddedEvent struct{…}

Emitted when a new content part is added.

ContentIndex int64

The index of the content part that was added.

ItemID string

The ID of the output item that the content part was added to.

OutputIndex int64

The index of the output item that the content part was added to.

Part ResponseContentPartAddedEventPartUnion

The content part that was added.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

type ResponseContentPartAddedEventPartReasoningText struct{…}

Reasoning text from the model.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

SequenceNumber int64

The sequence number of this event.

Type ResponseContentPartAdded

The type of the event. Always response.content_part.added.

type ResponseContentPartDoneEvent struct{…}

Emitted when a content part is done.

ContentIndex int64

The index of the content part that is done.

ItemID string

The ID of the output item that the content part was added to.

OutputIndex int64

The index of the output item that the content part was added to.

Part ResponseContentPartDoneEventPartUnion

The content part that is done.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

type ResponseContentPartDoneEventPartReasoningText struct{…}

Reasoning text from the model.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

SequenceNumber int64

The sequence number of this event.

Type ResponseContentPartDone

The type of the event. Always response.content_part.done.

type ResponseCreatedEvent struct{…}

An event that is emitted when a response is created.

Response Response

The response that was created.

ID string

Unique identifier for this Response.

CreatedAt float64

Unix timestamp (in seconds) of when this Response was created.

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

Code ResponseErrorCode

The error code for the response.

Accepts one of the following:
const ResponseErrorCodeServerError ResponseErrorCode = "server_error"
const ResponseErrorCodeRateLimitExceeded ResponseErrorCode = "rate_limit_exceeded"
const ResponseErrorCodeInvalidPrompt ResponseErrorCode = "invalid_prompt"
const ResponseErrorCodeVectorStoreTimeout ResponseErrorCode = "vector_store_timeout"
const ResponseErrorCodeInvalidImage ResponseErrorCode = "invalid_image"
const ResponseErrorCodeInvalidImageFormat ResponseErrorCode = "invalid_image_format"
const ResponseErrorCodeInvalidBase64Image ResponseErrorCode = "invalid_base64_image"
const ResponseErrorCodeInvalidImageURL ResponseErrorCode = "invalid_image_url"
const ResponseErrorCodeImageTooLarge ResponseErrorCode = "image_too_large"
const ResponseErrorCodeImageTooSmall ResponseErrorCode = "image_too_small"
const ResponseErrorCodeImageParseError ResponseErrorCode = "image_parse_error"
const ResponseErrorCodeImageContentPolicyViolation ResponseErrorCode = "image_content_policy_violation"
const ResponseErrorCodeInvalidImageMode ResponseErrorCode = "invalid_image_mode"
const ResponseErrorCodeImageFileTooLarge ResponseErrorCode = "image_file_too_large"
const ResponseErrorCodeUnsupportedImageMediaType ResponseErrorCode = "unsupported_image_media_type"
const ResponseErrorCodeEmptyImageFile ResponseErrorCode = "empty_image_file"
const ResponseErrorCodeFailedToDownloadImage ResponseErrorCode = "failed_to_download_image"
const ResponseErrorCodeImageFileNotFound ResponseErrorCode = "image_file_not_found"
Message string

A human-readable description of the error.

IncompleteDetails ResponseIncompleteDetails

Details about why the response is incomplete.

Reason stringoptional

The reason why the response is incomplete.

Accepts one of the following:
const ResponseIncompleteDetailsReasonMaxOutputTokens ResponseIncompleteDetailsReason = "max_output_tokens"
const ResponseIncompleteDetailsReasonContentFilter ResponseIncompleteDetailsReason = "content_filter"
Instructions ResponseInstructionsUnion

A system (or developer) message inserted into the model's context.

When using along with previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.

Accepts one of the following:
string
type ResponseInstructionsInputItemList []ResponseInputItemUnion

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

Accepts one of the following:
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.

Content EasyInputMessageContentUnion

Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.

Accepts one of the following:
string
type ResponseInputMessageContentList []ResponseInputContentUnion

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role EasyInputMessageRole

The role of the message input. One of user, assistant, system, or developer.

Accepts one of the following:
const EasyInputMessageRoleUser EasyInputMessageRole = "user"
const EasyInputMessageRoleAssistant EasyInputMessageRole = "assistant"
const EasyInputMessageRoleSystem EasyInputMessageRole = "system"
const EasyInputMessageRoleDeveloper EasyInputMessageRole = "developer"
Type EasyInputMessageTypeoptional

The type of the message input. Always message.

type ResponseInputItemMessage 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.

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role string

The role of the message input. One of user, system, or developer.

Accepts one of the following:
const ResponseInputItemMessageRoleUser ResponseInputItemMessageRole = "user"
const ResponseInputItemMessageRoleSystem ResponseInputItemMessageRole = "system"
const ResponseInputItemMessageRoleDeveloper ResponseInputItemMessageRole = "developer"
Status stringoptional

The status of item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemMessageStatusInProgress ResponseInputItemMessageStatus = "in_progress"
const ResponseInputItemMessageStatusCompleted ResponseInputItemMessageStatus = "completed"
const ResponseInputItemMessageStatusIncomplete ResponseInputItemMessageStatus = "incomplete"
Type stringoptional

The type of the message input. Always set to message.

type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

type ResponseInputItemComputerCallOutput struct{…}

The output of a computer tool call.

CallID string

The ID of the computer tool call that produced the output.

maxLength64
minLength1

A computer screenshot image used with the computer use tool.

Type ComputerScreenshot

Specifies the event type. For a computer screenshot, this property is always set to computer_screenshot.

FileID stringoptional

The identifier of an uploaded file that contains the screenshot.

ImageURL stringoptional

The URL of the screenshot image.

Type ComputerCallOutput

The type of the computer tool call output. Always computer_call_output.

ID stringoptional

The ID of the computer tool call output.

AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckoptional

The safety checks reported by the API that have been acknowledged by the developer.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status stringoptional

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseInputItemComputerCallOutputStatusInProgress ResponseInputItemComputerCallOutputStatus = "in_progress"
const ResponseInputItemComputerCallOutputStatusCompleted ResponseInputItemComputerCallOutputStatus = "completed"
const ResponseInputItemComputerCallOutputStatusIncomplete ResponseInputItemComputerCallOutputStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
type ResponseInputItemFunctionCallOutput struct{…}

The output of a function tool call.

CallID string

The unique ID of the function tool call generated by the model.

maxLength64
minLength1
Output ResponseInputItemFunctionCallOutputOutputUnion

Text, image, or file output of the function tool call.

Accepts one of the following:
string
type ResponseFunctionCallOutputItemList []ResponseFunctionCallOutputItemUnion

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

Accepts one of the following:
type ResponseInputTextContent struct{…}

A text input to the model.

Text string

The text input to the model.

maxLength10485760
Type InputText

The type of the input item. Always input_text.

type ResponseInputImageContent struct{…}

An image input to the model. Learn about image inputs

Type InputImage

The type of the input item. Always input_image.

Detail ResponseInputImageContentDetailoptional

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageContentDetailLow ResponseInputImageContentDetail = "low"
const ResponseInputImageContentDetailHigh ResponseInputImageContentDetail = "high"
const ResponseInputImageContentDetailAuto ResponseInputImageContentDetail = "auto"
FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

maxLength20971520
type ResponseInputFileContent struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The base64-encoded data of the file to be sent to the model.

maxLength33554432
FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type FunctionCallOutput

The type of the function tool call output. Always function_call_output.

ID stringoptional

The unique ID of the function tool call output. Populated when this item is returned via API.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemFunctionCallOutputStatusInProgress ResponseInputItemFunctionCallOutputStatus = "in_progress"
const ResponseInputItemFunctionCallOutputStatusCompleted ResponseInputItemFunctionCallOutputStatus = "completed"
const ResponseInputItemFunctionCallOutputStatusIncomplete ResponseInputItemFunctionCallOutputStatus = "incomplete"
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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItemParamResp struct{…}

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

EncryptedContent string

The encrypted content of the compaction summary.

maxLength10485760
Type Compaction

The type of the item. Always compaction.

ID stringoptional

The ID of the compaction item.

type ResponseInputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseInputItemImageGenerationCallStatusInProgress ResponseInputItemImageGenerationCallStatus = "in_progress"
const ResponseInputItemImageGenerationCallStatusCompleted ResponseInputItemImageGenerationCallStatus = "completed"
const ResponseInputItemImageGenerationCallStatusGenerating ResponseInputItemImageGenerationCallStatus = "generating"
const ResponseInputItemImageGenerationCallStatusFailed ResponseInputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseInputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseInputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseInputItemLocalShellCallStatusInProgress ResponseInputItemLocalShellCallStatus = "in_progress"
const ResponseInputItemLocalShellCallStatusCompleted ResponseInputItemLocalShellCallStatus = "completed"
const ResponseInputItemLocalShellCallStatusIncomplete ResponseInputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseInputItemLocalShellCallOutput struct{…}

The output of a local shell tool call.

ID string

The unique ID of the local shell tool call generated by the model.

Output string

A JSON string of the output of the local shell tool call.

Type LocalShellCallOutput

The type of the local shell tool call output. Always local_shell_call_output.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemLocalShellCallOutputStatusInProgress ResponseInputItemLocalShellCallOutputStatus = "in_progress"
const ResponseInputItemLocalShellCallOutputStatusCompleted ResponseInputItemLocalShellCallOutputStatus = "completed"
const ResponseInputItemLocalShellCallOutputStatusIncomplete ResponseInputItemLocalShellCallOutputStatus = "incomplete"
type ResponseInputItemShellCall struct{…}

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

Action ResponseInputItemShellCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string

Ordered shell commands for the execution environment to run.

MaxOutputLength int64optional

Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

TimeoutMs int64optional

Maximum wall-clock time in milliseconds to allow the shell commands to run.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1
Type ShellCall

The type of the item. Always shell_call.

ID stringoptional

The unique ID of the shell tool call. Populated when this item is returned via API.

Status stringoptional

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemShellCallStatusInProgress ResponseInputItemShellCallStatus = "in_progress"
const ResponseInputItemShellCallStatusCompleted ResponseInputItemShellCallStatus = "completed"
const ResponseInputItemShellCallStatusIncomplete ResponseInputItemShellCallStatus = "incomplete"
type ResponseInputItemShellCallOutput struct{…}

The streamed output items emitted by a shell tool call.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1

Captured chunks of stdout and stderr output, along with their associated outcomes.

Outcome ResponseFunctionShellCallOutputContentOutcomeUnion

The exit or timeout outcome associated with this shell call.

Accepts one of the following:
type ResponseFunctionShellCallOutputContentOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellCallOutputContentOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

The exit code returned by the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

Captured stderr output for the shell call.

maxLength10485760
Stdout string

Captured stdout output for the shell call.

maxLength10485760
Type ShellCallOutput

The type of the item. Always shell_call_output.

ID stringoptional

The unique ID of the shell tool call output. Populated when this item is returned via API.

MaxOutputLength int64optional

The maximum number of UTF-8 characters captured for this shell call's combined output.

Status stringoptional

The status of the shell call output.

Accepts one of the following:
const ResponseInputItemShellCallOutputStatusInProgress ResponseInputItemShellCallOutputStatus = "in_progress"
const ResponseInputItemShellCallOutputStatusCompleted ResponseInputItemShellCallOutputStatus = "completed"
const ResponseInputItemShellCallOutputStatusIncomplete ResponseInputItemShellCallOutputStatus = "incomplete"
type ResponseInputItemApplyPatchCall struct{…}

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

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Operation ResponseInputItemApplyPatchCallOperationUnion

The specific create, delete, or update instruction for the apply_patch tool call.

Accepts one of the following:
type ResponseInputItemApplyPatchCallOperationCreateFile struct{…}

Instruction for creating a new file via the apply_patch tool.

Diff string

Unified diff content to apply when creating the file.

maxLength10485760
Path string

Path of the file to create relative to the workspace root.

minLength1
Type CreateFile

The operation type. Always create_file.

type ResponseInputItemApplyPatchCallOperationDeleteFile struct{…}

Instruction for deleting an existing file via the apply_patch tool.

Path string

Path of the file to delete relative to the workspace root.

minLength1
Type DeleteFile

The operation type. Always delete_file.

type ResponseInputItemApplyPatchCallOperationUpdateFile struct{…}

Instruction for updating an existing file via the apply_patch tool.

Diff string

Unified diff content to apply to the existing file.

maxLength10485760
Path string

Path of the file to update relative to the workspace root.

minLength1
Type UpdateFile

The operation type. Always update_file.

Status string

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallStatusInProgress ResponseInputItemApplyPatchCallStatus = "in_progress"
const ResponseInputItemApplyPatchCallStatusCompleted ResponseInputItemApplyPatchCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

ID stringoptional

The unique ID of the apply patch tool call. Populated when this item is returned via API.

type ResponseInputItemApplyPatchCallOutput struct{…}

The streamed output emitted by an apply patch tool call.

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Status string

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallOutputStatusCompleted ResponseInputItemApplyPatchCallOutputStatus = "completed"
const ResponseInputItemApplyPatchCallOutputStatusFailed ResponseInputItemApplyPatchCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

ID stringoptional

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

Output stringoptional

Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

maxLength10485760
type ResponseInputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseInputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseInputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseInputItemMcpApprovalResponse struct{…}

A response to an MCP approval request.

ApprovalRequestID string

The ID of the approval request being answered.

Approve bool

Whether the request was approved.

Type McpApprovalResponse

The type of the item. Always mcp_approval_response.

ID stringoptional

The unique ID of the approval response

Reason stringoptional

Optional reason for the decision.

type ResponseInputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseInputItemMcpCallStatusInProgress ResponseInputItemMcpCallStatus = "in_progress"
const ResponseInputItemMcpCallStatusCompleted ResponseInputItemMcpCallStatus = "completed"
const ResponseInputItemMcpCallStatusIncomplete ResponseInputItemMcpCallStatus = "incomplete"
const ResponseInputItemMcpCallStatusCalling ResponseInputItemMcpCallStatus = "calling"
const ResponseInputItemMcpCallStatusFailed ResponseInputItemMcpCallStatus = "failed"
type ResponseCustomToolCallOutput struct{…}

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

CallID string

The call ID, used to map this custom tool call output to a custom tool call.

Output ResponseCustomToolCallOutputOutputUnion

The output from the custom tool call generated by your code. Can be a string or an list of output content.

Accepts one of the following:
string
type ResponseCustomToolCallOutputOutputOutputContentList []ResponseCustomToolCallOutputOutputOutputContentListItemUnion

Text, image, or file output of the custom tool call.

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type CustomToolCallOutput

The type of the custom tool call output. Always custom_tool_call_output.

ID stringoptional

The unique ID of the custom tool call output in the OpenAI platform.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

type ResponseInputItemItemReference struct{…}

An internal identifier for an item to reference.

ID string

The ID of the item to reference.

Type stringoptional

The type of item to reference. Always item_reference.

Metadata Metadata

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Model ResponsesModel

Model ID used to generate the response, like gpt-4o or o3. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.

Accepts one of the following:
string
type ChatModel string
Accepts one of the following:
const ChatModelGPT5_2 ChatModel = "gpt-5.2"
const ChatModelGPT5_2_2025_12_11 ChatModel = "gpt-5.2-2025-12-11"
const ChatModelGPT5_2ChatLatest ChatModel = "gpt-5.2-chat-latest"
const ChatModelGPT5_2Pro ChatModel = "gpt-5.2-pro"
const ChatModelGPT5_2Pro2025_12_11 ChatModel = "gpt-5.2-pro-2025-12-11"
const ChatModelGPT5_1 ChatModel = "gpt-5.1"
const ChatModelGPT5_1_2025_11_13 ChatModel = "gpt-5.1-2025-11-13"
const ChatModelGPT5_1Codex ChatModel = "gpt-5.1-codex"
const ChatModelGPT5_1Mini ChatModel = "gpt-5.1-mini"
const ChatModelGPT5_1ChatLatest ChatModel = "gpt-5.1-chat-latest"
const ChatModelGPT5 ChatModel = "gpt-5"
const ChatModelGPT5Mini ChatModel = "gpt-5-mini"
const ChatModelGPT5Nano ChatModel = "gpt-5-nano"
const ChatModelGPT5_2025_08_07 ChatModel = "gpt-5-2025-08-07"
const ChatModelGPT5Mini2025_08_07 ChatModel = "gpt-5-mini-2025-08-07"
const ChatModelGPT5Nano2025_08_07 ChatModel = "gpt-5-nano-2025-08-07"
const ChatModelGPT5ChatLatest ChatModel = "gpt-5-chat-latest"
const ChatModelGPT4_1 ChatModel = "gpt-4.1"
const ChatModelGPT4_1Mini ChatModel = "gpt-4.1-mini"
const ChatModelGPT4_1Nano ChatModel = "gpt-4.1-nano"
const ChatModelGPT4_1_2025_04_14 ChatModel = "gpt-4.1-2025-04-14"
const ChatModelGPT4_1Mini2025_04_14 ChatModel = "gpt-4.1-mini-2025-04-14"
const ChatModelGPT4_1Nano2025_04_14 ChatModel = "gpt-4.1-nano-2025-04-14"
const ChatModelO4Mini ChatModel = "o4-mini"
const ChatModelO4Mini2025_04_16 ChatModel = "o4-mini-2025-04-16"
const ChatModelO3 ChatModel = "o3"
const ChatModelO3_2025_04_16 ChatModel = "o3-2025-04-16"
const ChatModelO3Mini ChatModel = "o3-mini"
const ChatModelO3Mini2025_01_31 ChatModel = "o3-mini-2025-01-31"
const ChatModelO1 ChatModel = "o1"
const ChatModelO1_2024_12_17 ChatModel = "o1-2024-12-17"
const ChatModelO1Preview ChatModel = "o1-preview"
const ChatModelO1Preview2024_09_12 ChatModel = "o1-preview-2024-09-12"
const ChatModelO1Mini ChatModel = "o1-mini"
const ChatModelO1Mini2024_09_12 ChatModel = "o1-mini-2024-09-12"
const ChatModelGPT4o ChatModel = "gpt-4o"
const ChatModelGPT4o2024_11_20 ChatModel = "gpt-4o-2024-11-20"
const ChatModelGPT4o2024_08_06 ChatModel = "gpt-4o-2024-08-06"
const ChatModelGPT4o2024_05_13 ChatModel = "gpt-4o-2024-05-13"
const ChatModelGPT4oAudioPreview ChatModel = "gpt-4o-audio-preview"
const ChatModelGPT4oAudioPreview2024_10_01 ChatModel = "gpt-4o-audio-preview-2024-10-01"
const ChatModelGPT4oAudioPreview2024_12_17 ChatModel = "gpt-4o-audio-preview-2024-12-17"
const ChatModelGPT4oAudioPreview2025_06_03 ChatModel = "gpt-4o-audio-preview-2025-06-03"
const ChatModelGPT4oMiniAudioPreview ChatModel = "gpt-4o-mini-audio-preview"
const ChatModelGPT4oMiniAudioPreview2024_12_17 ChatModel = "gpt-4o-mini-audio-preview-2024-12-17"
const ChatModelGPT4oSearchPreview ChatModel = "gpt-4o-search-preview"
const ChatModelGPT4oMiniSearchPreview ChatModel = "gpt-4o-mini-search-preview"
const ChatModelGPT4oSearchPreview2025_03_11 ChatModel = "gpt-4o-search-preview-2025-03-11"
const ChatModelGPT4oMiniSearchPreview2025_03_11 ChatModel = "gpt-4o-mini-search-preview-2025-03-11"
const ChatModelChatgpt4oLatest ChatModel = "chatgpt-4o-latest"
const ChatModelCodexMiniLatest ChatModel = "codex-mini-latest"
const ChatModelGPT4oMini ChatModel = "gpt-4o-mini"
const ChatModelGPT4oMini2024_07_18 ChatModel = "gpt-4o-mini-2024-07-18"
const ChatModelGPT4Turbo ChatModel = "gpt-4-turbo"
const ChatModelGPT4Turbo2024_04_09 ChatModel = "gpt-4-turbo-2024-04-09"
const ChatModelGPT4_0125Preview ChatModel = "gpt-4-0125-preview"
const ChatModelGPT4TurboPreview ChatModel = "gpt-4-turbo-preview"
const ChatModelGPT4_1106Preview ChatModel = "gpt-4-1106-preview"
const ChatModelGPT4VisionPreview ChatModel = "gpt-4-vision-preview"
const ChatModelGPT4 ChatModel = "gpt-4"
const ChatModelGPT4_0314 ChatModel = "gpt-4-0314"
const ChatModelGPT4_0613 ChatModel = "gpt-4-0613"
const ChatModelGPT4_32k ChatModel = "gpt-4-32k"
const ChatModelGPT4_32k0314 ChatModel = "gpt-4-32k-0314"
const ChatModelGPT4_32k0613 ChatModel = "gpt-4-32k-0613"
const ChatModelGPT3_5Turbo ChatModel = "gpt-3.5-turbo"
const ChatModelGPT3_5Turbo16k ChatModel = "gpt-3.5-turbo-16k"
const ChatModelGPT3_5Turbo0301 ChatModel = "gpt-3.5-turbo-0301"
const ChatModelGPT3_5Turbo0613 ChatModel = "gpt-3.5-turbo-0613"
const ChatModelGPT3_5Turbo1106 ChatModel = "gpt-3.5-turbo-1106"
const ChatModelGPT3_5Turbo0125 ChatModel = "gpt-3.5-turbo-0125"
const ChatModelGPT3_5Turbo16k0613 ChatModel = "gpt-3.5-turbo-16k-0613"
type ResponsesModel string
Accepts one of the following:
const ResponsesModelO1Pro ResponsesModel = "o1-pro"
const ResponsesModelO1Pro2025_03_19 ResponsesModel = "o1-pro-2025-03-19"
const ResponsesModelO3Pro ResponsesModel = "o3-pro"
const ResponsesModelO3Pro2025_06_10 ResponsesModel = "o3-pro-2025-06-10"
const ResponsesModelO3DeepResearch ResponsesModel = "o3-deep-research"
const ResponsesModelO3DeepResearch2025_06_26 ResponsesModel = "o3-deep-research-2025-06-26"
const ResponsesModelO4MiniDeepResearch ResponsesModel = "o4-mini-deep-research"
const ResponsesModelO4MiniDeepResearch2025_06_26 ResponsesModel = "o4-mini-deep-research-2025-06-26"
const ResponsesModelComputerUsePreview ResponsesModel = "computer-use-preview"
const ResponsesModelComputerUsePreview2025_03_11 ResponsesModel = "computer-use-preview-2025-03-11"
const ResponsesModelGPT5Codex ResponsesModel = "gpt-5-codex"
const ResponsesModelGPT5Pro ResponsesModel = "gpt-5-pro"
const ResponsesModelGPT5Pro2025_10_06 ResponsesModel = "gpt-5-pro-2025-10-06"
const ResponsesModelGPT5_1CodexMax ResponsesModel = "gpt-5.1-codex-max"
Object Response

The object type of this resource - always set to response.

An array of content items generated by the model.

  • The length and order of items in the output array is dependent on the model's response.
  • Rather than accessing the first item in the output array and assuming it's an assistant message with the content generated by the model, you might consider using the output_text property where supported in SDKs.
Accepts one of the following:
type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItem struct{…}

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

ID string

The unique ID of the compaction item.

EncryptedContent string

The encrypted content that was produced by compaction.

Type Compaction

The type of the item. Always compaction.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseOutputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseOutputItemImageGenerationCallStatusInProgress ResponseOutputItemImageGenerationCallStatus = "in_progress"
const ResponseOutputItemImageGenerationCallStatusCompleted ResponseOutputItemImageGenerationCallStatus = "completed"
const ResponseOutputItemImageGenerationCallStatusGenerating ResponseOutputItemImageGenerationCallStatus = "generating"
const ResponseOutputItemImageGenerationCallStatusFailed ResponseOutputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseOutputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseOutputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseOutputItemLocalShellCallStatusInProgress ResponseOutputItemLocalShellCallStatus = "in_progress"
const ResponseOutputItemLocalShellCallStatusCompleted ResponseOutputItemLocalShellCallStatus = "completed"
const ResponseOutputItemLocalShellCallStatusIncomplete ResponseOutputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseFunctionShellToolCall struct{…}

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

ID string

The unique ID of the shell tool call. Populated when this item is returned via API.

Action ResponseFunctionShellToolCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string
MaxOutputLength int64

Optional maximum number of characters to return from each command.

TimeoutMs int64

Optional timeout in milliseconds for the commands.

CallID string

The unique ID of the shell tool call generated by the model.

Status ResponseFunctionShellToolCallStatus

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallStatusInProgress ResponseFunctionShellToolCallStatus = "in_progress"
const ResponseFunctionShellToolCallStatusCompleted ResponseFunctionShellToolCallStatus = "completed"
const ResponseFunctionShellToolCallStatusIncomplete ResponseFunctionShellToolCallStatus = "incomplete"
Type ShellCall

The type of the item. Always shell_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseFunctionShellToolCallOutput struct{…}

The output of a shell tool call that was emitted.

ID string

The unique ID of the shell call output. Populated when this item is returned via API.

CallID string

The unique ID of the shell tool call generated by the model.

MaxOutputLength int64

The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output.

Output []ResponseFunctionShellToolCallOutputOutput

An array of shell call output contents

Outcome ResponseFunctionShellToolCallOutputOutputOutcomeUnion

Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

Accepts one of the following:
type ResponseFunctionShellToolCallOutputOutputOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellToolCallOutputOutputOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

Exit code from the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

The standard error output that was captured.

Stdout string

The standard output that was captured.

CreatedBy stringoptional

The identifier of the actor that created the item.

Status ResponseFunctionShellToolCallOutputStatus

The status of the shell call output. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallOutputStatusInProgress ResponseFunctionShellToolCallOutputStatus = "in_progress"
const ResponseFunctionShellToolCallOutputStatusCompleted ResponseFunctionShellToolCallOutputStatus = "completed"
const ResponseFunctionShellToolCallOutputStatusIncomplete ResponseFunctionShellToolCallOutputStatus = "incomplete"
Type ShellCallOutput

The type of the shell call output. Always shell_call_output.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseApplyPatchToolCall struct{…}

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

ID string

The unique ID of the apply patch tool call. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Operation ResponseApplyPatchToolCallOperationUnion

One of the create_file, delete_file, or update_file operations applied via apply_patch.

Accepts one of the following:
type ResponseApplyPatchToolCallOperationCreateFile struct{…}

Instruction describing how to create a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to create.

Type CreateFile

Create a new file with the provided diff.

type ResponseApplyPatchToolCallOperationDeleteFile struct{…}

Instruction describing how to delete a file via the apply_patch tool.

Path string

Path of the file to delete.

Type DeleteFile

Delete the specified file.

type ResponseApplyPatchToolCallOperationUpdateFile struct{…}

Instruction describing how to update a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to update.

Type UpdateFile

Update an existing file with the provided diff.

Status ResponseApplyPatchToolCallStatus

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseApplyPatchToolCallStatusInProgress ResponseApplyPatchToolCallStatus = "in_progress"
const ResponseApplyPatchToolCallStatusCompleted ResponseApplyPatchToolCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseApplyPatchToolCallOutput struct{…}

The output emitted by an apply patch tool call.

ID string

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Status ResponseApplyPatchToolCallOutputStatus

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseApplyPatchToolCallOutputStatusCompleted ResponseApplyPatchToolCallOutputStatus = "completed"
const ResponseApplyPatchToolCallOutputStatusFailed ResponseApplyPatchToolCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

CreatedBy stringoptional

The ID of the entity that created this tool call output.

Output stringoptional

Optional textual output returned by the apply patch tool.

type ResponseOutputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseOutputItemMcpCallStatusInProgress ResponseOutputItemMcpCallStatus = "in_progress"
const ResponseOutputItemMcpCallStatusCompleted ResponseOutputItemMcpCallStatus = "completed"
const ResponseOutputItemMcpCallStatusIncomplete ResponseOutputItemMcpCallStatus = "incomplete"
const ResponseOutputItemMcpCallStatusCalling ResponseOutputItemMcpCallStatus = "calling"
const ResponseOutputItemMcpCallStatusFailed ResponseOutputItemMcpCallStatus = "failed"
type ResponseOutputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseOutputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseOutputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

ParallelToolCalls bool

Whether to allow the model to run tool calls in parallel.

Temperature float64

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.

minimum0
maximum2
ToolChoice ResponseToolChoiceUnion

How the model should select which tool (or tools) to use when generating a response. See the tools parameter to see how to specify which tools the model can call.

Accepts one of the following:
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.

Accepts one of the following:
const ToolChoiceOptionsNone ToolChoiceOptions = "none"
const ToolChoiceOptionsAuto ToolChoiceOptions = "auto"
const ToolChoiceOptionsRequired ToolChoiceOptions = "required"
type ToolChoiceAllowed struct{…}

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

Mode ToolChoiceAllowedMode

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

auto allows the model to pick from among the allowed tools and generate a message.

required requires the model to call one or more of the allowed tools.

Accepts one of the following:
const ToolChoiceAllowedModeAuto ToolChoiceAllowedMode = "auto"
const ToolChoiceAllowedModeRequired ToolChoiceAllowedMode = "required"
Tools []map[string, any]

A list of tool definitions that the model should be allowed to call.

For the Responses API, the list of tool definitions might look like:

[
  { "type": "function", "name": "get_weather" },
  { "type": "mcp", "server_label": "deepwiki" },
  { "type": "image_generation" }
]
Type AllowedTools

Allowed tool configuration type. Always allowed_tools.

type ToolChoiceTypes struct{…}

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

Type ToolChoiceTypesType

The type of hosted tool the model should to use. Learn more about built-in tools.

Allowed values are:

  • file_search
  • web_search_preview
  • computer_use_preview
  • code_interpreter
  • image_generation
Accepts one of the following:
const ToolChoiceTypesTypeFileSearch ToolChoiceTypesType = "file_search"
const ToolChoiceTypesTypeWebSearchPreview ToolChoiceTypesType = "web_search_preview"
const ToolChoiceTypesTypeComputerUsePreview ToolChoiceTypesType = "computer_use_preview"
const ToolChoiceTypesTypeWebSearchPreview2025_03_11 ToolChoiceTypesType = "web_search_preview_2025_03_11"
const ToolChoiceTypesTypeImageGeneration ToolChoiceTypesType = "image_generation"
const ToolChoiceTypesTypeCodeInterpreter ToolChoiceTypesType = "code_interpreter"
type ToolChoiceFunction struct{…}

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

Name string

The name of the function to call.

Type Function

For function calling, the type is always function.

type ToolChoiceMcp struct{…}

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

ServerLabel string

The label of the MCP server to use.

Type Mcp

For MCP tools, the type is always mcp.

Name stringoptional

The name of the tool to call on the server.

type ToolChoiceCustom struct{…}

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

Name string

The name of the custom tool to call.

Type Custom

For custom tool calling, the type is always custom.

type ToolChoiceApplyPatch struct{…}

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

Type ApplyPatch

The tool to call. Always apply_patch.

type ToolChoiceShell struct{…}

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

Type Shell

The tool to call. Always shell.

Tools []ToolUnion

An array of tools the model may call while generating a response. You can specify which tool to use by setting the tool_choice parameter.

We support the following categories of tools:

  • Built-in tools: Tools that are provided by OpenAI that extend the model's capabilities, like web search or file search. Learn more about built-in tools.
  • MCP Tools: Integrations with third-party systems via custom MCP servers or predefined connectors such as Google Drive and SharePoint. Learn more about MCP Tools.
  • Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code with strongly typed arguments and outputs. Learn more about function calling. You can also use custom tools to call your own code.
Accepts one of the following:
type FunctionTool struct{…}

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

Name string

The name of the function to call.

Parameters map[string, any]

A JSON schema object describing the parameters of the function.

Strict bool

Whether to enforce strict parameter validation. Default true.

Type Function

The type of the function tool. Always function.

Description stringoptional

A description of the function. Used by the model to determine whether or not to call the function.

type FileSearchTool struct{…}

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

Type FileSearch

The type of the file search tool. Always file_search.

VectorStoreIDs []string

The IDs of the vector stores to search.

Filters FileSearchToolFiltersUnionoptional

A filter to apply.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
type CompoundFilter struct{…}

Combine multiple filters using and or or.

Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
Type CompoundFilterType

Type of operation: and or or.

Accepts one of the following:
const CompoundFilterTypeAnd CompoundFilterType = "and"
const CompoundFilterTypeOr CompoundFilterType = "or"
MaxNumResults int64optional

The maximum number of results to return. This number should be between 1 and 50 inclusive.

RankingOptions FileSearchToolRankingOptionsoptional

Ranking options for search.

Ranker stringoptional

The ranker to use for the file search.

Accepts one of the following:
const FileSearchToolRankingOptionsRankerAuto FileSearchToolRankingOptionsRanker = "auto"
const FileSearchToolRankingOptionsRankerDefault2024_11_15 FileSearchToolRankingOptionsRanker = "default-2024-11-15"
ScoreThreshold float64optional

The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.

type ComputerTool struct{…}

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

DisplayHeight int64

The height of the computer display.

DisplayWidth int64

The width of the computer display.

Environment ComputerToolEnvironment

The type of computer environment to control.

Accepts one of the following:
const ComputerToolEnvironmentWindows ComputerToolEnvironment = "windows"
const ComputerToolEnvironmentMac ComputerToolEnvironment = "mac"
const ComputerToolEnvironmentLinux ComputerToolEnvironment = "linux"
const ComputerToolEnvironmentUbuntu ComputerToolEnvironment = "ubuntu"
const ComputerToolEnvironmentBrowser ComputerToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type WebSearchTool struct{…}

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

Type WebSearchToolType

The type of the web search tool. One of web_search or web_search_2025_08_26.

Accepts one of the following:
const WebSearchToolTypeWebSearch WebSearchToolType = "web_search"
const WebSearchToolTypeWebSearch2025_08_26 WebSearchToolType = "web_search_2025_08_26"
Filters WebSearchToolFiltersoptional

Filters for the search.

AllowedDomains []stringoptional

Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.

Example: ["pubmed.ncbi.nlm.nih.gov"]

SearchContextSize WebSearchToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchToolSearchContextSizeLow WebSearchToolSearchContextSize = "low"
const WebSearchToolSearchContextSizeMedium WebSearchToolSearchContextSize = "medium"
const WebSearchToolSearchContextSizeHigh WebSearchToolSearchContextSize = "high"
UserLocation WebSearchToolUserLocationoptional

The approximate location of the user.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

Type stringoptional

The type of location approximation. Always approximate.

type ToolMcp struct{…}

Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.

ServerLabel string

A label for this MCP server, used to identify it in tool calls.

Type Mcp

The type of the MCP tool. Always mcp.

AllowedTools ToolMcpAllowedToolsUnionoptional

List of allowed tool names or a filter object.

Accepts one of the following:
type ToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type ToolMcpAllowedToolsMcpToolFilter struct{…}

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Authorization stringoptional

An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.

ConnectorID stringoptional

Identifier for service connectors, like those available in ChatGPT. One of server_url or connector_id must be provided. Learn more about service connectors here.

Currently supported connector_id values are:

  • Dropbox: connector_dropbox
  • Gmail: connector_gmail
  • Google Calendar: connector_googlecalendar
  • Google Drive: connector_googledrive
  • Microsoft Teams: connector_microsoftteams
  • Outlook Calendar: connector_outlookcalendar
  • Outlook Email: connector_outlookemail
  • SharePoint: connector_sharepoint
Accepts one of the following:
const ToolMcpConnectorIDConnectorDropbox ToolMcpConnectorID = "connector_dropbox"
const ToolMcpConnectorIDConnectorGmail ToolMcpConnectorID = "connector_gmail"
const ToolMcpConnectorIDConnectorGooglecalendar ToolMcpConnectorID = "connector_googlecalendar"
const ToolMcpConnectorIDConnectorGoogledrive ToolMcpConnectorID = "connector_googledrive"
const ToolMcpConnectorIDConnectorMicrosoftteams ToolMcpConnectorID = "connector_microsoftteams"
const ToolMcpConnectorIDConnectorOutlookcalendar ToolMcpConnectorID = "connector_outlookcalendar"
const ToolMcpConnectorIDConnectorOutlookemail ToolMcpConnectorID = "connector_outlookemail"
const ToolMcpConnectorIDConnectorSharepoint ToolMcpConnectorID = "connector_sharepoint"
Headers map[string, string]optional

Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.

RequireApproval ToolMcpRequireApprovalUnionoptional

Specify which of the MCP server's tools require approval.

Accepts one of the following:
type ToolMcpRequireApprovalMcpToolApprovalFilter struct{…}

Specify which of the MCP server's tools require approval. Can be always, never, or a filter object associated with tools that require approval.

Always ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysoptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Never ToolMcpRequireApprovalMcpToolApprovalFilterNeveroptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

type ToolMcpRequireApprovalMcpToolApprovalSetting string

Specify a single approval policy for all tools. One of always or never. When set to always, all tools will require approval. When set to never, all tools will not require approval.

Accepts one of the following:
const ToolMcpRequireApprovalMcpToolApprovalSettingAlways ToolMcpRequireApprovalMcpToolApprovalSetting = "always"
const ToolMcpRequireApprovalMcpToolApprovalSettingNever ToolMcpRequireApprovalMcpToolApprovalSetting = "never"
ServerDescription stringoptional

Optional description of the MCP server, used to provide more context.

ServerURL stringoptional

The URL for the MCP server. One of server_url or connector_id must be provided.

type ToolCodeInterpreter struct{…}

A tool that runs Python code to help generate a response to a prompt.

Container ToolCodeInterpreterContainerUnion

The code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional memory_limit setting.

Accepts one of the following:
string
type ToolCodeInterpreterContainerCodeInterpreterContainerAuto struct{…}

Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

Type Auto

Always auto.

FileIDs []stringoptional

An optional list of uploaded files to make available to your code.

MemoryLimit stringoptional

The memory limit for the code interpreter container.

Accepts one of the following:
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
Type CodeInterpreter

The type of the code interpreter tool. Always code_interpreter.

type ToolImageGeneration struct{…}

A tool that generates images using the GPT image models.

Type ImageGeneration

The type of the image generation tool. Always image_generation.

Action stringoptional

Whether to generate a new image or edit an existing image. Default: auto.

Accepts one of the following:
const ToolImageGenerationActionGenerate ToolImageGenerationAction = "generate"
const ToolImageGenerationActionEdit ToolImageGenerationAction = "edit"
const ToolImageGenerationActionAuto ToolImageGenerationAction = "auto"
Background stringoptional

Background type for the generated image. One of transparent, opaque, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationBackgroundTransparent ToolImageGenerationBackground = "transparent"
const ToolImageGenerationBackgroundOpaque ToolImageGenerationBackground = "opaque"
const ToolImageGenerationBackgroundAuto ToolImageGenerationBackground = "auto"
InputFidelity stringoptional

Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for gpt-image-1 and gpt-image-1.5 and later models, unsupported for gpt-image-1-mini. Supports high and low. Defaults to low.

Accepts one of the following:
const ToolImageGenerationInputFidelityHigh ToolImageGenerationInputFidelity = "high"
const ToolImageGenerationInputFidelityLow ToolImageGenerationInputFidelity = "low"
InputImageMask ToolImageGenerationInputImageMaskoptional

Optional mask for inpainting. Contains image_url (string, optional) and file_id (string, optional).

FileID stringoptional

File ID for the mask image.

ImageURL stringoptional

Base64-encoded mask image.

Model stringoptional

The image generation model to use. Default: gpt-image-1.

Accepts one of the following:
string
string
Accepts one of the following:
const ToolImageGenerationModelGPTImage1 ToolImageGenerationModel = "gpt-image-1"
const ToolImageGenerationModelGPTImage1Mini ToolImageGenerationModel = "gpt-image-1-mini"
const ToolImageGenerationModelGPTImage1_5 ToolImageGenerationModel = "gpt-image-1.5"
Moderation stringoptional

Moderation level for the generated image. Default: auto.

Accepts one of the following:
const ToolImageGenerationModerationAuto ToolImageGenerationModeration = "auto"
const ToolImageGenerationModerationLow ToolImageGenerationModeration = "low"
OutputCompression int64optional

Compression level for the output image. Default: 100.

minimum0
maximum100
OutputFormat stringoptional

The output format of the generated image. One of png, webp, or jpeg. Default: png.

Accepts one of the following:
const ToolImageGenerationOutputFormatPNG ToolImageGenerationOutputFormat = "png"
const ToolImageGenerationOutputFormatWebP ToolImageGenerationOutputFormat = "webp"
const ToolImageGenerationOutputFormatJPEG ToolImageGenerationOutputFormat = "jpeg"
PartialImages int64optional

Number of partial images to generate in streaming mode, from 0 (default value) to 3.

minimum0
maximum3
Quality stringoptional

The quality of the generated image. One of low, medium, high, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationQualityLow ToolImageGenerationQuality = "low"
const ToolImageGenerationQualityMedium ToolImageGenerationQuality = "medium"
const ToolImageGenerationQualityHigh ToolImageGenerationQuality = "high"
const ToolImageGenerationQualityAuto ToolImageGenerationQuality = "auto"
Size stringoptional

The size of the generated image. One of 1024x1024, 1024x1536, 1536x1024, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationSize1024x1024 ToolImageGenerationSize = "1024x1024"
const ToolImageGenerationSize1024x1536 ToolImageGenerationSize = "1024x1536"
const ToolImageGenerationSize1536x1024 ToolImageGenerationSize = "1536x1024"
const ToolImageGenerationSizeAuto ToolImageGenerationSize = "auto"
type ToolLocalShell struct{…}

A tool that allows the model to execute shell commands in a local environment.

Type LocalShell

The type of the local shell tool. Always local_shell.

type FunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

type CustomTool struct{…}

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

Name string

The name of the custom tool, used to identify it in tool calls.

Type Custom

The type of the custom tool. Always custom.

Description stringoptional

Optional description of the custom tool, used to provide more context.

The input format for the custom tool. Default is unconstrained text.

Accepts one of the following:
type CustomToolInputFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

type CustomToolInputFormatGrammar struct{…}

A grammar defined by the user.

Definition string

The grammar definition.

Syntax string

The syntax of the grammar definition. One of lark or regex.

Accepts one of the following:
const CustomToolInputFormatGrammarSyntaxLark CustomToolInputFormatGrammarSyntax = "lark"
const CustomToolInputFormatGrammarSyntaxRegex CustomToolInputFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

type WebSearchPreviewTool struct{…}

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

Type WebSearchPreviewToolType

The type of the web search tool. One of web_search_preview or web_search_preview_2025_03_11.

Accepts one of the following:
const WebSearchPreviewToolTypeWebSearchPreview WebSearchPreviewToolType = "web_search_preview"
const WebSearchPreviewToolTypeWebSearchPreview2025_03_11 WebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContextSize WebSearchPreviewToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchPreviewToolSearchContextSizeLow WebSearchPreviewToolSearchContextSize = "low"
const WebSearchPreviewToolSearchContextSizeMedium WebSearchPreviewToolSearchContextSize = "medium"
const WebSearchPreviewToolSearchContextSizeHigh WebSearchPreviewToolSearchContextSize = "high"
UserLocation WebSearchPreviewToolUserLocationoptional

The user's location.

Type Approximate

The type of location approximation. Always approximate.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

type ApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

TopP float64

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

minimum0
maximum1
Background booloptional

Whether to run the model response in the background. Learn more.

CompletedAt float64optional

Unix timestamp (in seconds) of when this Response was completed. Only present when the status is completed.

Conversation ResponseConversationoptional

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

ID string

The unique ID of the conversation that this response was associated with.

MaxOutputTokens int64optional

An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.

MaxToolCalls int64optional

The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

PreviousResponseID stringoptional

The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state. Cannot be used in conjunction with conversation.

Prompt ResponsePromptoptional

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

ID string

The unique identifier of the prompt template to use.

Variables map[string, ResponsePromptVariableUnion]optional

Optional map of values to substitute in for variables in your prompt. The substitution values can either be strings, or other Response input types like images or files.

Accepts one of the following:
string
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Version stringoptional

Optional version of the prompt template.

PromptCacheKey stringoptional

Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the user field. Learn more.

PromptCacheRetention ResponsePromptCacheRetentionoptional

The retention policy for the prompt cache. Set to 24h to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. Learn more.

Accepts one of the following:
const ResponsePromptCacheRetentionInMemory ResponsePromptCacheRetention = "in-memory"
const ResponsePromptCacheRetention24h ResponsePromptCacheRetention = "24h"
Reasoning Reasoningoptional

gpt-5 and o-series models only

Configuration options for reasoning models.

Effort ReasoningEffortoptional

Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, and xhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.

  • gpt-5.1 defaults to none, which does not perform reasoning. The supported reasoning values for gpt-5.1 are none, low, medium, and high. Tool calls are supported for all reasoning values in gpt-5.1.
  • All models before gpt-5.1 default to medium reasoning effort, and do not support none.
  • The gpt-5-pro model defaults to (and only supports) high reasoning effort.
  • xhigh is supported for all models after gpt-5.1-codex-max.
Accepts one of the following:
const ReasoningEffortNone ReasoningEffort = "none"
const ReasoningEffortMinimal ReasoningEffort = "minimal"
const ReasoningEffortLow ReasoningEffort = "low"
const ReasoningEffortMedium ReasoningEffort = "medium"
const ReasoningEffortHigh ReasoningEffort = "high"
const ReasoningEffortXhigh ReasoningEffort = "xhigh"
DeprecatedGenerateSummary ReasoningGenerateSummaryoptional

Deprecated: use summary instead.

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.

Accepts one of the following:
const ReasoningGenerateSummaryAuto ReasoningGenerateSummary = "auto"
const ReasoningGenerateSummaryConcise ReasoningGenerateSummary = "concise"
const ReasoningGenerateSummaryDetailed ReasoningGenerateSummary = "detailed"
Summary ReasoningSummaryoptional

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.

concise is supported for computer-use-preview models and all reasoning models after gpt-5.

Accepts one of the following:
const ReasoningSummaryAuto ReasoningSummary = "auto"
const ReasoningSummaryConcise ReasoningSummary = "concise"
const ReasoningSummaryDetailed ReasoningSummary = "detailed"
SafetyIdentifier stringoptional

A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. Learn more.

ServiceTier ResponseServiceTieroptional

Specifies the processing type used for serving the request.

  • If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
  • If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
  • If set to 'flex' or 'priority', then the request will be processed with the corresponding service tier.
  • When not set, the default behavior is 'auto'.

When the service_tier parameter is set, the response body will include the service_tier value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

Accepts one of the following:
const ResponseServiceTierAuto ResponseServiceTier = "auto"
const ResponseServiceTierDefault ResponseServiceTier = "default"
const ResponseServiceTierFlex ResponseServiceTier = "flex"
const ResponseServiceTierScale ResponseServiceTier = "scale"
const ResponseServiceTierPriority ResponseServiceTier = "priority"
Status ResponseStatusoptional

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

Accepts one of the following:
const ResponseStatusCompleted ResponseStatus = "completed"
const ResponseStatusFailed ResponseStatus = "failed"
const ResponseStatusInProgress ResponseStatus = "in_progress"
const ResponseStatusCancelled ResponseStatus = "cancelled"
const ResponseStatusQueued ResponseStatus = "queued"
const ResponseStatusIncomplete ResponseStatus = "incomplete"
Text ResponseTextConfigoptional

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

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.

Accepts one of the following:
type ResponseFormatText struct{…}

Default response format. Used to generate text responses.

Type Text

The type of response format being defined. Always text.

type ResponseFormatTextJSONSchemaConfig struct{…}

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

Name string

The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.

Schema map[string, any]

The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.

Type JSONSchema

The type of response format being defined. Always json_schema.

Description stringoptional

A description of what the response format is for, used by the model to determine how to respond in the format.

Strict booloptional

Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true. To learn more, read the Structured Outputs guide.

type ResponseFormatJSONObject struct{…}

JSON object response format. An older method of generating JSON responses. Using json_schema is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.

Type JSONObject

The type of response format being defined. Always json_object.

Verbosity ResponseTextConfigVerbosityoptional

Constrains the verbosity of the model's response. Lower values will result in more concise responses, while higher values will result in more verbose responses. Currently supported values are low, medium, and high.

Accepts one of the following:
const ResponseTextConfigVerbosityLow ResponseTextConfigVerbosity = "low"
const ResponseTextConfigVerbosityMedium ResponseTextConfigVerbosity = "medium"
const ResponseTextConfigVerbosityHigh ResponseTextConfigVerbosity = "high"
TopLogprobs int64optional

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.

minimum0
maximum20
Truncation ResponseTruncationoptional

The truncation strategy to use for the model response.

  • auto: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation.
  • disabled (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.
Accepts one of the following:
const ResponseTruncationAuto ResponseTruncation = "auto"
const ResponseTruncationDisabled ResponseTruncation = "disabled"
Usage ResponseUsageoptional

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

InputTokens int64

The number of input tokens.

InputTokensDetails ResponseUsageInputTokensDetails

A detailed breakdown of the input tokens.

CachedTokens int64

The number of tokens that were retrieved from the cache. More on prompt caching.

OutputTokens int64

The number of output tokens.

OutputTokensDetails ResponseUsageOutputTokensDetails

A detailed breakdown of the output tokens.

ReasoningTokens int64

The number of reasoning tokens.

TotalTokens int64

The total number of tokens used.

DeprecatedUser stringoptional

This field is being replaced by safety_identifier and prompt_cache_key. Use prompt_cache_key instead to maintain caching optimizations. A stable identifier for your end-users. Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. Learn more.

SequenceNumber int64

The sequence number for this event.

Type ResponseCreated

The type of the event. Always response.created.

type ResponseErrorEvent struct{…}

Emitted when an error occurs.

Code string

The error code.

Message string

The error message.

Param string

The error parameter.

SequenceNumber int64

The sequence number of this event.

Type Error

The type of the event. Always error.

type ResponseFileSearchCallCompletedEvent struct{…}

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

ItemID string

The ID of the output item that the file search call is initiated.

OutputIndex int64

The index of the output item that the file search call is initiated.

SequenceNumber int64

The sequence number of this event.

Type ResponseFileSearchCallCompleted

The type of the event. Always response.file_search_call.completed.

type ResponseFileSearchCallInProgressEvent struct{…}

Emitted when a file search call is initiated.

ItemID string

The ID of the output item that the file search call is initiated.

OutputIndex int64

The index of the output item that the file search call is initiated.

SequenceNumber int64

The sequence number of this event.

Type ResponseFileSearchCallInProgress

The type of the event. Always response.file_search_call.in_progress.

type ResponseFileSearchCallSearchingEvent struct{…}

Emitted when a file search is currently searching.

ItemID string

The ID of the output item that the file search call is initiated.

OutputIndex int64

The index of the output item that the file search call is searching.

SequenceNumber int64

The sequence number of this event.

Type ResponseFileSearchCallSearching

The type of the event. Always response.file_search_call.searching.

type ResponseFunctionCallArgumentsDeltaEvent struct{…}

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

Delta string

The function-call arguments delta that is added.

ItemID string

The ID of the output item that the function-call arguments delta is added to.

OutputIndex int64

The index of the output item that the function-call arguments delta is added to.

SequenceNumber int64

The sequence number of this event.

Type ResponseFunctionCallArgumentsDelta

The type of the event. Always response.function_call_arguments.delta.

type ResponseFunctionCallArgumentsDoneEvent struct{…}

Emitted when function-call arguments are finalized.

Arguments string

The function-call arguments.

ItemID string

The ID of the item.

Name string

The name of the function that was called.

OutputIndex int64

The index of the output item.

SequenceNumber int64

The sequence number of this event.

Type ResponseFunctionCallArgumentsDone
type ResponseInProgressEvent struct{…}

Emitted when the response is in progress.

Response Response

The response that is in progress.

ID string

Unique identifier for this Response.

CreatedAt float64

Unix timestamp (in seconds) of when this Response was created.

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

Code ResponseErrorCode

The error code for the response.

Accepts one of the following:
const ResponseErrorCodeServerError ResponseErrorCode = "server_error"
const ResponseErrorCodeRateLimitExceeded ResponseErrorCode = "rate_limit_exceeded"
const ResponseErrorCodeInvalidPrompt ResponseErrorCode = "invalid_prompt"
const ResponseErrorCodeVectorStoreTimeout ResponseErrorCode = "vector_store_timeout"
const ResponseErrorCodeInvalidImage ResponseErrorCode = "invalid_image"
const ResponseErrorCodeInvalidImageFormat ResponseErrorCode = "invalid_image_format"
const ResponseErrorCodeInvalidBase64Image ResponseErrorCode = "invalid_base64_image"
const ResponseErrorCodeInvalidImageURL ResponseErrorCode = "invalid_image_url"
const ResponseErrorCodeImageTooLarge ResponseErrorCode = "image_too_large"
const ResponseErrorCodeImageTooSmall ResponseErrorCode = "image_too_small"
const ResponseErrorCodeImageParseError ResponseErrorCode = "image_parse_error"
const ResponseErrorCodeImageContentPolicyViolation ResponseErrorCode = "image_content_policy_violation"
const ResponseErrorCodeInvalidImageMode ResponseErrorCode = "invalid_image_mode"
const ResponseErrorCodeImageFileTooLarge ResponseErrorCode = "image_file_too_large"
const ResponseErrorCodeUnsupportedImageMediaType ResponseErrorCode = "unsupported_image_media_type"
const ResponseErrorCodeEmptyImageFile ResponseErrorCode = "empty_image_file"
const ResponseErrorCodeFailedToDownloadImage ResponseErrorCode = "failed_to_download_image"
const ResponseErrorCodeImageFileNotFound ResponseErrorCode = "image_file_not_found"
Message string

A human-readable description of the error.

IncompleteDetails ResponseIncompleteDetails

Details about why the response is incomplete.

Reason stringoptional

The reason why the response is incomplete.

Accepts one of the following:
const ResponseIncompleteDetailsReasonMaxOutputTokens ResponseIncompleteDetailsReason = "max_output_tokens"
const ResponseIncompleteDetailsReasonContentFilter ResponseIncompleteDetailsReason = "content_filter"
Instructions ResponseInstructionsUnion

A system (or developer) message inserted into the model's context.

When using along with previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.

Accepts one of the following:
string
type ResponseInstructionsInputItemList []ResponseInputItemUnion

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

Accepts one of the following:
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.

Content EasyInputMessageContentUnion

Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.

Accepts one of the following:
string
type ResponseInputMessageContentList []ResponseInputContentUnion

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role EasyInputMessageRole

The role of the message input. One of user, assistant, system, or developer.

Accepts one of the following:
const EasyInputMessageRoleUser EasyInputMessageRole = "user"
const EasyInputMessageRoleAssistant EasyInputMessageRole = "assistant"
const EasyInputMessageRoleSystem EasyInputMessageRole = "system"
const EasyInputMessageRoleDeveloper EasyInputMessageRole = "developer"
Type EasyInputMessageTypeoptional

The type of the message input. Always message.

type ResponseInputItemMessage 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.

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role string

The role of the message input. One of user, system, or developer.

Accepts one of the following:
const ResponseInputItemMessageRoleUser ResponseInputItemMessageRole = "user"
const ResponseInputItemMessageRoleSystem ResponseInputItemMessageRole = "system"
const ResponseInputItemMessageRoleDeveloper ResponseInputItemMessageRole = "developer"
Status stringoptional

The status of item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemMessageStatusInProgress ResponseInputItemMessageStatus = "in_progress"
const ResponseInputItemMessageStatusCompleted ResponseInputItemMessageStatus = "completed"
const ResponseInputItemMessageStatusIncomplete ResponseInputItemMessageStatus = "incomplete"
Type stringoptional

The type of the message input. Always set to message.

type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

type ResponseInputItemComputerCallOutput struct{…}

The output of a computer tool call.

CallID string

The ID of the computer tool call that produced the output.

maxLength64
minLength1

A computer screenshot image used with the computer use tool.

Type ComputerScreenshot

Specifies the event type. For a computer screenshot, this property is always set to computer_screenshot.

FileID stringoptional

The identifier of an uploaded file that contains the screenshot.

ImageURL stringoptional

The URL of the screenshot image.

Type ComputerCallOutput

The type of the computer tool call output. Always computer_call_output.

ID stringoptional

The ID of the computer tool call output.

AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckoptional

The safety checks reported by the API that have been acknowledged by the developer.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status stringoptional

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseInputItemComputerCallOutputStatusInProgress ResponseInputItemComputerCallOutputStatus = "in_progress"
const ResponseInputItemComputerCallOutputStatusCompleted ResponseInputItemComputerCallOutputStatus = "completed"
const ResponseInputItemComputerCallOutputStatusIncomplete ResponseInputItemComputerCallOutputStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
type ResponseInputItemFunctionCallOutput struct{…}

The output of a function tool call.

CallID string

The unique ID of the function tool call generated by the model.

maxLength64
minLength1
Output ResponseInputItemFunctionCallOutputOutputUnion

Text, image, or file output of the function tool call.

Accepts one of the following:
string
type ResponseFunctionCallOutputItemList []ResponseFunctionCallOutputItemUnion

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

Accepts one of the following:
type ResponseInputTextContent struct{…}

A text input to the model.

Text string

The text input to the model.

maxLength10485760
Type InputText

The type of the input item. Always input_text.

type ResponseInputImageContent struct{…}

An image input to the model. Learn about image inputs

Type InputImage

The type of the input item. Always input_image.

Detail ResponseInputImageContentDetailoptional

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageContentDetailLow ResponseInputImageContentDetail = "low"
const ResponseInputImageContentDetailHigh ResponseInputImageContentDetail = "high"
const ResponseInputImageContentDetailAuto ResponseInputImageContentDetail = "auto"
FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

maxLength20971520
type ResponseInputFileContent struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The base64-encoded data of the file to be sent to the model.

maxLength33554432
FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type FunctionCallOutput

The type of the function tool call output. Always function_call_output.

ID stringoptional

The unique ID of the function tool call output. Populated when this item is returned via API.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemFunctionCallOutputStatusInProgress ResponseInputItemFunctionCallOutputStatus = "in_progress"
const ResponseInputItemFunctionCallOutputStatusCompleted ResponseInputItemFunctionCallOutputStatus = "completed"
const ResponseInputItemFunctionCallOutputStatusIncomplete ResponseInputItemFunctionCallOutputStatus = "incomplete"
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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItemParamResp struct{…}

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

EncryptedContent string

The encrypted content of the compaction summary.

maxLength10485760
Type Compaction

The type of the item. Always compaction.

ID stringoptional

The ID of the compaction item.

type ResponseInputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseInputItemImageGenerationCallStatusInProgress ResponseInputItemImageGenerationCallStatus = "in_progress"
const ResponseInputItemImageGenerationCallStatusCompleted ResponseInputItemImageGenerationCallStatus = "completed"
const ResponseInputItemImageGenerationCallStatusGenerating ResponseInputItemImageGenerationCallStatus = "generating"
const ResponseInputItemImageGenerationCallStatusFailed ResponseInputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseInputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseInputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseInputItemLocalShellCallStatusInProgress ResponseInputItemLocalShellCallStatus = "in_progress"
const ResponseInputItemLocalShellCallStatusCompleted ResponseInputItemLocalShellCallStatus = "completed"
const ResponseInputItemLocalShellCallStatusIncomplete ResponseInputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseInputItemLocalShellCallOutput struct{…}

The output of a local shell tool call.

ID string

The unique ID of the local shell tool call generated by the model.

Output string

A JSON string of the output of the local shell tool call.

Type LocalShellCallOutput

The type of the local shell tool call output. Always local_shell_call_output.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemLocalShellCallOutputStatusInProgress ResponseInputItemLocalShellCallOutputStatus = "in_progress"
const ResponseInputItemLocalShellCallOutputStatusCompleted ResponseInputItemLocalShellCallOutputStatus = "completed"
const ResponseInputItemLocalShellCallOutputStatusIncomplete ResponseInputItemLocalShellCallOutputStatus = "incomplete"
type ResponseInputItemShellCall struct{…}

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

Action ResponseInputItemShellCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string

Ordered shell commands for the execution environment to run.

MaxOutputLength int64optional

Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

TimeoutMs int64optional

Maximum wall-clock time in milliseconds to allow the shell commands to run.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1
Type ShellCall

The type of the item. Always shell_call.

ID stringoptional

The unique ID of the shell tool call. Populated when this item is returned via API.

Status stringoptional

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemShellCallStatusInProgress ResponseInputItemShellCallStatus = "in_progress"
const ResponseInputItemShellCallStatusCompleted ResponseInputItemShellCallStatus = "completed"
const ResponseInputItemShellCallStatusIncomplete ResponseInputItemShellCallStatus = "incomplete"
type ResponseInputItemShellCallOutput struct{…}

The streamed output items emitted by a shell tool call.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1

Captured chunks of stdout and stderr output, along with their associated outcomes.

Outcome ResponseFunctionShellCallOutputContentOutcomeUnion

The exit or timeout outcome associated with this shell call.

Accepts one of the following:
type ResponseFunctionShellCallOutputContentOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellCallOutputContentOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

The exit code returned by the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

Captured stderr output for the shell call.

maxLength10485760
Stdout string

Captured stdout output for the shell call.

maxLength10485760
Type ShellCallOutput

The type of the item. Always shell_call_output.

ID stringoptional

The unique ID of the shell tool call output. Populated when this item is returned via API.

MaxOutputLength int64optional

The maximum number of UTF-8 characters captured for this shell call's combined output.

Status stringoptional

The status of the shell call output.

Accepts one of the following:
const ResponseInputItemShellCallOutputStatusInProgress ResponseInputItemShellCallOutputStatus = "in_progress"
const ResponseInputItemShellCallOutputStatusCompleted ResponseInputItemShellCallOutputStatus = "completed"
const ResponseInputItemShellCallOutputStatusIncomplete ResponseInputItemShellCallOutputStatus = "incomplete"
type ResponseInputItemApplyPatchCall struct{…}

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

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Operation ResponseInputItemApplyPatchCallOperationUnion

The specific create, delete, or update instruction for the apply_patch tool call.

Accepts one of the following:
type ResponseInputItemApplyPatchCallOperationCreateFile struct{…}

Instruction for creating a new file via the apply_patch tool.

Diff string

Unified diff content to apply when creating the file.

maxLength10485760
Path string

Path of the file to create relative to the workspace root.

minLength1
Type CreateFile

The operation type. Always create_file.

type ResponseInputItemApplyPatchCallOperationDeleteFile struct{…}

Instruction for deleting an existing file via the apply_patch tool.

Path string

Path of the file to delete relative to the workspace root.

minLength1
Type DeleteFile

The operation type. Always delete_file.

type ResponseInputItemApplyPatchCallOperationUpdateFile struct{…}

Instruction for updating an existing file via the apply_patch tool.

Diff string

Unified diff content to apply to the existing file.

maxLength10485760
Path string

Path of the file to update relative to the workspace root.

minLength1
Type UpdateFile

The operation type. Always update_file.

Status string

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallStatusInProgress ResponseInputItemApplyPatchCallStatus = "in_progress"
const ResponseInputItemApplyPatchCallStatusCompleted ResponseInputItemApplyPatchCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

ID stringoptional

The unique ID of the apply patch tool call. Populated when this item is returned via API.

type ResponseInputItemApplyPatchCallOutput struct{…}

The streamed output emitted by an apply patch tool call.

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Status string

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallOutputStatusCompleted ResponseInputItemApplyPatchCallOutputStatus = "completed"
const ResponseInputItemApplyPatchCallOutputStatusFailed ResponseInputItemApplyPatchCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

ID stringoptional

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

Output stringoptional

Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

maxLength10485760
type ResponseInputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseInputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseInputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseInputItemMcpApprovalResponse struct{…}

A response to an MCP approval request.

ApprovalRequestID string

The ID of the approval request being answered.

Approve bool

Whether the request was approved.

Type McpApprovalResponse

The type of the item. Always mcp_approval_response.

ID stringoptional

The unique ID of the approval response

Reason stringoptional

Optional reason for the decision.

type ResponseInputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseInputItemMcpCallStatusInProgress ResponseInputItemMcpCallStatus = "in_progress"
const ResponseInputItemMcpCallStatusCompleted ResponseInputItemMcpCallStatus = "completed"
const ResponseInputItemMcpCallStatusIncomplete ResponseInputItemMcpCallStatus = "incomplete"
const ResponseInputItemMcpCallStatusCalling ResponseInputItemMcpCallStatus = "calling"
const ResponseInputItemMcpCallStatusFailed ResponseInputItemMcpCallStatus = "failed"
type ResponseCustomToolCallOutput struct{…}

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

CallID string

The call ID, used to map this custom tool call output to a custom tool call.

Output ResponseCustomToolCallOutputOutputUnion

The output from the custom tool call generated by your code. Can be a string or an list of output content.

Accepts one of the following:
string
type ResponseCustomToolCallOutputOutputOutputContentList []ResponseCustomToolCallOutputOutputOutputContentListItemUnion

Text, image, or file output of the custom tool call.

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type CustomToolCallOutput

The type of the custom tool call output. Always custom_tool_call_output.

ID stringoptional

The unique ID of the custom tool call output in the OpenAI platform.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

type ResponseInputItemItemReference struct{…}

An internal identifier for an item to reference.

ID string

The ID of the item to reference.

Type stringoptional

The type of item to reference. Always item_reference.

Metadata Metadata

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Model ResponsesModel

Model ID used to generate the response, like gpt-4o or o3. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.

Accepts one of the following:
string
type ChatModel string
Accepts one of the following:
const ChatModelGPT5_2 ChatModel = "gpt-5.2"
const ChatModelGPT5_2_2025_12_11 ChatModel = "gpt-5.2-2025-12-11"
const ChatModelGPT5_2ChatLatest ChatModel = "gpt-5.2-chat-latest"
const ChatModelGPT5_2Pro ChatModel = "gpt-5.2-pro"
const ChatModelGPT5_2Pro2025_12_11 ChatModel = "gpt-5.2-pro-2025-12-11"
const ChatModelGPT5_1 ChatModel = "gpt-5.1"
const ChatModelGPT5_1_2025_11_13 ChatModel = "gpt-5.1-2025-11-13"
const ChatModelGPT5_1Codex ChatModel = "gpt-5.1-codex"
const ChatModelGPT5_1Mini ChatModel = "gpt-5.1-mini"
const ChatModelGPT5_1ChatLatest ChatModel = "gpt-5.1-chat-latest"
const ChatModelGPT5 ChatModel = "gpt-5"
const ChatModelGPT5Mini ChatModel = "gpt-5-mini"
const ChatModelGPT5Nano ChatModel = "gpt-5-nano"
const ChatModelGPT5_2025_08_07 ChatModel = "gpt-5-2025-08-07"
const ChatModelGPT5Mini2025_08_07 ChatModel = "gpt-5-mini-2025-08-07"
const ChatModelGPT5Nano2025_08_07 ChatModel = "gpt-5-nano-2025-08-07"
const ChatModelGPT5ChatLatest ChatModel = "gpt-5-chat-latest"
const ChatModelGPT4_1 ChatModel = "gpt-4.1"
const ChatModelGPT4_1Mini ChatModel = "gpt-4.1-mini"
const ChatModelGPT4_1Nano ChatModel = "gpt-4.1-nano"
const ChatModelGPT4_1_2025_04_14 ChatModel = "gpt-4.1-2025-04-14"
const ChatModelGPT4_1Mini2025_04_14 ChatModel = "gpt-4.1-mini-2025-04-14"
const ChatModelGPT4_1Nano2025_04_14 ChatModel = "gpt-4.1-nano-2025-04-14"
const ChatModelO4Mini ChatModel = "o4-mini"
const ChatModelO4Mini2025_04_16 ChatModel = "o4-mini-2025-04-16"
const ChatModelO3 ChatModel = "o3"
const ChatModelO3_2025_04_16 ChatModel = "o3-2025-04-16"
const ChatModelO3Mini ChatModel = "o3-mini"
const ChatModelO3Mini2025_01_31 ChatModel = "o3-mini-2025-01-31"
const ChatModelO1 ChatModel = "o1"
const ChatModelO1_2024_12_17 ChatModel = "o1-2024-12-17"
const ChatModelO1Preview ChatModel = "o1-preview"
const ChatModelO1Preview2024_09_12 ChatModel = "o1-preview-2024-09-12"
const ChatModelO1Mini ChatModel = "o1-mini"
const ChatModelO1Mini2024_09_12 ChatModel = "o1-mini-2024-09-12"
const ChatModelGPT4o ChatModel = "gpt-4o"
const ChatModelGPT4o2024_11_20 ChatModel = "gpt-4o-2024-11-20"
const ChatModelGPT4o2024_08_06 ChatModel = "gpt-4o-2024-08-06"
const ChatModelGPT4o2024_05_13 ChatModel = "gpt-4o-2024-05-13"
const ChatModelGPT4oAudioPreview ChatModel = "gpt-4o-audio-preview"
const ChatModelGPT4oAudioPreview2024_10_01 ChatModel = "gpt-4o-audio-preview-2024-10-01"
const ChatModelGPT4oAudioPreview2024_12_17 ChatModel = "gpt-4o-audio-preview-2024-12-17"
const ChatModelGPT4oAudioPreview2025_06_03 ChatModel = "gpt-4o-audio-preview-2025-06-03"
const ChatModelGPT4oMiniAudioPreview ChatModel = "gpt-4o-mini-audio-preview"
const ChatModelGPT4oMiniAudioPreview2024_12_17 ChatModel = "gpt-4o-mini-audio-preview-2024-12-17"
const ChatModelGPT4oSearchPreview ChatModel = "gpt-4o-search-preview"
const ChatModelGPT4oMiniSearchPreview ChatModel = "gpt-4o-mini-search-preview"
const ChatModelGPT4oSearchPreview2025_03_11 ChatModel = "gpt-4o-search-preview-2025-03-11"
const ChatModelGPT4oMiniSearchPreview2025_03_11 ChatModel = "gpt-4o-mini-search-preview-2025-03-11"
const ChatModelChatgpt4oLatest ChatModel = "chatgpt-4o-latest"
const ChatModelCodexMiniLatest ChatModel = "codex-mini-latest"
const ChatModelGPT4oMini ChatModel = "gpt-4o-mini"
const ChatModelGPT4oMini2024_07_18 ChatModel = "gpt-4o-mini-2024-07-18"
const ChatModelGPT4Turbo ChatModel = "gpt-4-turbo"
const ChatModelGPT4Turbo2024_04_09 ChatModel = "gpt-4-turbo-2024-04-09"
const ChatModelGPT4_0125Preview ChatModel = "gpt-4-0125-preview"
const ChatModelGPT4TurboPreview ChatModel = "gpt-4-turbo-preview"
const ChatModelGPT4_1106Preview ChatModel = "gpt-4-1106-preview"
const ChatModelGPT4VisionPreview ChatModel = "gpt-4-vision-preview"
const ChatModelGPT4 ChatModel = "gpt-4"
const ChatModelGPT4_0314 ChatModel = "gpt-4-0314"
const ChatModelGPT4_0613 ChatModel = "gpt-4-0613"
const ChatModelGPT4_32k ChatModel = "gpt-4-32k"
const ChatModelGPT4_32k0314 ChatModel = "gpt-4-32k-0314"
const ChatModelGPT4_32k0613 ChatModel = "gpt-4-32k-0613"
const ChatModelGPT3_5Turbo ChatModel = "gpt-3.5-turbo"
const ChatModelGPT3_5Turbo16k ChatModel = "gpt-3.5-turbo-16k"
const ChatModelGPT3_5Turbo0301 ChatModel = "gpt-3.5-turbo-0301"
const ChatModelGPT3_5Turbo0613 ChatModel = "gpt-3.5-turbo-0613"
const ChatModelGPT3_5Turbo1106 ChatModel = "gpt-3.5-turbo-1106"
const ChatModelGPT3_5Turbo0125 ChatModel = "gpt-3.5-turbo-0125"
const ChatModelGPT3_5Turbo16k0613 ChatModel = "gpt-3.5-turbo-16k-0613"
type ResponsesModel string
Accepts one of the following:
const ResponsesModelO1Pro ResponsesModel = "o1-pro"
const ResponsesModelO1Pro2025_03_19 ResponsesModel = "o1-pro-2025-03-19"
const ResponsesModelO3Pro ResponsesModel = "o3-pro"
const ResponsesModelO3Pro2025_06_10 ResponsesModel = "o3-pro-2025-06-10"
const ResponsesModelO3DeepResearch ResponsesModel = "o3-deep-research"
const ResponsesModelO3DeepResearch2025_06_26 ResponsesModel = "o3-deep-research-2025-06-26"
const ResponsesModelO4MiniDeepResearch ResponsesModel = "o4-mini-deep-research"
const ResponsesModelO4MiniDeepResearch2025_06_26 ResponsesModel = "o4-mini-deep-research-2025-06-26"
const ResponsesModelComputerUsePreview ResponsesModel = "computer-use-preview"
const ResponsesModelComputerUsePreview2025_03_11 ResponsesModel = "computer-use-preview-2025-03-11"
const ResponsesModelGPT5Codex ResponsesModel = "gpt-5-codex"
const ResponsesModelGPT5Pro ResponsesModel = "gpt-5-pro"
const ResponsesModelGPT5Pro2025_10_06 ResponsesModel = "gpt-5-pro-2025-10-06"
const ResponsesModelGPT5_1CodexMax ResponsesModel = "gpt-5.1-codex-max"
Object Response

The object type of this resource - always set to response.

An array of content items generated by the model.

  • The length and order of items in the output array is dependent on the model's response.
  • Rather than accessing the first item in the output array and assuming it's an assistant message with the content generated by the model, you might consider using the output_text property where supported in SDKs.
Accepts one of the following:
type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItem struct{…}

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

ID string

The unique ID of the compaction item.

EncryptedContent string

The encrypted content that was produced by compaction.

Type Compaction

The type of the item. Always compaction.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseOutputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseOutputItemImageGenerationCallStatusInProgress ResponseOutputItemImageGenerationCallStatus = "in_progress"
const ResponseOutputItemImageGenerationCallStatusCompleted ResponseOutputItemImageGenerationCallStatus = "completed"
const ResponseOutputItemImageGenerationCallStatusGenerating ResponseOutputItemImageGenerationCallStatus = "generating"
const ResponseOutputItemImageGenerationCallStatusFailed ResponseOutputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseOutputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseOutputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseOutputItemLocalShellCallStatusInProgress ResponseOutputItemLocalShellCallStatus = "in_progress"
const ResponseOutputItemLocalShellCallStatusCompleted ResponseOutputItemLocalShellCallStatus = "completed"
const ResponseOutputItemLocalShellCallStatusIncomplete ResponseOutputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseFunctionShellToolCall struct{…}

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

ID string

The unique ID of the shell tool call. Populated when this item is returned via API.

Action ResponseFunctionShellToolCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string
MaxOutputLength int64

Optional maximum number of characters to return from each command.

TimeoutMs int64

Optional timeout in milliseconds for the commands.

CallID string

The unique ID of the shell tool call generated by the model.

Status ResponseFunctionShellToolCallStatus

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallStatusInProgress ResponseFunctionShellToolCallStatus = "in_progress"
const ResponseFunctionShellToolCallStatusCompleted ResponseFunctionShellToolCallStatus = "completed"
const ResponseFunctionShellToolCallStatusIncomplete ResponseFunctionShellToolCallStatus = "incomplete"
Type ShellCall

The type of the item. Always shell_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseFunctionShellToolCallOutput struct{…}

The output of a shell tool call that was emitted.

ID string

The unique ID of the shell call output. Populated when this item is returned via API.

CallID string

The unique ID of the shell tool call generated by the model.

MaxOutputLength int64

The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output.

Output []ResponseFunctionShellToolCallOutputOutput

An array of shell call output contents

Outcome ResponseFunctionShellToolCallOutputOutputOutcomeUnion

Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

Accepts one of the following:
type ResponseFunctionShellToolCallOutputOutputOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellToolCallOutputOutputOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

Exit code from the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

The standard error output that was captured.

Stdout string

The standard output that was captured.

CreatedBy stringoptional

The identifier of the actor that created the item.

Status ResponseFunctionShellToolCallOutputStatus

The status of the shell call output. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallOutputStatusInProgress ResponseFunctionShellToolCallOutputStatus = "in_progress"
const ResponseFunctionShellToolCallOutputStatusCompleted ResponseFunctionShellToolCallOutputStatus = "completed"
const ResponseFunctionShellToolCallOutputStatusIncomplete ResponseFunctionShellToolCallOutputStatus = "incomplete"
Type ShellCallOutput

The type of the shell call output. Always shell_call_output.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseApplyPatchToolCall struct{…}

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

ID string

The unique ID of the apply patch tool call. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Operation ResponseApplyPatchToolCallOperationUnion

One of the create_file, delete_file, or update_file operations applied via apply_patch.

Accepts one of the following:
type ResponseApplyPatchToolCallOperationCreateFile struct{…}

Instruction describing how to create a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to create.

Type CreateFile

Create a new file with the provided diff.

type ResponseApplyPatchToolCallOperationDeleteFile struct{…}

Instruction describing how to delete a file via the apply_patch tool.

Path string

Path of the file to delete.

Type DeleteFile

Delete the specified file.

type ResponseApplyPatchToolCallOperationUpdateFile struct{…}

Instruction describing how to update a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to update.

Type UpdateFile

Update an existing file with the provided diff.

Status ResponseApplyPatchToolCallStatus

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseApplyPatchToolCallStatusInProgress ResponseApplyPatchToolCallStatus = "in_progress"
const ResponseApplyPatchToolCallStatusCompleted ResponseApplyPatchToolCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseApplyPatchToolCallOutput struct{…}

The output emitted by an apply patch tool call.

ID string

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Status ResponseApplyPatchToolCallOutputStatus

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseApplyPatchToolCallOutputStatusCompleted ResponseApplyPatchToolCallOutputStatus = "completed"
const ResponseApplyPatchToolCallOutputStatusFailed ResponseApplyPatchToolCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

CreatedBy stringoptional

The ID of the entity that created this tool call output.

Output stringoptional

Optional textual output returned by the apply patch tool.

type ResponseOutputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseOutputItemMcpCallStatusInProgress ResponseOutputItemMcpCallStatus = "in_progress"
const ResponseOutputItemMcpCallStatusCompleted ResponseOutputItemMcpCallStatus = "completed"
const ResponseOutputItemMcpCallStatusIncomplete ResponseOutputItemMcpCallStatus = "incomplete"
const ResponseOutputItemMcpCallStatusCalling ResponseOutputItemMcpCallStatus = "calling"
const ResponseOutputItemMcpCallStatusFailed ResponseOutputItemMcpCallStatus = "failed"
type ResponseOutputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseOutputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseOutputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

ParallelToolCalls bool

Whether to allow the model to run tool calls in parallel.

Temperature float64

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.

minimum0
maximum2
ToolChoice ResponseToolChoiceUnion

How the model should select which tool (or tools) to use when generating a response. See the tools parameter to see how to specify which tools the model can call.

Accepts one of the following:
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.

Accepts one of the following:
const ToolChoiceOptionsNone ToolChoiceOptions = "none"
const ToolChoiceOptionsAuto ToolChoiceOptions = "auto"
const ToolChoiceOptionsRequired ToolChoiceOptions = "required"
type ToolChoiceAllowed struct{…}

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

Mode ToolChoiceAllowedMode

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

auto allows the model to pick from among the allowed tools and generate a message.

required requires the model to call one or more of the allowed tools.

Accepts one of the following:
const ToolChoiceAllowedModeAuto ToolChoiceAllowedMode = "auto"
const ToolChoiceAllowedModeRequired ToolChoiceAllowedMode = "required"
Tools []map[string, any]

A list of tool definitions that the model should be allowed to call.

For the Responses API, the list of tool definitions might look like:

[
  { "type": "function", "name": "get_weather" },
  { "type": "mcp", "server_label": "deepwiki" },
  { "type": "image_generation" }
]
Type AllowedTools

Allowed tool configuration type. Always allowed_tools.

type ToolChoiceTypes struct{…}

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

Type ToolChoiceTypesType

The type of hosted tool the model should to use. Learn more about built-in tools.

Allowed values are:

  • file_search
  • web_search_preview
  • computer_use_preview
  • code_interpreter
  • image_generation
Accepts one of the following:
const ToolChoiceTypesTypeFileSearch ToolChoiceTypesType = "file_search"
const ToolChoiceTypesTypeWebSearchPreview ToolChoiceTypesType = "web_search_preview"
const ToolChoiceTypesTypeComputerUsePreview ToolChoiceTypesType = "computer_use_preview"
const ToolChoiceTypesTypeWebSearchPreview2025_03_11 ToolChoiceTypesType = "web_search_preview_2025_03_11"
const ToolChoiceTypesTypeImageGeneration ToolChoiceTypesType = "image_generation"
const ToolChoiceTypesTypeCodeInterpreter ToolChoiceTypesType = "code_interpreter"
type ToolChoiceFunction struct{…}

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

Name string

The name of the function to call.

Type Function

For function calling, the type is always function.

type ToolChoiceMcp struct{…}

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

ServerLabel string

The label of the MCP server to use.

Type Mcp

For MCP tools, the type is always mcp.

Name stringoptional

The name of the tool to call on the server.

type ToolChoiceCustom struct{…}

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

Name string

The name of the custom tool to call.

Type Custom

For custom tool calling, the type is always custom.

type ToolChoiceApplyPatch struct{…}

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

Type ApplyPatch

The tool to call. Always apply_patch.

type ToolChoiceShell struct{…}

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

Type Shell

The tool to call. Always shell.

Tools []ToolUnion

An array of tools the model may call while generating a response. You can specify which tool to use by setting the tool_choice parameter.

We support the following categories of tools:

  • Built-in tools: Tools that are provided by OpenAI that extend the model's capabilities, like web search or file search. Learn more about built-in tools.
  • MCP Tools: Integrations with third-party systems via custom MCP servers or predefined connectors such as Google Drive and SharePoint. Learn more about MCP Tools.
  • Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code with strongly typed arguments and outputs. Learn more about function calling. You can also use custom tools to call your own code.
Accepts one of the following:
type FunctionTool struct{…}

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

Name string

The name of the function to call.

Parameters map[string, any]

A JSON schema object describing the parameters of the function.

Strict bool

Whether to enforce strict parameter validation. Default true.

Type Function

The type of the function tool. Always function.

Description stringoptional

A description of the function. Used by the model to determine whether or not to call the function.

type FileSearchTool struct{…}

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

Type FileSearch

The type of the file search tool. Always file_search.

VectorStoreIDs []string

The IDs of the vector stores to search.

Filters FileSearchToolFiltersUnionoptional

A filter to apply.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
type CompoundFilter struct{…}

Combine multiple filters using and or or.

Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
Type CompoundFilterType

Type of operation: and or or.

Accepts one of the following:
const CompoundFilterTypeAnd CompoundFilterType = "and"
const CompoundFilterTypeOr CompoundFilterType = "or"
MaxNumResults int64optional

The maximum number of results to return. This number should be between 1 and 50 inclusive.

RankingOptions FileSearchToolRankingOptionsoptional

Ranking options for search.

Ranker stringoptional

The ranker to use for the file search.

Accepts one of the following:
const FileSearchToolRankingOptionsRankerAuto FileSearchToolRankingOptionsRanker = "auto"
const FileSearchToolRankingOptionsRankerDefault2024_11_15 FileSearchToolRankingOptionsRanker = "default-2024-11-15"
ScoreThreshold float64optional

The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.

type ComputerTool struct{…}

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

DisplayHeight int64

The height of the computer display.

DisplayWidth int64

The width of the computer display.

Environment ComputerToolEnvironment

The type of computer environment to control.

Accepts one of the following:
const ComputerToolEnvironmentWindows ComputerToolEnvironment = "windows"
const ComputerToolEnvironmentMac ComputerToolEnvironment = "mac"
const ComputerToolEnvironmentLinux ComputerToolEnvironment = "linux"
const ComputerToolEnvironmentUbuntu ComputerToolEnvironment = "ubuntu"
const ComputerToolEnvironmentBrowser ComputerToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type WebSearchTool struct{…}

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

Type WebSearchToolType

The type of the web search tool. One of web_search or web_search_2025_08_26.

Accepts one of the following:
const WebSearchToolTypeWebSearch WebSearchToolType = "web_search"
const WebSearchToolTypeWebSearch2025_08_26 WebSearchToolType = "web_search_2025_08_26"
Filters WebSearchToolFiltersoptional

Filters for the search.

AllowedDomains []stringoptional

Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.

Example: ["pubmed.ncbi.nlm.nih.gov"]

SearchContextSize WebSearchToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchToolSearchContextSizeLow WebSearchToolSearchContextSize = "low"
const WebSearchToolSearchContextSizeMedium WebSearchToolSearchContextSize = "medium"
const WebSearchToolSearchContextSizeHigh WebSearchToolSearchContextSize = "high"
UserLocation WebSearchToolUserLocationoptional

The approximate location of the user.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

Type stringoptional

The type of location approximation. Always approximate.

type ToolMcp struct{…}

Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.

ServerLabel string

A label for this MCP server, used to identify it in tool calls.

Type Mcp

The type of the MCP tool. Always mcp.

AllowedTools ToolMcpAllowedToolsUnionoptional

List of allowed tool names or a filter object.

Accepts one of the following:
type ToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type ToolMcpAllowedToolsMcpToolFilter struct{…}

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Authorization stringoptional

An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.

ConnectorID stringoptional

Identifier for service connectors, like those available in ChatGPT. One of server_url or connector_id must be provided. Learn more about service connectors here.

Currently supported connector_id values are:

  • Dropbox: connector_dropbox
  • Gmail: connector_gmail
  • Google Calendar: connector_googlecalendar
  • Google Drive: connector_googledrive
  • Microsoft Teams: connector_microsoftteams
  • Outlook Calendar: connector_outlookcalendar
  • Outlook Email: connector_outlookemail
  • SharePoint: connector_sharepoint
Accepts one of the following:
const ToolMcpConnectorIDConnectorDropbox ToolMcpConnectorID = "connector_dropbox"
const ToolMcpConnectorIDConnectorGmail ToolMcpConnectorID = "connector_gmail"
const ToolMcpConnectorIDConnectorGooglecalendar ToolMcpConnectorID = "connector_googlecalendar"
const ToolMcpConnectorIDConnectorGoogledrive ToolMcpConnectorID = "connector_googledrive"
const ToolMcpConnectorIDConnectorMicrosoftteams ToolMcpConnectorID = "connector_microsoftteams"
const ToolMcpConnectorIDConnectorOutlookcalendar ToolMcpConnectorID = "connector_outlookcalendar"
const ToolMcpConnectorIDConnectorOutlookemail ToolMcpConnectorID = "connector_outlookemail"
const ToolMcpConnectorIDConnectorSharepoint ToolMcpConnectorID = "connector_sharepoint"
Headers map[string, string]optional

Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.

RequireApproval ToolMcpRequireApprovalUnionoptional

Specify which of the MCP server's tools require approval.

Accepts one of the following:
type ToolMcpRequireApprovalMcpToolApprovalFilter struct{…}

Specify which of the MCP server's tools require approval. Can be always, never, or a filter object associated with tools that require approval.

Always ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysoptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Never ToolMcpRequireApprovalMcpToolApprovalFilterNeveroptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

type ToolMcpRequireApprovalMcpToolApprovalSetting string

Specify a single approval policy for all tools. One of always or never. When set to always, all tools will require approval. When set to never, all tools will not require approval.

Accepts one of the following:
const ToolMcpRequireApprovalMcpToolApprovalSettingAlways ToolMcpRequireApprovalMcpToolApprovalSetting = "always"
const ToolMcpRequireApprovalMcpToolApprovalSettingNever ToolMcpRequireApprovalMcpToolApprovalSetting = "never"
ServerDescription stringoptional

Optional description of the MCP server, used to provide more context.

ServerURL stringoptional

The URL for the MCP server. One of server_url or connector_id must be provided.

type ToolCodeInterpreter struct{…}

A tool that runs Python code to help generate a response to a prompt.

Container ToolCodeInterpreterContainerUnion

The code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional memory_limit setting.

Accepts one of the following:
string
type ToolCodeInterpreterContainerCodeInterpreterContainerAuto struct{…}

Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

Type Auto

Always auto.

FileIDs []stringoptional

An optional list of uploaded files to make available to your code.

MemoryLimit stringoptional

The memory limit for the code interpreter container.

Accepts one of the following:
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
Type CodeInterpreter

The type of the code interpreter tool. Always code_interpreter.

type ToolImageGeneration struct{…}

A tool that generates images using the GPT image models.

Type ImageGeneration

The type of the image generation tool. Always image_generation.

Action stringoptional

Whether to generate a new image or edit an existing image. Default: auto.

Accepts one of the following:
const ToolImageGenerationActionGenerate ToolImageGenerationAction = "generate"
const ToolImageGenerationActionEdit ToolImageGenerationAction = "edit"
const ToolImageGenerationActionAuto ToolImageGenerationAction = "auto"
Background stringoptional

Background type for the generated image. One of transparent, opaque, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationBackgroundTransparent ToolImageGenerationBackground = "transparent"
const ToolImageGenerationBackgroundOpaque ToolImageGenerationBackground = "opaque"
const ToolImageGenerationBackgroundAuto ToolImageGenerationBackground = "auto"
InputFidelity stringoptional

Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for gpt-image-1 and gpt-image-1.5 and later models, unsupported for gpt-image-1-mini. Supports high and low. Defaults to low.

Accepts one of the following:
const ToolImageGenerationInputFidelityHigh ToolImageGenerationInputFidelity = "high"
const ToolImageGenerationInputFidelityLow ToolImageGenerationInputFidelity = "low"
InputImageMask ToolImageGenerationInputImageMaskoptional

Optional mask for inpainting. Contains image_url (string, optional) and file_id (string, optional).

FileID stringoptional

File ID for the mask image.

ImageURL stringoptional

Base64-encoded mask image.

Model stringoptional

The image generation model to use. Default: gpt-image-1.

Accepts one of the following:
string
string
Accepts one of the following:
const ToolImageGenerationModelGPTImage1 ToolImageGenerationModel = "gpt-image-1"
const ToolImageGenerationModelGPTImage1Mini ToolImageGenerationModel = "gpt-image-1-mini"
const ToolImageGenerationModelGPTImage1_5 ToolImageGenerationModel = "gpt-image-1.5"
Moderation stringoptional

Moderation level for the generated image. Default: auto.

Accepts one of the following:
const ToolImageGenerationModerationAuto ToolImageGenerationModeration = "auto"
const ToolImageGenerationModerationLow ToolImageGenerationModeration = "low"
OutputCompression int64optional

Compression level for the output image. Default: 100.

minimum0
maximum100
OutputFormat stringoptional

The output format of the generated image. One of png, webp, or jpeg. Default: png.

Accepts one of the following:
const ToolImageGenerationOutputFormatPNG ToolImageGenerationOutputFormat = "png"
const ToolImageGenerationOutputFormatWebP ToolImageGenerationOutputFormat = "webp"
const ToolImageGenerationOutputFormatJPEG ToolImageGenerationOutputFormat = "jpeg"
PartialImages int64optional

Number of partial images to generate in streaming mode, from 0 (default value) to 3.

minimum0
maximum3
Quality stringoptional

The quality of the generated image. One of low, medium, high, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationQualityLow ToolImageGenerationQuality = "low"
const ToolImageGenerationQualityMedium ToolImageGenerationQuality = "medium"
const ToolImageGenerationQualityHigh ToolImageGenerationQuality = "high"
const ToolImageGenerationQualityAuto ToolImageGenerationQuality = "auto"
Size stringoptional

The size of the generated image. One of 1024x1024, 1024x1536, 1536x1024, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationSize1024x1024 ToolImageGenerationSize = "1024x1024"
const ToolImageGenerationSize1024x1536 ToolImageGenerationSize = "1024x1536"
const ToolImageGenerationSize1536x1024 ToolImageGenerationSize = "1536x1024"
const ToolImageGenerationSizeAuto ToolImageGenerationSize = "auto"
type ToolLocalShell struct{…}

A tool that allows the model to execute shell commands in a local environment.

Type LocalShell

The type of the local shell tool. Always local_shell.

type FunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

type CustomTool struct{…}

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

Name string

The name of the custom tool, used to identify it in tool calls.

Type Custom

The type of the custom tool. Always custom.

Description stringoptional

Optional description of the custom tool, used to provide more context.

The input format for the custom tool. Default is unconstrained text.

Accepts one of the following:
type CustomToolInputFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

type CustomToolInputFormatGrammar struct{…}

A grammar defined by the user.

Definition string

The grammar definition.

Syntax string

The syntax of the grammar definition. One of lark or regex.

Accepts one of the following:
const CustomToolInputFormatGrammarSyntaxLark CustomToolInputFormatGrammarSyntax = "lark"
const CustomToolInputFormatGrammarSyntaxRegex CustomToolInputFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

type WebSearchPreviewTool struct{…}

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

Type WebSearchPreviewToolType

The type of the web search tool. One of web_search_preview or web_search_preview_2025_03_11.

Accepts one of the following:
const WebSearchPreviewToolTypeWebSearchPreview WebSearchPreviewToolType = "web_search_preview"
const WebSearchPreviewToolTypeWebSearchPreview2025_03_11 WebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContextSize WebSearchPreviewToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchPreviewToolSearchContextSizeLow WebSearchPreviewToolSearchContextSize = "low"
const WebSearchPreviewToolSearchContextSizeMedium WebSearchPreviewToolSearchContextSize = "medium"
const WebSearchPreviewToolSearchContextSizeHigh WebSearchPreviewToolSearchContextSize = "high"
UserLocation WebSearchPreviewToolUserLocationoptional

The user's location.

Type Approximate

The type of location approximation. Always approximate.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

type ApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

TopP float64

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

minimum0
maximum1
Background booloptional

Whether to run the model response in the background. Learn more.

CompletedAt float64optional

Unix timestamp (in seconds) of when this Response was completed. Only present when the status is completed.

Conversation ResponseConversationoptional

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

ID string

The unique ID of the conversation that this response was associated with.

MaxOutputTokens int64optional

An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.

MaxToolCalls int64optional

The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

PreviousResponseID stringoptional

The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state. Cannot be used in conjunction with conversation.

Prompt ResponsePromptoptional

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

ID string

The unique identifier of the prompt template to use.

Variables map[string, ResponsePromptVariableUnion]optional

Optional map of values to substitute in for variables in your prompt. The substitution values can either be strings, or other Response input types like images or files.

Accepts one of the following:
string
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Version stringoptional

Optional version of the prompt template.

PromptCacheKey stringoptional

Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the user field. Learn more.

PromptCacheRetention ResponsePromptCacheRetentionoptional

The retention policy for the prompt cache. Set to 24h to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. Learn more.

Accepts one of the following:
const ResponsePromptCacheRetentionInMemory ResponsePromptCacheRetention = "in-memory"
const ResponsePromptCacheRetention24h ResponsePromptCacheRetention = "24h"
Reasoning Reasoningoptional

gpt-5 and o-series models only

Configuration options for reasoning models.

Effort ReasoningEffortoptional

Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, and xhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.

  • gpt-5.1 defaults to none, which does not perform reasoning. The supported reasoning values for gpt-5.1 are none, low, medium, and high. Tool calls are supported for all reasoning values in gpt-5.1.
  • All models before gpt-5.1 default to medium reasoning effort, and do not support none.
  • The gpt-5-pro model defaults to (and only supports) high reasoning effort.
  • xhigh is supported for all models after gpt-5.1-codex-max.
Accepts one of the following:
const ReasoningEffortNone ReasoningEffort = "none"
const ReasoningEffortMinimal ReasoningEffort = "minimal"
const ReasoningEffortLow ReasoningEffort = "low"
const ReasoningEffortMedium ReasoningEffort = "medium"
const ReasoningEffortHigh ReasoningEffort = "high"
const ReasoningEffortXhigh ReasoningEffort = "xhigh"
DeprecatedGenerateSummary ReasoningGenerateSummaryoptional

Deprecated: use summary instead.

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.

Accepts one of the following:
const ReasoningGenerateSummaryAuto ReasoningGenerateSummary = "auto"
const ReasoningGenerateSummaryConcise ReasoningGenerateSummary = "concise"
const ReasoningGenerateSummaryDetailed ReasoningGenerateSummary = "detailed"
Summary ReasoningSummaryoptional

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.

concise is supported for computer-use-preview models and all reasoning models after gpt-5.

Accepts one of the following:
const ReasoningSummaryAuto ReasoningSummary = "auto"
const ReasoningSummaryConcise ReasoningSummary = "concise"
const ReasoningSummaryDetailed ReasoningSummary = "detailed"
SafetyIdentifier stringoptional

A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. Learn more.

ServiceTier ResponseServiceTieroptional

Specifies the processing type used for serving the request.

  • If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
  • If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
  • If set to 'flex' or 'priority', then the request will be processed with the corresponding service tier.
  • When not set, the default behavior is 'auto'.

When the service_tier parameter is set, the response body will include the service_tier value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

Accepts one of the following:
const ResponseServiceTierAuto ResponseServiceTier = "auto"
const ResponseServiceTierDefault ResponseServiceTier = "default"
const ResponseServiceTierFlex ResponseServiceTier = "flex"
const ResponseServiceTierScale ResponseServiceTier = "scale"
const ResponseServiceTierPriority ResponseServiceTier = "priority"
Status ResponseStatusoptional

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

Accepts one of the following:
const ResponseStatusCompleted ResponseStatus = "completed"
const ResponseStatusFailed ResponseStatus = "failed"
const ResponseStatusInProgress ResponseStatus = "in_progress"
const ResponseStatusCancelled ResponseStatus = "cancelled"
const ResponseStatusQueued ResponseStatus = "queued"
const ResponseStatusIncomplete ResponseStatus = "incomplete"
Text ResponseTextConfigoptional

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

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.

Accepts one of the following:
type ResponseFormatText struct{…}

Default response format. Used to generate text responses.

Type Text

The type of response format being defined. Always text.

type ResponseFormatTextJSONSchemaConfig struct{…}

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

Name string

The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.

Schema map[string, any]

The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.

Type JSONSchema

The type of response format being defined. Always json_schema.

Description stringoptional

A description of what the response format is for, used by the model to determine how to respond in the format.

Strict booloptional

Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true. To learn more, read the Structured Outputs guide.

type ResponseFormatJSONObject struct{…}

JSON object response format. An older method of generating JSON responses. Using json_schema is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.

Type JSONObject

The type of response format being defined. Always json_object.

Verbosity ResponseTextConfigVerbosityoptional

Constrains the verbosity of the model's response. Lower values will result in more concise responses, while higher values will result in more verbose responses. Currently supported values are low, medium, and high.

Accepts one of the following:
const ResponseTextConfigVerbosityLow ResponseTextConfigVerbosity = "low"
const ResponseTextConfigVerbosityMedium ResponseTextConfigVerbosity = "medium"
const ResponseTextConfigVerbosityHigh ResponseTextConfigVerbosity = "high"
TopLogprobs int64optional

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.

minimum0
maximum20
Truncation ResponseTruncationoptional

The truncation strategy to use for the model response.

  • auto: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation.
  • disabled (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.
Accepts one of the following:
const ResponseTruncationAuto ResponseTruncation = "auto"
const ResponseTruncationDisabled ResponseTruncation = "disabled"
Usage ResponseUsageoptional

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

InputTokens int64

The number of input tokens.

InputTokensDetails ResponseUsageInputTokensDetails

A detailed breakdown of the input tokens.

CachedTokens int64

The number of tokens that were retrieved from the cache. More on prompt caching.

OutputTokens int64

The number of output tokens.

OutputTokensDetails ResponseUsageOutputTokensDetails

A detailed breakdown of the output tokens.

ReasoningTokens int64

The number of reasoning tokens.

TotalTokens int64

The total number of tokens used.

DeprecatedUser stringoptional

This field is being replaced by safety_identifier and prompt_cache_key. Use prompt_cache_key instead to maintain caching optimizations. A stable identifier for your end-users. Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. Learn more.

SequenceNumber int64

The sequence number of this event.

Type ResponseInProgress

The type of the event. Always response.in_progress.

type ResponseFailedEvent struct{…}

An event that is emitted when a response fails.

Response Response

The response that failed.

ID string

Unique identifier for this Response.

CreatedAt float64

Unix timestamp (in seconds) of when this Response was created.

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

Code ResponseErrorCode

The error code for the response.

Accepts one of the following:
const ResponseErrorCodeServerError ResponseErrorCode = "server_error"
const ResponseErrorCodeRateLimitExceeded ResponseErrorCode = "rate_limit_exceeded"
const ResponseErrorCodeInvalidPrompt ResponseErrorCode = "invalid_prompt"
const ResponseErrorCodeVectorStoreTimeout ResponseErrorCode = "vector_store_timeout"
const ResponseErrorCodeInvalidImage ResponseErrorCode = "invalid_image"
const ResponseErrorCodeInvalidImageFormat ResponseErrorCode = "invalid_image_format"
const ResponseErrorCodeInvalidBase64Image ResponseErrorCode = "invalid_base64_image"
const ResponseErrorCodeInvalidImageURL ResponseErrorCode = "invalid_image_url"
const ResponseErrorCodeImageTooLarge ResponseErrorCode = "image_too_large"
const ResponseErrorCodeImageTooSmall ResponseErrorCode = "image_too_small"
const ResponseErrorCodeImageParseError ResponseErrorCode = "image_parse_error"
const ResponseErrorCodeImageContentPolicyViolation ResponseErrorCode = "image_content_policy_violation"
const ResponseErrorCodeInvalidImageMode ResponseErrorCode = "invalid_image_mode"
const ResponseErrorCodeImageFileTooLarge ResponseErrorCode = "image_file_too_large"
const ResponseErrorCodeUnsupportedImageMediaType ResponseErrorCode = "unsupported_image_media_type"
const ResponseErrorCodeEmptyImageFile ResponseErrorCode = "empty_image_file"
const ResponseErrorCodeFailedToDownloadImage ResponseErrorCode = "failed_to_download_image"
const ResponseErrorCodeImageFileNotFound ResponseErrorCode = "image_file_not_found"
Message string

A human-readable description of the error.

IncompleteDetails ResponseIncompleteDetails

Details about why the response is incomplete.

Reason stringoptional

The reason why the response is incomplete.

Accepts one of the following:
const ResponseIncompleteDetailsReasonMaxOutputTokens ResponseIncompleteDetailsReason = "max_output_tokens"
const ResponseIncompleteDetailsReasonContentFilter ResponseIncompleteDetailsReason = "content_filter"
Instructions ResponseInstructionsUnion

A system (or developer) message inserted into the model's context.

When using along with previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.

Accepts one of the following:
string
type ResponseInstructionsInputItemList []ResponseInputItemUnion

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

Accepts one of the following:
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.

Content EasyInputMessageContentUnion

Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.

Accepts one of the following:
string
type ResponseInputMessageContentList []ResponseInputContentUnion

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role EasyInputMessageRole

The role of the message input. One of user, assistant, system, or developer.

Accepts one of the following:
const EasyInputMessageRoleUser EasyInputMessageRole = "user"
const EasyInputMessageRoleAssistant EasyInputMessageRole = "assistant"
const EasyInputMessageRoleSystem EasyInputMessageRole = "system"
const EasyInputMessageRoleDeveloper EasyInputMessageRole = "developer"
Type EasyInputMessageTypeoptional

The type of the message input. Always message.

type ResponseInputItemMessage 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.

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role string

The role of the message input. One of user, system, or developer.

Accepts one of the following:
const ResponseInputItemMessageRoleUser ResponseInputItemMessageRole = "user"
const ResponseInputItemMessageRoleSystem ResponseInputItemMessageRole = "system"
const ResponseInputItemMessageRoleDeveloper ResponseInputItemMessageRole = "developer"
Status stringoptional

The status of item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemMessageStatusInProgress ResponseInputItemMessageStatus = "in_progress"
const ResponseInputItemMessageStatusCompleted ResponseInputItemMessageStatus = "completed"
const ResponseInputItemMessageStatusIncomplete ResponseInputItemMessageStatus = "incomplete"
Type stringoptional

The type of the message input. Always set to message.

type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

type ResponseInputItemComputerCallOutput struct{…}

The output of a computer tool call.

CallID string

The ID of the computer tool call that produced the output.

maxLength64
minLength1

A computer screenshot image used with the computer use tool.

Type ComputerScreenshot

Specifies the event type. For a computer screenshot, this property is always set to computer_screenshot.

FileID stringoptional

The identifier of an uploaded file that contains the screenshot.

ImageURL stringoptional

The URL of the screenshot image.

Type ComputerCallOutput

The type of the computer tool call output. Always computer_call_output.

ID stringoptional

The ID of the computer tool call output.

AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckoptional

The safety checks reported by the API that have been acknowledged by the developer.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status stringoptional

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseInputItemComputerCallOutputStatusInProgress ResponseInputItemComputerCallOutputStatus = "in_progress"
const ResponseInputItemComputerCallOutputStatusCompleted ResponseInputItemComputerCallOutputStatus = "completed"
const ResponseInputItemComputerCallOutputStatusIncomplete ResponseInputItemComputerCallOutputStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
type ResponseInputItemFunctionCallOutput struct{…}

The output of a function tool call.

CallID string

The unique ID of the function tool call generated by the model.

maxLength64
minLength1
Output ResponseInputItemFunctionCallOutputOutputUnion

Text, image, or file output of the function tool call.

Accepts one of the following:
string
type ResponseFunctionCallOutputItemList []ResponseFunctionCallOutputItemUnion

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

Accepts one of the following:
type ResponseInputTextContent struct{…}

A text input to the model.

Text string

The text input to the model.

maxLength10485760
Type InputText

The type of the input item. Always input_text.

type ResponseInputImageContent struct{…}

An image input to the model. Learn about image inputs

Type InputImage

The type of the input item. Always input_image.

Detail ResponseInputImageContentDetailoptional

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageContentDetailLow ResponseInputImageContentDetail = "low"
const ResponseInputImageContentDetailHigh ResponseInputImageContentDetail = "high"
const ResponseInputImageContentDetailAuto ResponseInputImageContentDetail = "auto"
FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

maxLength20971520
type ResponseInputFileContent struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The base64-encoded data of the file to be sent to the model.

maxLength33554432
FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type FunctionCallOutput

The type of the function tool call output. Always function_call_output.

ID stringoptional

The unique ID of the function tool call output. Populated when this item is returned via API.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemFunctionCallOutputStatusInProgress ResponseInputItemFunctionCallOutputStatus = "in_progress"
const ResponseInputItemFunctionCallOutputStatusCompleted ResponseInputItemFunctionCallOutputStatus = "completed"
const ResponseInputItemFunctionCallOutputStatusIncomplete ResponseInputItemFunctionCallOutputStatus = "incomplete"
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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItemParamResp struct{…}

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

EncryptedContent string

The encrypted content of the compaction summary.

maxLength10485760
Type Compaction

The type of the item. Always compaction.

ID stringoptional

The ID of the compaction item.

type ResponseInputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseInputItemImageGenerationCallStatusInProgress ResponseInputItemImageGenerationCallStatus = "in_progress"
const ResponseInputItemImageGenerationCallStatusCompleted ResponseInputItemImageGenerationCallStatus = "completed"
const ResponseInputItemImageGenerationCallStatusGenerating ResponseInputItemImageGenerationCallStatus = "generating"
const ResponseInputItemImageGenerationCallStatusFailed ResponseInputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseInputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseInputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseInputItemLocalShellCallStatusInProgress ResponseInputItemLocalShellCallStatus = "in_progress"
const ResponseInputItemLocalShellCallStatusCompleted ResponseInputItemLocalShellCallStatus = "completed"
const ResponseInputItemLocalShellCallStatusIncomplete ResponseInputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseInputItemLocalShellCallOutput struct{…}

The output of a local shell tool call.

ID string

The unique ID of the local shell tool call generated by the model.

Output string

A JSON string of the output of the local shell tool call.

Type LocalShellCallOutput

The type of the local shell tool call output. Always local_shell_call_output.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemLocalShellCallOutputStatusInProgress ResponseInputItemLocalShellCallOutputStatus = "in_progress"
const ResponseInputItemLocalShellCallOutputStatusCompleted ResponseInputItemLocalShellCallOutputStatus = "completed"
const ResponseInputItemLocalShellCallOutputStatusIncomplete ResponseInputItemLocalShellCallOutputStatus = "incomplete"
type ResponseInputItemShellCall struct{…}

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

Action ResponseInputItemShellCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string

Ordered shell commands for the execution environment to run.

MaxOutputLength int64optional

Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

TimeoutMs int64optional

Maximum wall-clock time in milliseconds to allow the shell commands to run.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1
Type ShellCall

The type of the item. Always shell_call.

ID stringoptional

The unique ID of the shell tool call. Populated when this item is returned via API.

Status stringoptional

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemShellCallStatusInProgress ResponseInputItemShellCallStatus = "in_progress"
const ResponseInputItemShellCallStatusCompleted ResponseInputItemShellCallStatus = "completed"
const ResponseInputItemShellCallStatusIncomplete ResponseInputItemShellCallStatus = "incomplete"
type ResponseInputItemShellCallOutput struct{…}

The streamed output items emitted by a shell tool call.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1

Captured chunks of stdout and stderr output, along with their associated outcomes.

Outcome ResponseFunctionShellCallOutputContentOutcomeUnion

The exit or timeout outcome associated with this shell call.

Accepts one of the following:
type ResponseFunctionShellCallOutputContentOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellCallOutputContentOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

The exit code returned by the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

Captured stderr output for the shell call.

maxLength10485760
Stdout string

Captured stdout output for the shell call.

maxLength10485760
Type ShellCallOutput

The type of the item. Always shell_call_output.

ID stringoptional

The unique ID of the shell tool call output. Populated when this item is returned via API.

MaxOutputLength int64optional

The maximum number of UTF-8 characters captured for this shell call's combined output.

Status stringoptional

The status of the shell call output.

Accepts one of the following:
const ResponseInputItemShellCallOutputStatusInProgress ResponseInputItemShellCallOutputStatus = "in_progress"
const ResponseInputItemShellCallOutputStatusCompleted ResponseInputItemShellCallOutputStatus = "completed"
const ResponseInputItemShellCallOutputStatusIncomplete ResponseInputItemShellCallOutputStatus = "incomplete"
type ResponseInputItemApplyPatchCall struct{…}

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

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Operation ResponseInputItemApplyPatchCallOperationUnion

The specific create, delete, or update instruction for the apply_patch tool call.

Accepts one of the following:
type ResponseInputItemApplyPatchCallOperationCreateFile struct{…}

Instruction for creating a new file via the apply_patch tool.

Diff string

Unified diff content to apply when creating the file.

maxLength10485760
Path string

Path of the file to create relative to the workspace root.

minLength1
Type CreateFile

The operation type. Always create_file.

type ResponseInputItemApplyPatchCallOperationDeleteFile struct{…}

Instruction for deleting an existing file via the apply_patch tool.

Path string

Path of the file to delete relative to the workspace root.

minLength1
Type DeleteFile

The operation type. Always delete_file.

type ResponseInputItemApplyPatchCallOperationUpdateFile struct{…}

Instruction for updating an existing file via the apply_patch tool.

Diff string

Unified diff content to apply to the existing file.

maxLength10485760
Path string

Path of the file to update relative to the workspace root.

minLength1
Type UpdateFile

The operation type. Always update_file.

Status string

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallStatusInProgress ResponseInputItemApplyPatchCallStatus = "in_progress"
const ResponseInputItemApplyPatchCallStatusCompleted ResponseInputItemApplyPatchCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

ID stringoptional

The unique ID of the apply patch tool call. Populated when this item is returned via API.

type ResponseInputItemApplyPatchCallOutput struct{…}

The streamed output emitted by an apply patch tool call.

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Status string

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallOutputStatusCompleted ResponseInputItemApplyPatchCallOutputStatus = "completed"
const ResponseInputItemApplyPatchCallOutputStatusFailed ResponseInputItemApplyPatchCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

ID stringoptional

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

Output stringoptional

Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

maxLength10485760
type ResponseInputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseInputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseInputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseInputItemMcpApprovalResponse struct{…}

A response to an MCP approval request.

ApprovalRequestID string

The ID of the approval request being answered.

Approve bool

Whether the request was approved.

Type McpApprovalResponse

The type of the item. Always mcp_approval_response.

ID stringoptional

The unique ID of the approval response

Reason stringoptional

Optional reason for the decision.

type ResponseInputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseInputItemMcpCallStatusInProgress ResponseInputItemMcpCallStatus = "in_progress"
const ResponseInputItemMcpCallStatusCompleted ResponseInputItemMcpCallStatus = "completed"
const ResponseInputItemMcpCallStatusIncomplete ResponseInputItemMcpCallStatus = "incomplete"
const ResponseInputItemMcpCallStatusCalling ResponseInputItemMcpCallStatus = "calling"
const ResponseInputItemMcpCallStatusFailed ResponseInputItemMcpCallStatus = "failed"
type ResponseCustomToolCallOutput struct{…}

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

CallID string

The call ID, used to map this custom tool call output to a custom tool call.

Output ResponseCustomToolCallOutputOutputUnion

The output from the custom tool call generated by your code. Can be a string or an list of output content.

Accepts one of the following:
string
type ResponseCustomToolCallOutputOutputOutputContentList []ResponseCustomToolCallOutputOutputOutputContentListItemUnion

Text, image, or file output of the custom tool call.

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type CustomToolCallOutput

The type of the custom tool call output. Always custom_tool_call_output.

ID stringoptional

The unique ID of the custom tool call output in the OpenAI platform.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

type ResponseInputItemItemReference struct{…}

An internal identifier for an item to reference.

ID string

The ID of the item to reference.

Type stringoptional

The type of item to reference. Always item_reference.

Metadata Metadata

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Model ResponsesModel

Model ID used to generate the response, like gpt-4o or o3. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.

Accepts one of the following:
string
type ChatModel string
Accepts one of the following:
const ChatModelGPT5_2 ChatModel = "gpt-5.2"
const ChatModelGPT5_2_2025_12_11 ChatModel = "gpt-5.2-2025-12-11"
const ChatModelGPT5_2ChatLatest ChatModel = "gpt-5.2-chat-latest"
const ChatModelGPT5_2Pro ChatModel = "gpt-5.2-pro"
const ChatModelGPT5_2Pro2025_12_11 ChatModel = "gpt-5.2-pro-2025-12-11"
const ChatModelGPT5_1 ChatModel = "gpt-5.1"
const ChatModelGPT5_1_2025_11_13 ChatModel = "gpt-5.1-2025-11-13"
const ChatModelGPT5_1Codex ChatModel = "gpt-5.1-codex"
const ChatModelGPT5_1Mini ChatModel = "gpt-5.1-mini"
const ChatModelGPT5_1ChatLatest ChatModel = "gpt-5.1-chat-latest"
const ChatModelGPT5 ChatModel = "gpt-5"
const ChatModelGPT5Mini ChatModel = "gpt-5-mini"
const ChatModelGPT5Nano ChatModel = "gpt-5-nano"
const ChatModelGPT5_2025_08_07 ChatModel = "gpt-5-2025-08-07"
const ChatModelGPT5Mini2025_08_07 ChatModel = "gpt-5-mini-2025-08-07"
const ChatModelGPT5Nano2025_08_07 ChatModel = "gpt-5-nano-2025-08-07"
const ChatModelGPT5ChatLatest ChatModel = "gpt-5-chat-latest"
const ChatModelGPT4_1 ChatModel = "gpt-4.1"
const ChatModelGPT4_1Mini ChatModel = "gpt-4.1-mini"
const ChatModelGPT4_1Nano ChatModel = "gpt-4.1-nano"
const ChatModelGPT4_1_2025_04_14 ChatModel = "gpt-4.1-2025-04-14"
const ChatModelGPT4_1Mini2025_04_14 ChatModel = "gpt-4.1-mini-2025-04-14"
const ChatModelGPT4_1Nano2025_04_14 ChatModel = "gpt-4.1-nano-2025-04-14"
const ChatModelO4Mini ChatModel = "o4-mini"
const ChatModelO4Mini2025_04_16 ChatModel = "o4-mini-2025-04-16"
const ChatModelO3 ChatModel = "o3"
const ChatModelO3_2025_04_16 ChatModel = "o3-2025-04-16"
const ChatModelO3Mini ChatModel = "o3-mini"
const ChatModelO3Mini2025_01_31 ChatModel = "o3-mini-2025-01-31"
const ChatModelO1 ChatModel = "o1"
const ChatModelO1_2024_12_17 ChatModel = "o1-2024-12-17"
const ChatModelO1Preview ChatModel = "o1-preview"
const ChatModelO1Preview2024_09_12 ChatModel = "o1-preview-2024-09-12"
const ChatModelO1Mini ChatModel = "o1-mini"
const ChatModelO1Mini2024_09_12 ChatModel = "o1-mini-2024-09-12"
const ChatModelGPT4o ChatModel = "gpt-4o"
const ChatModelGPT4o2024_11_20 ChatModel = "gpt-4o-2024-11-20"
const ChatModelGPT4o2024_08_06 ChatModel = "gpt-4o-2024-08-06"
const ChatModelGPT4o2024_05_13 ChatModel = "gpt-4o-2024-05-13"
const ChatModelGPT4oAudioPreview ChatModel = "gpt-4o-audio-preview"
const ChatModelGPT4oAudioPreview2024_10_01 ChatModel = "gpt-4o-audio-preview-2024-10-01"
const ChatModelGPT4oAudioPreview2024_12_17 ChatModel = "gpt-4o-audio-preview-2024-12-17"
const ChatModelGPT4oAudioPreview2025_06_03 ChatModel = "gpt-4o-audio-preview-2025-06-03"
const ChatModelGPT4oMiniAudioPreview ChatModel = "gpt-4o-mini-audio-preview"
const ChatModelGPT4oMiniAudioPreview2024_12_17 ChatModel = "gpt-4o-mini-audio-preview-2024-12-17"
const ChatModelGPT4oSearchPreview ChatModel = "gpt-4o-search-preview"
const ChatModelGPT4oMiniSearchPreview ChatModel = "gpt-4o-mini-search-preview"
const ChatModelGPT4oSearchPreview2025_03_11 ChatModel = "gpt-4o-search-preview-2025-03-11"
const ChatModelGPT4oMiniSearchPreview2025_03_11 ChatModel = "gpt-4o-mini-search-preview-2025-03-11"
const ChatModelChatgpt4oLatest ChatModel = "chatgpt-4o-latest"
const ChatModelCodexMiniLatest ChatModel = "codex-mini-latest"
const ChatModelGPT4oMini ChatModel = "gpt-4o-mini"
const ChatModelGPT4oMini2024_07_18 ChatModel = "gpt-4o-mini-2024-07-18"
const ChatModelGPT4Turbo ChatModel = "gpt-4-turbo"
const ChatModelGPT4Turbo2024_04_09 ChatModel = "gpt-4-turbo-2024-04-09"
const ChatModelGPT4_0125Preview ChatModel = "gpt-4-0125-preview"
const ChatModelGPT4TurboPreview ChatModel = "gpt-4-turbo-preview"
const ChatModelGPT4_1106Preview ChatModel = "gpt-4-1106-preview"
const ChatModelGPT4VisionPreview ChatModel = "gpt-4-vision-preview"
const ChatModelGPT4 ChatModel = "gpt-4"
const ChatModelGPT4_0314 ChatModel = "gpt-4-0314"
const ChatModelGPT4_0613 ChatModel = "gpt-4-0613"
const ChatModelGPT4_32k ChatModel = "gpt-4-32k"
const ChatModelGPT4_32k0314 ChatModel = "gpt-4-32k-0314"
const ChatModelGPT4_32k0613 ChatModel = "gpt-4-32k-0613"
const ChatModelGPT3_5Turbo ChatModel = "gpt-3.5-turbo"
const ChatModelGPT3_5Turbo16k ChatModel = "gpt-3.5-turbo-16k"
const ChatModelGPT3_5Turbo0301 ChatModel = "gpt-3.5-turbo-0301"
const ChatModelGPT3_5Turbo0613 ChatModel = "gpt-3.5-turbo-0613"
const ChatModelGPT3_5Turbo1106 ChatModel = "gpt-3.5-turbo-1106"
const ChatModelGPT3_5Turbo0125 ChatModel = "gpt-3.5-turbo-0125"
const ChatModelGPT3_5Turbo16k0613 ChatModel = "gpt-3.5-turbo-16k-0613"
type ResponsesModel string
Accepts one of the following:
const ResponsesModelO1Pro ResponsesModel = "o1-pro"
const ResponsesModelO1Pro2025_03_19 ResponsesModel = "o1-pro-2025-03-19"
const ResponsesModelO3Pro ResponsesModel = "o3-pro"
const ResponsesModelO3Pro2025_06_10 ResponsesModel = "o3-pro-2025-06-10"
const ResponsesModelO3DeepResearch ResponsesModel = "o3-deep-research"
const ResponsesModelO3DeepResearch2025_06_26 ResponsesModel = "o3-deep-research-2025-06-26"
const ResponsesModelO4MiniDeepResearch ResponsesModel = "o4-mini-deep-research"
const ResponsesModelO4MiniDeepResearch2025_06_26 ResponsesModel = "o4-mini-deep-research-2025-06-26"
const ResponsesModelComputerUsePreview ResponsesModel = "computer-use-preview"
const ResponsesModelComputerUsePreview2025_03_11 ResponsesModel = "computer-use-preview-2025-03-11"
const ResponsesModelGPT5Codex ResponsesModel = "gpt-5-codex"
const ResponsesModelGPT5Pro ResponsesModel = "gpt-5-pro"
const ResponsesModelGPT5Pro2025_10_06 ResponsesModel = "gpt-5-pro-2025-10-06"
const ResponsesModelGPT5_1CodexMax ResponsesModel = "gpt-5.1-codex-max"
Object Response

The object type of this resource - always set to response.

An array of content items generated by the model.

  • The length and order of items in the output array is dependent on the model's response.
  • Rather than accessing the first item in the output array and assuming it's an assistant message with the content generated by the model, you might consider using the output_text property where supported in SDKs.
Accepts one of the following:
type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItem struct{…}

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

ID string

The unique ID of the compaction item.

EncryptedContent string

The encrypted content that was produced by compaction.

Type Compaction

The type of the item. Always compaction.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseOutputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseOutputItemImageGenerationCallStatusInProgress ResponseOutputItemImageGenerationCallStatus = "in_progress"
const ResponseOutputItemImageGenerationCallStatusCompleted ResponseOutputItemImageGenerationCallStatus = "completed"
const ResponseOutputItemImageGenerationCallStatusGenerating ResponseOutputItemImageGenerationCallStatus = "generating"
const ResponseOutputItemImageGenerationCallStatusFailed ResponseOutputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseOutputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseOutputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseOutputItemLocalShellCallStatusInProgress ResponseOutputItemLocalShellCallStatus = "in_progress"
const ResponseOutputItemLocalShellCallStatusCompleted ResponseOutputItemLocalShellCallStatus = "completed"
const ResponseOutputItemLocalShellCallStatusIncomplete ResponseOutputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseFunctionShellToolCall struct{…}

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

ID string

The unique ID of the shell tool call. Populated when this item is returned via API.

Action ResponseFunctionShellToolCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string
MaxOutputLength int64

Optional maximum number of characters to return from each command.

TimeoutMs int64

Optional timeout in milliseconds for the commands.

CallID string

The unique ID of the shell tool call generated by the model.

Status ResponseFunctionShellToolCallStatus

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallStatusInProgress ResponseFunctionShellToolCallStatus = "in_progress"
const ResponseFunctionShellToolCallStatusCompleted ResponseFunctionShellToolCallStatus = "completed"
const ResponseFunctionShellToolCallStatusIncomplete ResponseFunctionShellToolCallStatus = "incomplete"
Type ShellCall

The type of the item. Always shell_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseFunctionShellToolCallOutput struct{…}

The output of a shell tool call that was emitted.

ID string

The unique ID of the shell call output. Populated when this item is returned via API.

CallID string

The unique ID of the shell tool call generated by the model.

MaxOutputLength int64

The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output.

Output []ResponseFunctionShellToolCallOutputOutput

An array of shell call output contents

Outcome ResponseFunctionShellToolCallOutputOutputOutcomeUnion

Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

Accepts one of the following:
type ResponseFunctionShellToolCallOutputOutputOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellToolCallOutputOutputOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

Exit code from the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

The standard error output that was captured.

Stdout string

The standard output that was captured.

CreatedBy stringoptional

The identifier of the actor that created the item.

Status ResponseFunctionShellToolCallOutputStatus

The status of the shell call output. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallOutputStatusInProgress ResponseFunctionShellToolCallOutputStatus = "in_progress"
const ResponseFunctionShellToolCallOutputStatusCompleted ResponseFunctionShellToolCallOutputStatus = "completed"
const ResponseFunctionShellToolCallOutputStatusIncomplete ResponseFunctionShellToolCallOutputStatus = "incomplete"
Type ShellCallOutput

The type of the shell call output. Always shell_call_output.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseApplyPatchToolCall struct{…}

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

ID string

The unique ID of the apply patch tool call. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Operation ResponseApplyPatchToolCallOperationUnion

One of the create_file, delete_file, or update_file operations applied via apply_patch.

Accepts one of the following:
type ResponseApplyPatchToolCallOperationCreateFile struct{…}

Instruction describing how to create a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to create.

Type CreateFile

Create a new file with the provided diff.

type ResponseApplyPatchToolCallOperationDeleteFile struct{…}

Instruction describing how to delete a file via the apply_patch tool.

Path string

Path of the file to delete.

Type DeleteFile

Delete the specified file.

type ResponseApplyPatchToolCallOperationUpdateFile struct{…}

Instruction describing how to update a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to update.

Type UpdateFile

Update an existing file with the provided diff.

Status ResponseApplyPatchToolCallStatus

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseApplyPatchToolCallStatusInProgress ResponseApplyPatchToolCallStatus = "in_progress"
const ResponseApplyPatchToolCallStatusCompleted ResponseApplyPatchToolCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseApplyPatchToolCallOutput struct{…}

The output emitted by an apply patch tool call.

ID string

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Status ResponseApplyPatchToolCallOutputStatus

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseApplyPatchToolCallOutputStatusCompleted ResponseApplyPatchToolCallOutputStatus = "completed"
const ResponseApplyPatchToolCallOutputStatusFailed ResponseApplyPatchToolCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

CreatedBy stringoptional

The ID of the entity that created this tool call output.

Output stringoptional

Optional textual output returned by the apply patch tool.

type ResponseOutputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseOutputItemMcpCallStatusInProgress ResponseOutputItemMcpCallStatus = "in_progress"
const ResponseOutputItemMcpCallStatusCompleted ResponseOutputItemMcpCallStatus = "completed"
const ResponseOutputItemMcpCallStatusIncomplete ResponseOutputItemMcpCallStatus = "incomplete"
const ResponseOutputItemMcpCallStatusCalling ResponseOutputItemMcpCallStatus = "calling"
const ResponseOutputItemMcpCallStatusFailed ResponseOutputItemMcpCallStatus = "failed"
type ResponseOutputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseOutputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseOutputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

ParallelToolCalls bool

Whether to allow the model to run tool calls in parallel.

Temperature float64

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.

minimum0
maximum2
ToolChoice ResponseToolChoiceUnion

How the model should select which tool (or tools) to use when generating a response. See the tools parameter to see how to specify which tools the model can call.

Accepts one of the following:
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.

Accepts one of the following:
const ToolChoiceOptionsNone ToolChoiceOptions = "none"
const ToolChoiceOptionsAuto ToolChoiceOptions = "auto"
const ToolChoiceOptionsRequired ToolChoiceOptions = "required"
type ToolChoiceAllowed struct{…}

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

Mode ToolChoiceAllowedMode

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

auto allows the model to pick from among the allowed tools and generate a message.

required requires the model to call one or more of the allowed tools.

Accepts one of the following:
const ToolChoiceAllowedModeAuto ToolChoiceAllowedMode = "auto"
const ToolChoiceAllowedModeRequired ToolChoiceAllowedMode = "required"
Tools []map[string, any]

A list of tool definitions that the model should be allowed to call.

For the Responses API, the list of tool definitions might look like:

[
  { "type": "function", "name": "get_weather" },
  { "type": "mcp", "server_label": "deepwiki" },
  { "type": "image_generation" }
]
Type AllowedTools

Allowed tool configuration type. Always allowed_tools.

type ToolChoiceTypes struct{…}

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

Type ToolChoiceTypesType

The type of hosted tool the model should to use. Learn more about built-in tools.

Allowed values are:

  • file_search
  • web_search_preview
  • computer_use_preview
  • code_interpreter
  • image_generation
Accepts one of the following:
const ToolChoiceTypesTypeFileSearch ToolChoiceTypesType = "file_search"
const ToolChoiceTypesTypeWebSearchPreview ToolChoiceTypesType = "web_search_preview"
const ToolChoiceTypesTypeComputerUsePreview ToolChoiceTypesType = "computer_use_preview"
const ToolChoiceTypesTypeWebSearchPreview2025_03_11 ToolChoiceTypesType = "web_search_preview_2025_03_11"
const ToolChoiceTypesTypeImageGeneration ToolChoiceTypesType = "image_generation"
const ToolChoiceTypesTypeCodeInterpreter ToolChoiceTypesType = "code_interpreter"
type ToolChoiceFunction struct{…}

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

Name string

The name of the function to call.

Type Function

For function calling, the type is always function.

type ToolChoiceMcp struct{…}

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

ServerLabel string

The label of the MCP server to use.

Type Mcp

For MCP tools, the type is always mcp.

Name stringoptional

The name of the tool to call on the server.

type ToolChoiceCustom struct{…}

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

Name string

The name of the custom tool to call.

Type Custom

For custom tool calling, the type is always custom.

type ToolChoiceApplyPatch struct{…}

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

Type ApplyPatch

The tool to call. Always apply_patch.

type ToolChoiceShell struct{…}

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

Type Shell

The tool to call. Always shell.

Tools []ToolUnion

An array of tools the model may call while generating a response. You can specify which tool to use by setting the tool_choice parameter.

We support the following categories of tools:

  • Built-in tools: Tools that are provided by OpenAI that extend the model's capabilities, like web search or file search. Learn more about built-in tools.
  • MCP Tools: Integrations with third-party systems via custom MCP servers or predefined connectors such as Google Drive and SharePoint. Learn more about MCP Tools.
  • Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code with strongly typed arguments and outputs. Learn more about function calling. You can also use custom tools to call your own code.
Accepts one of the following:
type FunctionTool struct{…}

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

Name string

The name of the function to call.

Parameters map[string, any]

A JSON schema object describing the parameters of the function.

Strict bool

Whether to enforce strict parameter validation. Default true.

Type Function

The type of the function tool. Always function.

Description stringoptional

A description of the function. Used by the model to determine whether or not to call the function.

type FileSearchTool struct{…}

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

Type FileSearch

The type of the file search tool. Always file_search.

VectorStoreIDs []string

The IDs of the vector stores to search.

Filters FileSearchToolFiltersUnionoptional

A filter to apply.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
type CompoundFilter struct{…}

Combine multiple filters using and or or.

Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
Type CompoundFilterType

Type of operation: and or or.

Accepts one of the following:
const CompoundFilterTypeAnd CompoundFilterType = "and"
const CompoundFilterTypeOr CompoundFilterType = "or"
MaxNumResults int64optional

The maximum number of results to return. This number should be between 1 and 50 inclusive.

RankingOptions FileSearchToolRankingOptionsoptional

Ranking options for search.

Ranker stringoptional

The ranker to use for the file search.

Accepts one of the following:
const FileSearchToolRankingOptionsRankerAuto FileSearchToolRankingOptionsRanker = "auto"
const FileSearchToolRankingOptionsRankerDefault2024_11_15 FileSearchToolRankingOptionsRanker = "default-2024-11-15"
ScoreThreshold float64optional

The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.

type ComputerTool struct{…}

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

DisplayHeight int64

The height of the computer display.

DisplayWidth int64

The width of the computer display.

Environment ComputerToolEnvironment

The type of computer environment to control.

Accepts one of the following:
const ComputerToolEnvironmentWindows ComputerToolEnvironment = "windows"
const ComputerToolEnvironmentMac ComputerToolEnvironment = "mac"
const ComputerToolEnvironmentLinux ComputerToolEnvironment = "linux"
const ComputerToolEnvironmentUbuntu ComputerToolEnvironment = "ubuntu"
const ComputerToolEnvironmentBrowser ComputerToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type WebSearchTool struct{…}

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

Type WebSearchToolType

The type of the web search tool. One of web_search or web_search_2025_08_26.

Accepts one of the following:
const WebSearchToolTypeWebSearch WebSearchToolType = "web_search"
const WebSearchToolTypeWebSearch2025_08_26 WebSearchToolType = "web_search_2025_08_26"
Filters WebSearchToolFiltersoptional

Filters for the search.

AllowedDomains []stringoptional

Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.

Example: ["pubmed.ncbi.nlm.nih.gov"]

SearchContextSize WebSearchToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchToolSearchContextSizeLow WebSearchToolSearchContextSize = "low"
const WebSearchToolSearchContextSizeMedium WebSearchToolSearchContextSize = "medium"
const WebSearchToolSearchContextSizeHigh WebSearchToolSearchContextSize = "high"
UserLocation WebSearchToolUserLocationoptional

The approximate location of the user.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

Type stringoptional

The type of location approximation. Always approximate.

type ToolMcp struct{…}

Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.

ServerLabel string

A label for this MCP server, used to identify it in tool calls.

Type Mcp

The type of the MCP tool. Always mcp.

AllowedTools ToolMcpAllowedToolsUnionoptional

List of allowed tool names or a filter object.

Accepts one of the following:
type ToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type ToolMcpAllowedToolsMcpToolFilter struct{…}

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Authorization stringoptional

An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.

ConnectorID stringoptional

Identifier for service connectors, like those available in ChatGPT. One of server_url or connector_id must be provided. Learn more about service connectors here.

Currently supported connector_id values are:

  • Dropbox: connector_dropbox
  • Gmail: connector_gmail
  • Google Calendar: connector_googlecalendar
  • Google Drive: connector_googledrive
  • Microsoft Teams: connector_microsoftteams
  • Outlook Calendar: connector_outlookcalendar
  • Outlook Email: connector_outlookemail
  • SharePoint: connector_sharepoint
Accepts one of the following:
const ToolMcpConnectorIDConnectorDropbox ToolMcpConnectorID = "connector_dropbox"
const ToolMcpConnectorIDConnectorGmail ToolMcpConnectorID = "connector_gmail"
const ToolMcpConnectorIDConnectorGooglecalendar ToolMcpConnectorID = "connector_googlecalendar"
const ToolMcpConnectorIDConnectorGoogledrive ToolMcpConnectorID = "connector_googledrive"
const ToolMcpConnectorIDConnectorMicrosoftteams ToolMcpConnectorID = "connector_microsoftteams"
const ToolMcpConnectorIDConnectorOutlookcalendar ToolMcpConnectorID = "connector_outlookcalendar"
const ToolMcpConnectorIDConnectorOutlookemail ToolMcpConnectorID = "connector_outlookemail"
const ToolMcpConnectorIDConnectorSharepoint ToolMcpConnectorID = "connector_sharepoint"
Headers map[string, string]optional

Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.

RequireApproval ToolMcpRequireApprovalUnionoptional

Specify which of the MCP server's tools require approval.

Accepts one of the following:
type ToolMcpRequireApprovalMcpToolApprovalFilter struct{…}

Specify which of the MCP server's tools require approval. Can be always, never, or a filter object associated with tools that require approval.

Always ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysoptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Never ToolMcpRequireApprovalMcpToolApprovalFilterNeveroptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

type ToolMcpRequireApprovalMcpToolApprovalSetting string

Specify a single approval policy for all tools. One of always or never. When set to always, all tools will require approval. When set to never, all tools will not require approval.

Accepts one of the following:
const ToolMcpRequireApprovalMcpToolApprovalSettingAlways ToolMcpRequireApprovalMcpToolApprovalSetting = "always"
const ToolMcpRequireApprovalMcpToolApprovalSettingNever ToolMcpRequireApprovalMcpToolApprovalSetting = "never"
ServerDescription stringoptional

Optional description of the MCP server, used to provide more context.

ServerURL stringoptional

The URL for the MCP server. One of server_url or connector_id must be provided.

type ToolCodeInterpreter struct{…}

A tool that runs Python code to help generate a response to a prompt.

Container ToolCodeInterpreterContainerUnion

The code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional memory_limit setting.

Accepts one of the following:
string
type ToolCodeInterpreterContainerCodeInterpreterContainerAuto struct{…}

Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

Type Auto

Always auto.

FileIDs []stringoptional

An optional list of uploaded files to make available to your code.

MemoryLimit stringoptional

The memory limit for the code interpreter container.

Accepts one of the following:
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
Type CodeInterpreter

The type of the code interpreter tool. Always code_interpreter.

type ToolImageGeneration struct{…}

A tool that generates images using the GPT image models.

Type ImageGeneration

The type of the image generation tool. Always image_generation.

Action stringoptional

Whether to generate a new image or edit an existing image. Default: auto.

Accepts one of the following:
const ToolImageGenerationActionGenerate ToolImageGenerationAction = "generate"
const ToolImageGenerationActionEdit ToolImageGenerationAction = "edit"
const ToolImageGenerationActionAuto ToolImageGenerationAction = "auto"
Background stringoptional

Background type for the generated image. One of transparent, opaque, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationBackgroundTransparent ToolImageGenerationBackground = "transparent"
const ToolImageGenerationBackgroundOpaque ToolImageGenerationBackground = "opaque"
const ToolImageGenerationBackgroundAuto ToolImageGenerationBackground = "auto"
InputFidelity stringoptional

Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for gpt-image-1 and gpt-image-1.5 and later models, unsupported for gpt-image-1-mini. Supports high and low. Defaults to low.

Accepts one of the following:
const ToolImageGenerationInputFidelityHigh ToolImageGenerationInputFidelity = "high"
const ToolImageGenerationInputFidelityLow ToolImageGenerationInputFidelity = "low"
InputImageMask ToolImageGenerationInputImageMaskoptional

Optional mask for inpainting. Contains image_url (string, optional) and file_id (string, optional).

FileID stringoptional

File ID for the mask image.

ImageURL stringoptional

Base64-encoded mask image.

Model stringoptional

The image generation model to use. Default: gpt-image-1.

Accepts one of the following:
string
string
Accepts one of the following:
const ToolImageGenerationModelGPTImage1 ToolImageGenerationModel = "gpt-image-1"
const ToolImageGenerationModelGPTImage1Mini ToolImageGenerationModel = "gpt-image-1-mini"
const ToolImageGenerationModelGPTImage1_5 ToolImageGenerationModel = "gpt-image-1.5"
Moderation stringoptional

Moderation level for the generated image. Default: auto.

Accepts one of the following:
const ToolImageGenerationModerationAuto ToolImageGenerationModeration = "auto"
const ToolImageGenerationModerationLow ToolImageGenerationModeration = "low"
OutputCompression int64optional

Compression level for the output image. Default: 100.

minimum0
maximum100
OutputFormat stringoptional

The output format of the generated image. One of png, webp, or jpeg. Default: png.

Accepts one of the following:
const ToolImageGenerationOutputFormatPNG ToolImageGenerationOutputFormat = "png"
const ToolImageGenerationOutputFormatWebP ToolImageGenerationOutputFormat = "webp"
const ToolImageGenerationOutputFormatJPEG ToolImageGenerationOutputFormat = "jpeg"
PartialImages int64optional

Number of partial images to generate in streaming mode, from 0 (default value) to 3.

minimum0
maximum3
Quality stringoptional

The quality of the generated image. One of low, medium, high, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationQualityLow ToolImageGenerationQuality = "low"
const ToolImageGenerationQualityMedium ToolImageGenerationQuality = "medium"
const ToolImageGenerationQualityHigh ToolImageGenerationQuality = "high"
const ToolImageGenerationQualityAuto ToolImageGenerationQuality = "auto"
Size stringoptional

The size of the generated image. One of 1024x1024, 1024x1536, 1536x1024, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationSize1024x1024 ToolImageGenerationSize = "1024x1024"
const ToolImageGenerationSize1024x1536 ToolImageGenerationSize = "1024x1536"
const ToolImageGenerationSize1536x1024 ToolImageGenerationSize = "1536x1024"
const ToolImageGenerationSizeAuto ToolImageGenerationSize = "auto"
type ToolLocalShell struct{…}

A tool that allows the model to execute shell commands in a local environment.

Type LocalShell

The type of the local shell tool. Always local_shell.

type FunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

type CustomTool struct{…}

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

Name string

The name of the custom tool, used to identify it in tool calls.

Type Custom

The type of the custom tool. Always custom.

Description stringoptional

Optional description of the custom tool, used to provide more context.

The input format for the custom tool. Default is unconstrained text.

Accepts one of the following:
type CustomToolInputFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

type CustomToolInputFormatGrammar struct{…}

A grammar defined by the user.

Definition string

The grammar definition.

Syntax string

The syntax of the grammar definition. One of lark or regex.

Accepts one of the following:
const CustomToolInputFormatGrammarSyntaxLark CustomToolInputFormatGrammarSyntax = "lark"
const CustomToolInputFormatGrammarSyntaxRegex CustomToolInputFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

type WebSearchPreviewTool struct{…}

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

Type WebSearchPreviewToolType

The type of the web search tool. One of web_search_preview or web_search_preview_2025_03_11.

Accepts one of the following:
const WebSearchPreviewToolTypeWebSearchPreview WebSearchPreviewToolType = "web_search_preview"
const WebSearchPreviewToolTypeWebSearchPreview2025_03_11 WebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContextSize WebSearchPreviewToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchPreviewToolSearchContextSizeLow WebSearchPreviewToolSearchContextSize = "low"
const WebSearchPreviewToolSearchContextSizeMedium WebSearchPreviewToolSearchContextSize = "medium"
const WebSearchPreviewToolSearchContextSizeHigh WebSearchPreviewToolSearchContextSize = "high"
UserLocation WebSearchPreviewToolUserLocationoptional

The user's location.

Type Approximate

The type of location approximation. Always approximate.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

type ApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

TopP float64

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

minimum0
maximum1
Background booloptional

Whether to run the model response in the background. Learn more.

CompletedAt float64optional

Unix timestamp (in seconds) of when this Response was completed. Only present when the status is completed.

Conversation ResponseConversationoptional

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

ID string

The unique ID of the conversation that this response was associated with.

MaxOutputTokens int64optional

An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.

MaxToolCalls int64optional

The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

PreviousResponseID stringoptional

The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state. Cannot be used in conjunction with conversation.

Prompt ResponsePromptoptional

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

ID string

The unique identifier of the prompt template to use.

Variables map[string, ResponsePromptVariableUnion]optional

Optional map of values to substitute in for variables in your prompt. The substitution values can either be strings, or other Response input types like images or files.

Accepts one of the following:
string
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Version stringoptional

Optional version of the prompt template.

PromptCacheKey stringoptional

Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the user field. Learn more.

PromptCacheRetention ResponsePromptCacheRetentionoptional

The retention policy for the prompt cache. Set to 24h to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. Learn more.

Accepts one of the following:
const ResponsePromptCacheRetentionInMemory ResponsePromptCacheRetention = "in-memory"
const ResponsePromptCacheRetention24h ResponsePromptCacheRetention = "24h"
Reasoning Reasoningoptional

gpt-5 and o-series models only

Configuration options for reasoning models.

Effort ReasoningEffortoptional

Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, and xhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.

  • gpt-5.1 defaults to none, which does not perform reasoning. The supported reasoning values for gpt-5.1 are none, low, medium, and high. Tool calls are supported for all reasoning values in gpt-5.1.
  • All models before gpt-5.1 default to medium reasoning effort, and do not support none.
  • The gpt-5-pro model defaults to (and only supports) high reasoning effort.
  • xhigh is supported for all models after gpt-5.1-codex-max.
Accepts one of the following:
const ReasoningEffortNone ReasoningEffort = "none"
const ReasoningEffortMinimal ReasoningEffort = "minimal"
const ReasoningEffortLow ReasoningEffort = "low"
const ReasoningEffortMedium ReasoningEffort = "medium"
const ReasoningEffortHigh ReasoningEffort = "high"
const ReasoningEffortXhigh ReasoningEffort = "xhigh"
DeprecatedGenerateSummary ReasoningGenerateSummaryoptional

Deprecated: use summary instead.

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.

Accepts one of the following:
const ReasoningGenerateSummaryAuto ReasoningGenerateSummary = "auto"
const ReasoningGenerateSummaryConcise ReasoningGenerateSummary = "concise"
const ReasoningGenerateSummaryDetailed ReasoningGenerateSummary = "detailed"
Summary ReasoningSummaryoptional

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.

concise is supported for computer-use-preview models and all reasoning models after gpt-5.

Accepts one of the following:
const ReasoningSummaryAuto ReasoningSummary = "auto"
const ReasoningSummaryConcise ReasoningSummary = "concise"
const ReasoningSummaryDetailed ReasoningSummary = "detailed"
SafetyIdentifier stringoptional

A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. Learn more.

ServiceTier ResponseServiceTieroptional

Specifies the processing type used for serving the request.

  • If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
  • If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
  • If set to 'flex' or 'priority', then the request will be processed with the corresponding service tier.
  • When not set, the default behavior is 'auto'.

When the service_tier parameter is set, the response body will include the service_tier value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

Accepts one of the following:
const ResponseServiceTierAuto ResponseServiceTier = "auto"
const ResponseServiceTierDefault ResponseServiceTier = "default"
const ResponseServiceTierFlex ResponseServiceTier = "flex"
const ResponseServiceTierScale ResponseServiceTier = "scale"
const ResponseServiceTierPriority ResponseServiceTier = "priority"
Status ResponseStatusoptional

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

Accepts one of the following:
const ResponseStatusCompleted ResponseStatus = "completed"
const ResponseStatusFailed ResponseStatus = "failed"
const ResponseStatusInProgress ResponseStatus = "in_progress"
const ResponseStatusCancelled ResponseStatus = "cancelled"
const ResponseStatusQueued ResponseStatus = "queued"
const ResponseStatusIncomplete ResponseStatus = "incomplete"
Text ResponseTextConfigoptional

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

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.

Accepts one of the following:
type ResponseFormatText struct{…}

Default response format. Used to generate text responses.

Type Text

The type of response format being defined. Always text.

type ResponseFormatTextJSONSchemaConfig struct{…}

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

Name string

The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.

Schema map[string, any]

The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.

Type JSONSchema

The type of response format being defined. Always json_schema.

Description stringoptional

A description of what the response format is for, used by the model to determine how to respond in the format.

Strict booloptional

Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true. To learn more, read the Structured Outputs guide.

type ResponseFormatJSONObject struct{…}

JSON object response format. An older method of generating JSON responses. Using json_schema is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.

Type JSONObject

The type of response format being defined. Always json_object.

Verbosity ResponseTextConfigVerbosityoptional

Constrains the verbosity of the model's response. Lower values will result in more concise responses, while higher values will result in more verbose responses. Currently supported values are low, medium, and high.

Accepts one of the following:
const ResponseTextConfigVerbosityLow ResponseTextConfigVerbosity = "low"
const ResponseTextConfigVerbosityMedium ResponseTextConfigVerbosity = "medium"
const ResponseTextConfigVerbosityHigh ResponseTextConfigVerbosity = "high"
TopLogprobs int64optional

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.

minimum0
maximum20
Truncation ResponseTruncationoptional

The truncation strategy to use for the model response.

  • auto: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation.
  • disabled (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.
Accepts one of the following:
const ResponseTruncationAuto ResponseTruncation = "auto"
const ResponseTruncationDisabled ResponseTruncation = "disabled"
Usage ResponseUsageoptional

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

InputTokens int64

The number of input tokens.

InputTokensDetails ResponseUsageInputTokensDetails

A detailed breakdown of the input tokens.

CachedTokens int64

The number of tokens that were retrieved from the cache. More on prompt caching.

OutputTokens int64

The number of output tokens.

OutputTokensDetails ResponseUsageOutputTokensDetails

A detailed breakdown of the output tokens.

ReasoningTokens int64

The number of reasoning tokens.

TotalTokens int64

The total number of tokens used.

DeprecatedUser stringoptional

This field is being replaced by safety_identifier and prompt_cache_key. Use prompt_cache_key instead to maintain caching optimizations. A stable identifier for your end-users. Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. Learn more.

SequenceNumber int64

The sequence number of this event.

Type ResponseFailed

The type of the event. Always response.failed.

type ResponseIncompleteEvent struct{…}

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

Response Response

The response that was incomplete.

ID string

Unique identifier for this Response.

CreatedAt float64

Unix timestamp (in seconds) of when this Response was created.

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

Code ResponseErrorCode

The error code for the response.

Accepts one of the following:
const ResponseErrorCodeServerError ResponseErrorCode = "server_error"
const ResponseErrorCodeRateLimitExceeded ResponseErrorCode = "rate_limit_exceeded"
const ResponseErrorCodeInvalidPrompt ResponseErrorCode = "invalid_prompt"
const ResponseErrorCodeVectorStoreTimeout ResponseErrorCode = "vector_store_timeout"
const ResponseErrorCodeInvalidImage ResponseErrorCode = "invalid_image"
const ResponseErrorCodeInvalidImageFormat ResponseErrorCode = "invalid_image_format"
const ResponseErrorCodeInvalidBase64Image ResponseErrorCode = "invalid_base64_image"
const ResponseErrorCodeInvalidImageURL ResponseErrorCode = "invalid_image_url"
const ResponseErrorCodeImageTooLarge ResponseErrorCode = "image_too_large"
const ResponseErrorCodeImageTooSmall ResponseErrorCode = "image_too_small"
const ResponseErrorCodeImageParseError ResponseErrorCode = "image_parse_error"
const ResponseErrorCodeImageContentPolicyViolation ResponseErrorCode = "image_content_policy_violation"
const ResponseErrorCodeInvalidImageMode ResponseErrorCode = "invalid_image_mode"
const ResponseErrorCodeImageFileTooLarge ResponseErrorCode = "image_file_too_large"
const ResponseErrorCodeUnsupportedImageMediaType ResponseErrorCode = "unsupported_image_media_type"
const ResponseErrorCodeEmptyImageFile ResponseErrorCode = "empty_image_file"
const ResponseErrorCodeFailedToDownloadImage ResponseErrorCode = "failed_to_download_image"
const ResponseErrorCodeImageFileNotFound ResponseErrorCode = "image_file_not_found"
Message string

A human-readable description of the error.

IncompleteDetails ResponseIncompleteDetails

Details about why the response is incomplete.

Reason stringoptional

The reason why the response is incomplete.

Accepts one of the following:
const ResponseIncompleteDetailsReasonMaxOutputTokens ResponseIncompleteDetailsReason = "max_output_tokens"
const ResponseIncompleteDetailsReasonContentFilter ResponseIncompleteDetailsReason = "content_filter"
Instructions ResponseInstructionsUnion

A system (or developer) message inserted into the model's context.

When using along with previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.

Accepts one of the following:
string
type ResponseInstructionsInputItemList []ResponseInputItemUnion

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

Accepts one of the following:
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.

Content EasyInputMessageContentUnion

Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.

Accepts one of the following:
string
type ResponseInputMessageContentList []ResponseInputContentUnion

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role EasyInputMessageRole

The role of the message input. One of user, assistant, system, or developer.

Accepts one of the following:
const EasyInputMessageRoleUser EasyInputMessageRole = "user"
const EasyInputMessageRoleAssistant EasyInputMessageRole = "assistant"
const EasyInputMessageRoleSystem EasyInputMessageRole = "system"
const EasyInputMessageRoleDeveloper EasyInputMessageRole = "developer"
Type EasyInputMessageTypeoptional

The type of the message input. Always message.

type ResponseInputItemMessage 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.

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role string

The role of the message input. One of user, system, or developer.

Accepts one of the following:
const ResponseInputItemMessageRoleUser ResponseInputItemMessageRole = "user"
const ResponseInputItemMessageRoleSystem ResponseInputItemMessageRole = "system"
const ResponseInputItemMessageRoleDeveloper ResponseInputItemMessageRole = "developer"
Status stringoptional

The status of item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemMessageStatusInProgress ResponseInputItemMessageStatus = "in_progress"
const ResponseInputItemMessageStatusCompleted ResponseInputItemMessageStatus = "completed"
const ResponseInputItemMessageStatusIncomplete ResponseInputItemMessageStatus = "incomplete"
Type stringoptional

The type of the message input. Always set to message.

type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

type ResponseInputItemComputerCallOutput struct{…}

The output of a computer tool call.

CallID string

The ID of the computer tool call that produced the output.

maxLength64
minLength1

A computer screenshot image used with the computer use tool.

Type ComputerScreenshot

Specifies the event type. For a computer screenshot, this property is always set to computer_screenshot.

FileID stringoptional

The identifier of an uploaded file that contains the screenshot.

ImageURL stringoptional

The URL of the screenshot image.

Type ComputerCallOutput

The type of the computer tool call output. Always computer_call_output.

ID stringoptional

The ID of the computer tool call output.

AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckoptional

The safety checks reported by the API that have been acknowledged by the developer.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status stringoptional

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseInputItemComputerCallOutputStatusInProgress ResponseInputItemComputerCallOutputStatus = "in_progress"
const ResponseInputItemComputerCallOutputStatusCompleted ResponseInputItemComputerCallOutputStatus = "completed"
const ResponseInputItemComputerCallOutputStatusIncomplete ResponseInputItemComputerCallOutputStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
type ResponseInputItemFunctionCallOutput struct{…}

The output of a function tool call.

CallID string

The unique ID of the function tool call generated by the model.

maxLength64
minLength1
Output ResponseInputItemFunctionCallOutputOutputUnion

Text, image, or file output of the function tool call.

Accepts one of the following:
string
type ResponseFunctionCallOutputItemList []ResponseFunctionCallOutputItemUnion

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

Accepts one of the following:
type ResponseInputTextContent struct{…}

A text input to the model.

Text string

The text input to the model.

maxLength10485760
Type InputText

The type of the input item. Always input_text.

type ResponseInputImageContent struct{…}

An image input to the model. Learn about image inputs

Type InputImage

The type of the input item. Always input_image.

Detail ResponseInputImageContentDetailoptional

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageContentDetailLow ResponseInputImageContentDetail = "low"
const ResponseInputImageContentDetailHigh ResponseInputImageContentDetail = "high"
const ResponseInputImageContentDetailAuto ResponseInputImageContentDetail = "auto"
FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

maxLength20971520
type ResponseInputFileContent struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The base64-encoded data of the file to be sent to the model.

maxLength33554432
FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type FunctionCallOutput

The type of the function tool call output. Always function_call_output.

ID stringoptional

The unique ID of the function tool call output. Populated when this item is returned via API.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemFunctionCallOutputStatusInProgress ResponseInputItemFunctionCallOutputStatus = "in_progress"
const ResponseInputItemFunctionCallOutputStatusCompleted ResponseInputItemFunctionCallOutputStatus = "completed"
const ResponseInputItemFunctionCallOutputStatusIncomplete ResponseInputItemFunctionCallOutputStatus = "incomplete"
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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItemParamResp struct{…}

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

EncryptedContent string

The encrypted content of the compaction summary.

maxLength10485760
Type Compaction

The type of the item. Always compaction.

ID stringoptional

The ID of the compaction item.

type ResponseInputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseInputItemImageGenerationCallStatusInProgress ResponseInputItemImageGenerationCallStatus = "in_progress"
const ResponseInputItemImageGenerationCallStatusCompleted ResponseInputItemImageGenerationCallStatus = "completed"
const ResponseInputItemImageGenerationCallStatusGenerating ResponseInputItemImageGenerationCallStatus = "generating"
const ResponseInputItemImageGenerationCallStatusFailed ResponseInputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseInputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseInputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseInputItemLocalShellCallStatusInProgress ResponseInputItemLocalShellCallStatus = "in_progress"
const ResponseInputItemLocalShellCallStatusCompleted ResponseInputItemLocalShellCallStatus = "completed"
const ResponseInputItemLocalShellCallStatusIncomplete ResponseInputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseInputItemLocalShellCallOutput struct{…}

The output of a local shell tool call.

ID string

The unique ID of the local shell tool call generated by the model.

Output string

A JSON string of the output of the local shell tool call.

Type LocalShellCallOutput

The type of the local shell tool call output. Always local_shell_call_output.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemLocalShellCallOutputStatusInProgress ResponseInputItemLocalShellCallOutputStatus = "in_progress"
const ResponseInputItemLocalShellCallOutputStatusCompleted ResponseInputItemLocalShellCallOutputStatus = "completed"
const ResponseInputItemLocalShellCallOutputStatusIncomplete ResponseInputItemLocalShellCallOutputStatus = "incomplete"
type ResponseInputItemShellCall struct{…}

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

Action ResponseInputItemShellCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string

Ordered shell commands for the execution environment to run.

MaxOutputLength int64optional

Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

TimeoutMs int64optional

Maximum wall-clock time in milliseconds to allow the shell commands to run.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1
Type ShellCall

The type of the item. Always shell_call.

ID stringoptional

The unique ID of the shell tool call. Populated when this item is returned via API.

Status stringoptional

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemShellCallStatusInProgress ResponseInputItemShellCallStatus = "in_progress"
const ResponseInputItemShellCallStatusCompleted ResponseInputItemShellCallStatus = "completed"
const ResponseInputItemShellCallStatusIncomplete ResponseInputItemShellCallStatus = "incomplete"
type ResponseInputItemShellCallOutput struct{…}

The streamed output items emitted by a shell tool call.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1

Captured chunks of stdout and stderr output, along with their associated outcomes.

Outcome ResponseFunctionShellCallOutputContentOutcomeUnion

The exit or timeout outcome associated with this shell call.

Accepts one of the following:
type ResponseFunctionShellCallOutputContentOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellCallOutputContentOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

The exit code returned by the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

Captured stderr output for the shell call.

maxLength10485760
Stdout string

Captured stdout output for the shell call.

maxLength10485760
Type ShellCallOutput

The type of the item. Always shell_call_output.

ID stringoptional

The unique ID of the shell tool call output. Populated when this item is returned via API.

MaxOutputLength int64optional

The maximum number of UTF-8 characters captured for this shell call's combined output.

Status stringoptional

The status of the shell call output.

Accepts one of the following:
const ResponseInputItemShellCallOutputStatusInProgress ResponseInputItemShellCallOutputStatus = "in_progress"
const ResponseInputItemShellCallOutputStatusCompleted ResponseInputItemShellCallOutputStatus = "completed"
const ResponseInputItemShellCallOutputStatusIncomplete ResponseInputItemShellCallOutputStatus = "incomplete"
type ResponseInputItemApplyPatchCall struct{…}

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

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Operation ResponseInputItemApplyPatchCallOperationUnion

The specific create, delete, or update instruction for the apply_patch tool call.

Accepts one of the following:
type ResponseInputItemApplyPatchCallOperationCreateFile struct{…}

Instruction for creating a new file via the apply_patch tool.

Diff string

Unified diff content to apply when creating the file.

maxLength10485760
Path string

Path of the file to create relative to the workspace root.

minLength1
Type CreateFile

The operation type. Always create_file.

type ResponseInputItemApplyPatchCallOperationDeleteFile struct{…}

Instruction for deleting an existing file via the apply_patch tool.

Path string

Path of the file to delete relative to the workspace root.

minLength1
Type DeleteFile

The operation type. Always delete_file.

type ResponseInputItemApplyPatchCallOperationUpdateFile struct{…}

Instruction for updating an existing file via the apply_patch tool.

Diff string

Unified diff content to apply to the existing file.

maxLength10485760
Path string

Path of the file to update relative to the workspace root.

minLength1
Type UpdateFile

The operation type. Always update_file.

Status string

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallStatusInProgress ResponseInputItemApplyPatchCallStatus = "in_progress"
const ResponseInputItemApplyPatchCallStatusCompleted ResponseInputItemApplyPatchCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

ID stringoptional

The unique ID of the apply patch tool call. Populated when this item is returned via API.

type ResponseInputItemApplyPatchCallOutput struct{…}

The streamed output emitted by an apply patch tool call.

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Status string

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallOutputStatusCompleted ResponseInputItemApplyPatchCallOutputStatus = "completed"
const ResponseInputItemApplyPatchCallOutputStatusFailed ResponseInputItemApplyPatchCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

ID stringoptional

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

Output stringoptional

Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

maxLength10485760
type ResponseInputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseInputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseInputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseInputItemMcpApprovalResponse struct{…}

A response to an MCP approval request.

ApprovalRequestID string

The ID of the approval request being answered.

Approve bool

Whether the request was approved.

Type McpApprovalResponse

The type of the item. Always mcp_approval_response.

ID stringoptional

The unique ID of the approval response

Reason stringoptional

Optional reason for the decision.

type ResponseInputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseInputItemMcpCallStatusInProgress ResponseInputItemMcpCallStatus = "in_progress"
const ResponseInputItemMcpCallStatusCompleted ResponseInputItemMcpCallStatus = "completed"
const ResponseInputItemMcpCallStatusIncomplete ResponseInputItemMcpCallStatus = "incomplete"
const ResponseInputItemMcpCallStatusCalling ResponseInputItemMcpCallStatus = "calling"
const ResponseInputItemMcpCallStatusFailed ResponseInputItemMcpCallStatus = "failed"
type ResponseCustomToolCallOutput struct{…}

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

CallID string

The call ID, used to map this custom tool call output to a custom tool call.

Output ResponseCustomToolCallOutputOutputUnion

The output from the custom tool call generated by your code. Can be a string or an list of output content.

Accepts one of the following:
string
type ResponseCustomToolCallOutputOutputOutputContentList []ResponseCustomToolCallOutputOutputOutputContentListItemUnion

Text, image, or file output of the custom tool call.

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type CustomToolCallOutput

The type of the custom tool call output. Always custom_tool_call_output.

ID stringoptional

The unique ID of the custom tool call output in the OpenAI platform.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

type ResponseInputItemItemReference struct{…}

An internal identifier for an item to reference.

ID string

The ID of the item to reference.

Type stringoptional

The type of item to reference. Always item_reference.

Metadata Metadata

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Model ResponsesModel

Model ID used to generate the response, like gpt-4o or o3. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.

Accepts one of the following:
string
type ChatModel string
Accepts one of the following:
const ChatModelGPT5_2 ChatModel = "gpt-5.2"
const ChatModelGPT5_2_2025_12_11 ChatModel = "gpt-5.2-2025-12-11"
const ChatModelGPT5_2ChatLatest ChatModel = "gpt-5.2-chat-latest"
const ChatModelGPT5_2Pro ChatModel = "gpt-5.2-pro"
const ChatModelGPT5_2Pro2025_12_11 ChatModel = "gpt-5.2-pro-2025-12-11"
const ChatModelGPT5_1 ChatModel = "gpt-5.1"
const ChatModelGPT5_1_2025_11_13 ChatModel = "gpt-5.1-2025-11-13"
const ChatModelGPT5_1Codex ChatModel = "gpt-5.1-codex"
const ChatModelGPT5_1Mini ChatModel = "gpt-5.1-mini"
const ChatModelGPT5_1ChatLatest ChatModel = "gpt-5.1-chat-latest"
const ChatModelGPT5 ChatModel = "gpt-5"
const ChatModelGPT5Mini ChatModel = "gpt-5-mini"
const ChatModelGPT5Nano ChatModel = "gpt-5-nano"
const ChatModelGPT5_2025_08_07 ChatModel = "gpt-5-2025-08-07"
const ChatModelGPT5Mini2025_08_07 ChatModel = "gpt-5-mini-2025-08-07"
const ChatModelGPT5Nano2025_08_07 ChatModel = "gpt-5-nano-2025-08-07"
const ChatModelGPT5ChatLatest ChatModel = "gpt-5-chat-latest"
const ChatModelGPT4_1 ChatModel = "gpt-4.1"
const ChatModelGPT4_1Mini ChatModel = "gpt-4.1-mini"
const ChatModelGPT4_1Nano ChatModel = "gpt-4.1-nano"
const ChatModelGPT4_1_2025_04_14 ChatModel = "gpt-4.1-2025-04-14"
const ChatModelGPT4_1Mini2025_04_14 ChatModel = "gpt-4.1-mini-2025-04-14"
const ChatModelGPT4_1Nano2025_04_14 ChatModel = "gpt-4.1-nano-2025-04-14"
const ChatModelO4Mini ChatModel = "o4-mini"
const ChatModelO4Mini2025_04_16 ChatModel = "o4-mini-2025-04-16"
const ChatModelO3 ChatModel = "o3"
const ChatModelO3_2025_04_16 ChatModel = "o3-2025-04-16"
const ChatModelO3Mini ChatModel = "o3-mini"
const ChatModelO3Mini2025_01_31 ChatModel = "o3-mini-2025-01-31"
const ChatModelO1 ChatModel = "o1"
const ChatModelO1_2024_12_17 ChatModel = "o1-2024-12-17"
const ChatModelO1Preview ChatModel = "o1-preview"
const ChatModelO1Preview2024_09_12 ChatModel = "o1-preview-2024-09-12"
const ChatModelO1Mini ChatModel = "o1-mini"
const ChatModelO1Mini2024_09_12 ChatModel = "o1-mini-2024-09-12"
const ChatModelGPT4o ChatModel = "gpt-4o"
const ChatModelGPT4o2024_11_20 ChatModel = "gpt-4o-2024-11-20"
const ChatModelGPT4o2024_08_06 ChatModel = "gpt-4o-2024-08-06"
const ChatModelGPT4o2024_05_13 ChatModel = "gpt-4o-2024-05-13"
const ChatModelGPT4oAudioPreview ChatModel = "gpt-4o-audio-preview"
const ChatModelGPT4oAudioPreview2024_10_01 ChatModel = "gpt-4o-audio-preview-2024-10-01"
const ChatModelGPT4oAudioPreview2024_12_17 ChatModel = "gpt-4o-audio-preview-2024-12-17"
const ChatModelGPT4oAudioPreview2025_06_03 ChatModel = "gpt-4o-audio-preview-2025-06-03"
const ChatModelGPT4oMiniAudioPreview ChatModel = "gpt-4o-mini-audio-preview"
const ChatModelGPT4oMiniAudioPreview2024_12_17 ChatModel = "gpt-4o-mini-audio-preview-2024-12-17"
const ChatModelGPT4oSearchPreview ChatModel = "gpt-4o-search-preview"
const ChatModelGPT4oMiniSearchPreview ChatModel = "gpt-4o-mini-search-preview"
const ChatModelGPT4oSearchPreview2025_03_11 ChatModel = "gpt-4o-search-preview-2025-03-11"
const ChatModelGPT4oMiniSearchPreview2025_03_11 ChatModel = "gpt-4o-mini-search-preview-2025-03-11"
const ChatModelChatgpt4oLatest ChatModel = "chatgpt-4o-latest"
const ChatModelCodexMiniLatest ChatModel = "codex-mini-latest"
const ChatModelGPT4oMini ChatModel = "gpt-4o-mini"
const ChatModelGPT4oMini2024_07_18 ChatModel = "gpt-4o-mini-2024-07-18"
const ChatModelGPT4Turbo ChatModel = "gpt-4-turbo"
const ChatModelGPT4Turbo2024_04_09 ChatModel = "gpt-4-turbo-2024-04-09"
const ChatModelGPT4_0125Preview ChatModel = "gpt-4-0125-preview"
const ChatModelGPT4TurboPreview ChatModel = "gpt-4-turbo-preview"
const ChatModelGPT4_1106Preview ChatModel = "gpt-4-1106-preview"
const ChatModelGPT4VisionPreview ChatModel = "gpt-4-vision-preview"
const ChatModelGPT4 ChatModel = "gpt-4"
const ChatModelGPT4_0314 ChatModel = "gpt-4-0314"
const ChatModelGPT4_0613 ChatModel = "gpt-4-0613"
const ChatModelGPT4_32k ChatModel = "gpt-4-32k"
const ChatModelGPT4_32k0314 ChatModel = "gpt-4-32k-0314"
const ChatModelGPT4_32k0613 ChatModel = "gpt-4-32k-0613"
const ChatModelGPT3_5Turbo ChatModel = "gpt-3.5-turbo"
const ChatModelGPT3_5Turbo16k ChatModel = "gpt-3.5-turbo-16k"
const ChatModelGPT3_5Turbo0301 ChatModel = "gpt-3.5-turbo-0301"
const ChatModelGPT3_5Turbo0613 ChatModel = "gpt-3.5-turbo-0613"
const ChatModelGPT3_5Turbo1106 ChatModel = "gpt-3.5-turbo-1106"
const ChatModelGPT3_5Turbo0125 ChatModel = "gpt-3.5-turbo-0125"
const ChatModelGPT3_5Turbo16k0613 ChatModel = "gpt-3.5-turbo-16k-0613"
type ResponsesModel string
Accepts one of the following:
const ResponsesModelO1Pro ResponsesModel = "o1-pro"
const ResponsesModelO1Pro2025_03_19 ResponsesModel = "o1-pro-2025-03-19"
const ResponsesModelO3Pro ResponsesModel = "o3-pro"
const ResponsesModelO3Pro2025_06_10 ResponsesModel = "o3-pro-2025-06-10"
const ResponsesModelO3DeepResearch ResponsesModel = "o3-deep-research"
const ResponsesModelO3DeepResearch2025_06_26 ResponsesModel = "o3-deep-research-2025-06-26"
const ResponsesModelO4MiniDeepResearch ResponsesModel = "o4-mini-deep-research"
const ResponsesModelO4MiniDeepResearch2025_06_26 ResponsesModel = "o4-mini-deep-research-2025-06-26"
const ResponsesModelComputerUsePreview ResponsesModel = "computer-use-preview"
const ResponsesModelComputerUsePreview2025_03_11 ResponsesModel = "computer-use-preview-2025-03-11"
const ResponsesModelGPT5Codex ResponsesModel = "gpt-5-codex"
const ResponsesModelGPT5Pro ResponsesModel = "gpt-5-pro"
const ResponsesModelGPT5Pro2025_10_06 ResponsesModel = "gpt-5-pro-2025-10-06"
const ResponsesModelGPT5_1CodexMax ResponsesModel = "gpt-5.1-codex-max"
Object Response

The object type of this resource - always set to response.

An array of content items generated by the model.

  • The length and order of items in the output array is dependent on the model's response.
  • Rather than accessing the first item in the output array and assuming it's an assistant message with the content generated by the model, you might consider using the output_text property where supported in SDKs.
Accepts one of the following:
type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItem struct{…}

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

ID string

The unique ID of the compaction item.

EncryptedContent string

The encrypted content that was produced by compaction.

Type Compaction

The type of the item. Always compaction.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseOutputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseOutputItemImageGenerationCallStatusInProgress ResponseOutputItemImageGenerationCallStatus = "in_progress"
const ResponseOutputItemImageGenerationCallStatusCompleted ResponseOutputItemImageGenerationCallStatus = "completed"
const ResponseOutputItemImageGenerationCallStatusGenerating ResponseOutputItemImageGenerationCallStatus = "generating"
const ResponseOutputItemImageGenerationCallStatusFailed ResponseOutputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseOutputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseOutputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseOutputItemLocalShellCallStatusInProgress ResponseOutputItemLocalShellCallStatus = "in_progress"
const ResponseOutputItemLocalShellCallStatusCompleted ResponseOutputItemLocalShellCallStatus = "completed"
const ResponseOutputItemLocalShellCallStatusIncomplete ResponseOutputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseFunctionShellToolCall struct{…}

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

ID string

The unique ID of the shell tool call. Populated when this item is returned via API.

Action ResponseFunctionShellToolCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string
MaxOutputLength int64

Optional maximum number of characters to return from each command.

TimeoutMs int64

Optional timeout in milliseconds for the commands.

CallID string

The unique ID of the shell tool call generated by the model.

Status ResponseFunctionShellToolCallStatus

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallStatusInProgress ResponseFunctionShellToolCallStatus = "in_progress"
const ResponseFunctionShellToolCallStatusCompleted ResponseFunctionShellToolCallStatus = "completed"
const ResponseFunctionShellToolCallStatusIncomplete ResponseFunctionShellToolCallStatus = "incomplete"
Type ShellCall

The type of the item. Always shell_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseFunctionShellToolCallOutput struct{…}

The output of a shell tool call that was emitted.

ID string

The unique ID of the shell call output. Populated when this item is returned via API.

CallID string

The unique ID of the shell tool call generated by the model.

MaxOutputLength int64

The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output.

Output []ResponseFunctionShellToolCallOutputOutput

An array of shell call output contents

Outcome ResponseFunctionShellToolCallOutputOutputOutcomeUnion

Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

Accepts one of the following:
type ResponseFunctionShellToolCallOutputOutputOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellToolCallOutputOutputOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

Exit code from the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

The standard error output that was captured.

Stdout string

The standard output that was captured.

CreatedBy stringoptional

The identifier of the actor that created the item.

Status ResponseFunctionShellToolCallOutputStatus

The status of the shell call output. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallOutputStatusInProgress ResponseFunctionShellToolCallOutputStatus = "in_progress"
const ResponseFunctionShellToolCallOutputStatusCompleted ResponseFunctionShellToolCallOutputStatus = "completed"
const ResponseFunctionShellToolCallOutputStatusIncomplete ResponseFunctionShellToolCallOutputStatus = "incomplete"
Type ShellCallOutput

The type of the shell call output. Always shell_call_output.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseApplyPatchToolCall struct{…}

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

ID string

The unique ID of the apply patch tool call. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Operation ResponseApplyPatchToolCallOperationUnion

One of the create_file, delete_file, or update_file operations applied via apply_patch.

Accepts one of the following:
type ResponseApplyPatchToolCallOperationCreateFile struct{…}

Instruction describing how to create a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to create.

Type CreateFile

Create a new file with the provided diff.

type ResponseApplyPatchToolCallOperationDeleteFile struct{…}

Instruction describing how to delete a file via the apply_patch tool.

Path string

Path of the file to delete.

Type DeleteFile

Delete the specified file.

type ResponseApplyPatchToolCallOperationUpdateFile struct{…}

Instruction describing how to update a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to update.

Type UpdateFile

Update an existing file with the provided diff.

Status ResponseApplyPatchToolCallStatus

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseApplyPatchToolCallStatusInProgress ResponseApplyPatchToolCallStatus = "in_progress"
const ResponseApplyPatchToolCallStatusCompleted ResponseApplyPatchToolCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseApplyPatchToolCallOutput struct{…}

The output emitted by an apply patch tool call.

ID string

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Status ResponseApplyPatchToolCallOutputStatus

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseApplyPatchToolCallOutputStatusCompleted ResponseApplyPatchToolCallOutputStatus = "completed"
const ResponseApplyPatchToolCallOutputStatusFailed ResponseApplyPatchToolCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

CreatedBy stringoptional

The ID of the entity that created this tool call output.

Output stringoptional

Optional textual output returned by the apply patch tool.

type ResponseOutputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseOutputItemMcpCallStatusInProgress ResponseOutputItemMcpCallStatus = "in_progress"
const ResponseOutputItemMcpCallStatusCompleted ResponseOutputItemMcpCallStatus = "completed"
const ResponseOutputItemMcpCallStatusIncomplete ResponseOutputItemMcpCallStatus = "incomplete"
const ResponseOutputItemMcpCallStatusCalling ResponseOutputItemMcpCallStatus = "calling"
const ResponseOutputItemMcpCallStatusFailed ResponseOutputItemMcpCallStatus = "failed"
type ResponseOutputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseOutputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseOutputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

ParallelToolCalls bool

Whether to allow the model to run tool calls in parallel.

Temperature float64

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.

minimum0
maximum2
ToolChoice ResponseToolChoiceUnion

How the model should select which tool (or tools) to use when generating a response. See the tools parameter to see how to specify which tools the model can call.

Accepts one of the following:
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.

Accepts one of the following:
const ToolChoiceOptionsNone ToolChoiceOptions = "none"
const ToolChoiceOptionsAuto ToolChoiceOptions = "auto"
const ToolChoiceOptionsRequired ToolChoiceOptions = "required"
type ToolChoiceAllowed struct{…}

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

Mode ToolChoiceAllowedMode

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

auto allows the model to pick from among the allowed tools and generate a message.

required requires the model to call one or more of the allowed tools.

Accepts one of the following:
const ToolChoiceAllowedModeAuto ToolChoiceAllowedMode = "auto"
const ToolChoiceAllowedModeRequired ToolChoiceAllowedMode = "required"
Tools []map[string, any]

A list of tool definitions that the model should be allowed to call.

For the Responses API, the list of tool definitions might look like:

[
  { "type": "function", "name": "get_weather" },
  { "type": "mcp", "server_label": "deepwiki" },
  { "type": "image_generation" }
]
Type AllowedTools

Allowed tool configuration type. Always allowed_tools.

type ToolChoiceTypes struct{…}

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

Type ToolChoiceTypesType

The type of hosted tool the model should to use. Learn more about built-in tools.

Allowed values are:

  • file_search
  • web_search_preview
  • computer_use_preview
  • code_interpreter
  • image_generation
Accepts one of the following:
const ToolChoiceTypesTypeFileSearch ToolChoiceTypesType = "file_search"
const ToolChoiceTypesTypeWebSearchPreview ToolChoiceTypesType = "web_search_preview"
const ToolChoiceTypesTypeComputerUsePreview ToolChoiceTypesType = "computer_use_preview"
const ToolChoiceTypesTypeWebSearchPreview2025_03_11 ToolChoiceTypesType = "web_search_preview_2025_03_11"
const ToolChoiceTypesTypeImageGeneration ToolChoiceTypesType = "image_generation"
const ToolChoiceTypesTypeCodeInterpreter ToolChoiceTypesType = "code_interpreter"
type ToolChoiceFunction struct{…}

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

Name string

The name of the function to call.

Type Function

For function calling, the type is always function.

type ToolChoiceMcp struct{…}

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

ServerLabel string

The label of the MCP server to use.

Type Mcp

For MCP tools, the type is always mcp.

Name stringoptional

The name of the tool to call on the server.

type ToolChoiceCustom struct{…}

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

Name string

The name of the custom tool to call.

Type Custom

For custom tool calling, the type is always custom.

type ToolChoiceApplyPatch struct{…}

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

Type ApplyPatch

The tool to call. Always apply_patch.

type ToolChoiceShell struct{…}

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

Type Shell

The tool to call. Always shell.

Tools []ToolUnion

An array of tools the model may call while generating a response. You can specify which tool to use by setting the tool_choice parameter.

We support the following categories of tools:

  • Built-in tools: Tools that are provided by OpenAI that extend the model's capabilities, like web search or file search. Learn more about built-in tools.
  • MCP Tools: Integrations with third-party systems via custom MCP servers or predefined connectors such as Google Drive and SharePoint. Learn more about MCP Tools.
  • Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code with strongly typed arguments and outputs. Learn more about function calling. You can also use custom tools to call your own code.
Accepts one of the following:
type FunctionTool struct{…}

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

Name string

The name of the function to call.

Parameters map[string, any]

A JSON schema object describing the parameters of the function.

Strict bool

Whether to enforce strict parameter validation. Default true.

Type Function

The type of the function tool. Always function.

Description stringoptional

A description of the function. Used by the model to determine whether or not to call the function.

type FileSearchTool struct{…}

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

Type FileSearch

The type of the file search tool. Always file_search.

VectorStoreIDs []string

The IDs of the vector stores to search.

Filters FileSearchToolFiltersUnionoptional

A filter to apply.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
type CompoundFilter struct{…}

Combine multiple filters using and or or.

Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
Type CompoundFilterType

Type of operation: and or or.

Accepts one of the following:
const CompoundFilterTypeAnd CompoundFilterType = "and"
const CompoundFilterTypeOr CompoundFilterType = "or"
MaxNumResults int64optional

The maximum number of results to return. This number should be between 1 and 50 inclusive.

RankingOptions FileSearchToolRankingOptionsoptional

Ranking options for search.

Ranker stringoptional

The ranker to use for the file search.

Accepts one of the following:
const FileSearchToolRankingOptionsRankerAuto FileSearchToolRankingOptionsRanker = "auto"
const FileSearchToolRankingOptionsRankerDefault2024_11_15 FileSearchToolRankingOptionsRanker = "default-2024-11-15"
ScoreThreshold float64optional

The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.

type ComputerTool struct{…}

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

DisplayHeight int64

The height of the computer display.

DisplayWidth int64

The width of the computer display.

Environment ComputerToolEnvironment

The type of computer environment to control.

Accepts one of the following:
const ComputerToolEnvironmentWindows ComputerToolEnvironment = "windows"
const ComputerToolEnvironmentMac ComputerToolEnvironment = "mac"
const ComputerToolEnvironmentLinux ComputerToolEnvironment = "linux"
const ComputerToolEnvironmentUbuntu ComputerToolEnvironment = "ubuntu"
const ComputerToolEnvironmentBrowser ComputerToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type WebSearchTool struct{…}

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

Type WebSearchToolType

The type of the web search tool. One of web_search or web_search_2025_08_26.

Accepts one of the following:
const WebSearchToolTypeWebSearch WebSearchToolType = "web_search"
const WebSearchToolTypeWebSearch2025_08_26 WebSearchToolType = "web_search_2025_08_26"
Filters WebSearchToolFiltersoptional

Filters for the search.

AllowedDomains []stringoptional

Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.

Example: ["pubmed.ncbi.nlm.nih.gov"]

SearchContextSize WebSearchToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchToolSearchContextSizeLow WebSearchToolSearchContextSize = "low"
const WebSearchToolSearchContextSizeMedium WebSearchToolSearchContextSize = "medium"
const WebSearchToolSearchContextSizeHigh WebSearchToolSearchContextSize = "high"
UserLocation WebSearchToolUserLocationoptional

The approximate location of the user.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

Type stringoptional

The type of location approximation. Always approximate.

type ToolMcp struct{…}

Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.

ServerLabel string

A label for this MCP server, used to identify it in tool calls.

Type Mcp

The type of the MCP tool. Always mcp.

AllowedTools ToolMcpAllowedToolsUnionoptional

List of allowed tool names or a filter object.

Accepts one of the following:
type ToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type ToolMcpAllowedToolsMcpToolFilter struct{…}

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Authorization stringoptional

An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.

ConnectorID stringoptional

Identifier for service connectors, like those available in ChatGPT. One of server_url or connector_id must be provided. Learn more about service connectors here.

Currently supported connector_id values are:

  • Dropbox: connector_dropbox
  • Gmail: connector_gmail
  • Google Calendar: connector_googlecalendar
  • Google Drive: connector_googledrive
  • Microsoft Teams: connector_microsoftteams
  • Outlook Calendar: connector_outlookcalendar
  • Outlook Email: connector_outlookemail
  • SharePoint: connector_sharepoint
Accepts one of the following:
const ToolMcpConnectorIDConnectorDropbox ToolMcpConnectorID = "connector_dropbox"
const ToolMcpConnectorIDConnectorGmail ToolMcpConnectorID = "connector_gmail"
const ToolMcpConnectorIDConnectorGooglecalendar ToolMcpConnectorID = "connector_googlecalendar"
const ToolMcpConnectorIDConnectorGoogledrive ToolMcpConnectorID = "connector_googledrive"
const ToolMcpConnectorIDConnectorMicrosoftteams ToolMcpConnectorID = "connector_microsoftteams"
const ToolMcpConnectorIDConnectorOutlookcalendar ToolMcpConnectorID = "connector_outlookcalendar"
const ToolMcpConnectorIDConnectorOutlookemail ToolMcpConnectorID = "connector_outlookemail"
const ToolMcpConnectorIDConnectorSharepoint ToolMcpConnectorID = "connector_sharepoint"
Headers map[string, string]optional

Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.

RequireApproval ToolMcpRequireApprovalUnionoptional

Specify which of the MCP server's tools require approval.

Accepts one of the following:
type ToolMcpRequireApprovalMcpToolApprovalFilter struct{…}

Specify which of the MCP server's tools require approval. Can be always, never, or a filter object associated with tools that require approval.

Always ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysoptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Never ToolMcpRequireApprovalMcpToolApprovalFilterNeveroptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

type ToolMcpRequireApprovalMcpToolApprovalSetting string

Specify a single approval policy for all tools. One of always or never. When set to always, all tools will require approval. When set to never, all tools will not require approval.

Accepts one of the following:
const ToolMcpRequireApprovalMcpToolApprovalSettingAlways ToolMcpRequireApprovalMcpToolApprovalSetting = "always"
const ToolMcpRequireApprovalMcpToolApprovalSettingNever ToolMcpRequireApprovalMcpToolApprovalSetting = "never"
ServerDescription stringoptional

Optional description of the MCP server, used to provide more context.

ServerURL stringoptional

The URL for the MCP server. One of server_url or connector_id must be provided.

type ToolCodeInterpreter struct{…}

A tool that runs Python code to help generate a response to a prompt.

Container ToolCodeInterpreterContainerUnion

The code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional memory_limit setting.

Accepts one of the following:
string
type ToolCodeInterpreterContainerCodeInterpreterContainerAuto struct{…}

Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

Type Auto

Always auto.

FileIDs []stringoptional

An optional list of uploaded files to make available to your code.

MemoryLimit stringoptional

The memory limit for the code interpreter container.

Accepts one of the following:
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
Type CodeInterpreter

The type of the code interpreter tool. Always code_interpreter.

type ToolImageGeneration struct{…}

A tool that generates images using the GPT image models.

Type ImageGeneration

The type of the image generation tool. Always image_generation.

Action stringoptional

Whether to generate a new image or edit an existing image. Default: auto.

Accepts one of the following:
const ToolImageGenerationActionGenerate ToolImageGenerationAction = "generate"
const ToolImageGenerationActionEdit ToolImageGenerationAction = "edit"
const ToolImageGenerationActionAuto ToolImageGenerationAction = "auto"
Background stringoptional

Background type for the generated image. One of transparent, opaque, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationBackgroundTransparent ToolImageGenerationBackground = "transparent"
const ToolImageGenerationBackgroundOpaque ToolImageGenerationBackground = "opaque"
const ToolImageGenerationBackgroundAuto ToolImageGenerationBackground = "auto"
InputFidelity stringoptional

Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for gpt-image-1 and gpt-image-1.5 and later models, unsupported for gpt-image-1-mini. Supports high and low. Defaults to low.

Accepts one of the following:
const ToolImageGenerationInputFidelityHigh ToolImageGenerationInputFidelity = "high"
const ToolImageGenerationInputFidelityLow ToolImageGenerationInputFidelity = "low"
InputImageMask ToolImageGenerationInputImageMaskoptional

Optional mask for inpainting. Contains image_url (string, optional) and file_id (string, optional).

FileID stringoptional

File ID for the mask image.

ImageURL stringoptional

Base64-encoded mask image.

Model stringoptional

The image generation model to use. Default: gpt-image-1.

Accepts one of the following:
string
string
Accepts one of the following:
const ToolImageGenerationModelGPTImage1 ToolImageGenerationModel = "gpt-image-1"
const ToolImageGenerationModelGPTImage1Mini ToolImageGenerationModel = "gpt-image-1-mini"
const ToolImageGenerationModelGPTImage1_5 ToolImageGenerationModel = "gpt-image-1.5"
Moderation stringoptional

Moderation level for the generated image. Default: auto.

Accepts one of the following:
const ToolImageGenerationModerationAuto ToolImageGenerationModeration = "auto"
const ToolImageGenerationModerationLow ToolImageGenerationModeration = "low"
OutputCompression int64optional

Compression level for the output image. Default: 100.

minimum0
maximum100
OutputFormat stringoptional

The output format of the generated image. One of png, webp, or jpeg. Default: png.

Accepts one of the following:
const ToolImageGenerationOutputFormatPNG ToolImageGenerationOutputFormat = "png"
const ToolImageGenerationOutputFormatWebP ToolImageGenerationOutputFormat = "webp"
const ToolImageGenerationOutputFormatJPEG ToolImageGenerationOutputFormat = "jpeg"
PartialImages int64optional

Number of partial images to generate in streaming mode, from 0 (default value) to 3.

minimum0
maximum3
Quality stringoptional

The quality of the generated image. One of low, medium, high, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationQualityLow ToolImageGenerationQuality = "low"
const ToolImageGenerationQualityMedium ToolImageGenerationQuality = "medium"
const ToolImageGenerationQualityHigh ToolImageGenerationQuality = "high"
const ToolImageGenerationQualityAuto ToolImageGenerationQuality = "auto"
Size stringoptional

The size of the generated image. One of 1024x1024, 1024x1536, 1536x1024, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationSize1024x1024 ToolImageGenerationSize = "1024x1024"
const ToolImageGenerationSize1024x1536 ToolImageGenerationSize = "1024x1536"
const ToolImageGenerationSize1536x1024 ToolImageGenerationSize = "1536x1024"
const ToolImageGenerationSizeAuto ToolImageGenerationSize = "auto"
type ToolLocalShell struct{…}

A tool that allows the model to execute shell commands in a local environment.

Type LocalShell

The type of the local shell tool. Always local_shell.

type FunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

type CustomTool struct{…}

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

Name string

The name of the custom tool, used to identify it in tool calls.

Type Custom

The type of the custom tool. Always custom.

Description stringoptional

Optional description of the custom tool, used to provide more context.

The input format for the custom tool. Default is unconstrained text.

Accepts one of the following:
type CustomToolInputFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

type CustomToolInputFormatGrammar struct{…}

A grammar defined by the user.

Definition string

The grammar definition.

Syntax string

The syntax of the grammar definition. One of lark or regex.

Accepts one of the following:
const CustomToolInputFormatGrammarSyntaxLark CustomToolInputFormatGrammarSyntax = "lark"
const CustomToolInputFormatGrammarSyntaxRegex CustomToolInputFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

type WebSearchPreviewTool struct{…}

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

Type WebSearchPreviewToolType

The type of the web search tool. One of web_search_preview or web_search_preview_2025_03_11.

Accepts one of the following:
const WebSearchPreviewToolTypeWebSearchPreview WebSearchPreviewToolType = "web_search_preview"
const WebSearchPreviewToolTypeWebSearchPreview2025_03_11 WebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContextSize WebSearchPreviewToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchPreviewToolSearchContextSizeLow WebSearchPreviewToolSearchContextSize = "low"
const WebSearchPreviewToolSearchContextSizeMedium WebSearchPreviewToolSearchContextSize = "medium"
const WebSearchPreviewToolSearchContextSizeHigh WebSearchPreviewToolSearchContextSize = "high"
UserLocation WebSearchPreviewToolUserLocationoptional

The user's location.

Type Approximate

The type of location approximation. Always approximate.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

type ApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

TopP float64

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

minimum0
maximum1
Background booloptional

Whether to run the model response in the background. Learn more.

CompletedAt float64optional

Unix timestamp (in seconds) of when this Response was completed. Only present when the status is completed.

Conversation ResponseConversationoptional

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

ID string

The unique ID of the conversation that this response was associated with.

MaxOutputTokens int64optional

An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.

MaxToolCalls int64optional

The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

PreviousResponseID stringoptional

The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state. Cannot be used in conjunction with conversation.

Prompt ResponsePromptoptional

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

ID string

The unique identifier of the prompt template to use.

Variables map[string, ResponsePromptVariableUnion]optional

Optional map of values to substitute in for variables in your prompt. The substitution values can either be strings, or other Response input types like images or files.

Accepts one of the following:
string
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Version stringoptional

Optional version of the prompt template.

PromptCacheKey stringoptional

Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the user field. Learn more.

PromptCacheRetention ResponsePromptCacheRetentionoptional

The retention policy for the prompt cache. Set to 24h to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. Learn more.

Accepts one of the following:
const ResponsePromptCacheRetentionInMemory ResponsePromptCacheRetention = "in-memory"
const ResponsePromptCacheRetention24h ResponsePromptCacheRetention = "24h"
Reasoning Reasoningoptional

gpt-5 and o-series models only

Configuration options for reasoning models.

Effort ReasoningEffortoptional

Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, and xhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.

  • gpt-5.1 defaults to none, which does not perform reasoning. The supported reasoning values for gpt-5.1 are none, low, medium, and high. Tool calls are supported for all reasoning values in gpt-5.1.
  • All models before gpt-5.1 default to medium reasoning effort, and do not support none.
  • The gpt-5-pro model defaults to (and only supports) high reasoning effort.
  • xhigh is supported for all models after gpt-5.1-codex-max.
Accepts one of the following:
const ReasoningEffortNone ReasoningEffort = "none"
const ReasoningEffortMinimal ReasoningEffort = "minimal"
const ReasoningEffortLow ReasoningEffort = "low"
const ReasoningEffortMedium ReasoningEffort = "medium"
const ReasoningEffortHigh ReasoningEffort = "high"
const ReasoningEffortXhigh ReasoningEffort = "xhigh"
DeprecatedGenerateSummary ReasoningGenerateSummaryoptional

Deprecated: use summary instead.

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.

Accepts one of the following:
const ReasoningGenerateSummaryAuto ReasoningGenerateSummary = "auto"
const ReasoningGenerateSummaryConcise ReasoningGenerateSummary = "concise"
const ReasoningGenerateSummaryDetailed ReasoningGenerateSummary = "detailed"
Summary ReasoningSummaryoptional

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.

concise is supported for computer-use-preview models and all reasoning models after gpt-5.

Accepts one of the following:
const ReasoningSummaryAuto ReasoningSummary = "auto"
const ReasoningSummaryConcise ReasoningSummary = "concise"
const ReasoningSummaryDetailed ReasoningSummary = "detailed"
SafetyIdentifier stringoptional

A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. Learn more.

ServiceTier ResponseServiceTieroptional

Specifies the processing type used for serving the request.

  • If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
  • If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
  • If set to 'flex' or 'priority', then the request will be processed with the corresponding service tier.
  • When not set, the default behavior is 'auto'.

When the service_tier parameter is set, the response body will include the service_tier value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

Accepts one of the following:
const ResponseServiceTierAuto ResponseServiceTier = "auto"
const ResponseServiceTierDefault ResponseServiceTier = "default"
const ResponseServiceTierFlex ResponseServiceTier = "flex"
const ResponseServiceTierScale ResponseServiceTier = "scale"
const ResponseServiceTierPriority ResponseServiceTier = "priority"
Status ResponseStatusoptional

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

Accepts one of the following:
const ResponseStatusCompleted ResponseStatus = "completed"
const ResponseStatusFailed ResponseStatus = "failed"
const ResponseStatusInProgress ResponseStatus = "in_progress"
const ResponseStatusCancelled ResponseStatus = "cancelled"
const ResponseStatusQueued ResponseStatus = "queued"
const ResponseStatusIncomplete ResponseStatus = "incomplete"
Text ResponseTextConfigoptional

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

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.

Accepts one of the following:
type ResponseFormatText struct{…}

Default response format. Used to generate text responses.

Type Text

The type of response format being defined. Always text.

type ResponseFormatTextJSONSchemaConfig struct{…}

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

Name string

The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.

Schema map[string, any]

The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.

Type JSONSchema

The type of response format being defined. Always json_schema.

Description stringoptional

A description of what the response format is for, used by the model to determine how to respond in the format.

Strict booloptional

Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true. To learn more, read the Structured Outputs guide.

type ResponseFormatJSONObject struct{…}

JSON object response format. An older method of generating JSON responses. Using json_schema is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.

Type JSONObject

The type of response format being defined. Always json_object.

Verbosity ResponseTextConfigVerbosityoptional

Constrains the verbosity of the model's response. Lower values will result in more concise responses, while higher values will result in more verbose responses. Currently supported values are low, medium, and high.

Accepts one of the following:
const ResponseTextConfigVerbosityLow ResponseTextConfigVerbosity = "low"
const ResponseTextConfigVerbosityMedium ResponseTextConfigVerbosity = "medium"
const ResponseTextConfigVerbosityHigh ResponseTextConfigVerbosity = "high"
TopLogprobs int64optional

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.

minimum0
maximum20
Truncation ResponseTruncationoptional

The truncation strategy to use for the model response.

  • auto: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation.
  • disabled (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.
Accepts one of the following:
const ResponseTruncationAuto ResponseTruncation = "auto"
const ResponseTruncationDisabled ResponseTruncation = "disabled"
Usage ResponseUsageoptional

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

InputTokens int64

The number of input tokens.

InputTokensDetails ResponseUsageInputTokensDetails

A detailed breakdown of the input tokens.

CachedTokens int64

The number of tokens that were retrieved from the cache. More on prompt caching.

OutputTokens int64

The number of output tokens.

OutputTokensDetails ResponseUsageOutputTokensDetails

A detailed breakdown of the output tokens.

ReasoningTokens int64

The number of reasoning tokens.

TotalTokens int64

The total number of tokens used.

DeprecatedUser stringoptional

This field is being replaced by safety_identifier and prompt_cache_key. Use prompt_cache_key instead to maintain caching optimizations. A stable identifier for your end-users. Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. Learn more.

SequenceNumber int64

The sequence number of this event.

Type ResponseIncomplete

The type of the event. Always response.incomplete.

type ResponseOutputItemAddedEvent struct{…}

Emitted when a new output item is added.

The output item that was added.

Accepts one of the following:
type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItem struct{…}

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

ID string

The unique ID of the compaction item.

EncryptedContent string

The encrypted content that was produced by compaction.

Type Compaction

The type of the item. Always compaction.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseOutputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseOutputItemImageGenerationCallStatusInProgress ResponseOutputItemImageGenerationCallStatus = "in_progress"
const ResponseOutputItemImageGenerationCallStatusCompleted ResponseOutputItemImageGenerationCallStatus = "completed"
const ResponseOutputItemImageGenerationCallStatusGenerating ResponseOutputItemImageGenerationCallStatus = "generating"
const ResponseOutputItemImageGenerationCallStatusFailed ResponseOutputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseOutputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseOutputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseOutputItemLocalShellCallStatusInProgress ResponseOutputItemLocalShellCallStatus = "in_progress"
const ResponseOutputItemLocalShellCallStatusCompleted ResponseOutputItemLocalShellCallStatus = "completed"
const ResponseOutputItemLocalShellCallStatusIncomplete ResponseOutputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseFunctionShellToolCall struct{…}

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

ID string

The unique ID of the shell tool call. Populated when this item is returned via API.

Action ResponseFunctionShellToolCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string
MaxOutputLength int64

Optional maximum number of characters to return from each command.

TimeoutMs int64

Optional timeout in milliseconds for the commands.

CallID string

The unique ID of the shell tool call generated by the model.

Status ResponseFunctionShellToolCallStatus

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallStatusInProgress ResponseFunctionShellToolCallStatus = "in_progress"
const ResponseFunctionShellToolCallStatusCompleted ResponseFunctionShellToolCallStatus = "completed"
const ResponseFunctionShellToolCallStatusIncomplete ResponseFunctionShellToolCallStatus = "incomplete"
Type ShellCall

The type of the item. Always shell_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseFunctionShellToolCallOutput struct{…}

The output of a shell tool call that was emitted.

ID string

The unique ID of the shell call output. Populated when this item is returned via API.

CallID string

The unique ID of the shell tool call generated by the model.

MaxOutputLength int64

The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output.

Output []ResponseFunctionShellToolCallOutputOutput

An array of shell call output contents

Outcome ResponseFunctionShellToolCallOutputOutputOutcomeUnion

Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

Accepts one of the following:
type ResponseFunctionShellToolCallOutputOutputOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellToolCallOutputOutputOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

Exit code from the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

The standard error output that was captured.

Stdout string

The standard output that was captured.

CreatedBy stringoptional

The identifier of the actor that created the item.

Status ResponseFunctionShellToolCallOutputStatus

The status of the shell call output. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallOutputStatusInProgress ResponseFunctionShellToolCallOutputStatus = "in_progress"
const ResponseFunctionShellToolCallOutputStatusCompleted ResponseFunctionShellToolCallOutputStatus = "completed"
const ResponseFunctionShellToolCallOutputStatusIncomplete ResponseFunctionShellToolCallOutputStatus = "incomplete"
Type ShellCallOutput

The type of the shell call output. Always shell_call_output.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseApplyPatchToolCall struct{…}

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

ID string

The unique ID of the apply patch tool call. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Operation ResponseApplyPatchToolCallOperationUnion

One of the create_file, delete_file, or update_file operations applied via apply_patch.

Accepts one of the following:
type ResponseApplyPatchToolCallOperationCreateFile struct{…}

Instruction describing how to create a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to create.

Type CreateFile

Create a new file with the provided diff.

type ResponseApplyPatchToolCallOperationDeleteFile struct{…}

Instruction describing how to delete a file via the apply_patch tool.

Path string

Path of the file to delete.

Type DeleteFile

Delete the specified file.

type ResponseApplyPatchToolCallOperationUpdateFile struct{…}

Instruction describing how to update a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to update.

Type UpdateFile

Update an existing file with the provided diff.

Status ResponseApplyPatchToolCallStatus

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseApplyPatchToolCallStatusInProgress ResponseApplyPatchToolCallStatus = "in_progress"
const ResponseApplyPatchToolCallStatusCompleted ResponseApplyPatchToolCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseApplyPatchToolCallOutput struct{…}

The output emitted by an apply patch tool call.

ID string

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Status ResponseApplyPatchToolCallOutputStatus

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseApplyPatchToolCallOutputStatusCompleted ResponseApplyPatchToolCallOutputStatus = "completed"
const ResponseApplyPatchToolCallOutputStatusFailed ResponseApplyPatchToolCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

CreatedBy stringoptional

The ID of the entity that created this tool call output.

Output stringoptional

Optional textual output returned by the apply patch tool.

type ResponseOutputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseOutputItemMcpCallStatusInProgress ResponseOutputItemMcpCallStatus = "in_progress"
const ResponseOutputItemMcpCallStatusCompleted ResponseOutputItemMcpCallStatus = "completed"
const ResponseOutputItemMcpCallStatusIncomplete ResponseOutputItemMcpCallStatus = "incomplete"
const ResponseOutputItemMcpCallStatusCalling ResponseOutputItemMcpCallStatus = "calling"
const ResponseOutputItemMcpCallStatusFailed ResponseOutputItemMcpCallStatus = "failed"
type ResponseOutputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseOutputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseOutputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

OutputIndex int64

The index of the output item that was added.

SequenceNumber int64

The sequence number of this event.

Type ResponseOutputItemAdded

The type of the event. Always response.output_item.added.

type ResponseOutputItemDoneEvent struct{…}

Emitted when an output item is marked done.

The output item that was marked done.

Accepts one of the following:
type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItem struct{…}

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

ID string

The unique ID of the compaction item.

EncryptedContent string

The encrypted content that was produced by compaction.

Type Compaction

The type of the item. Always compaction.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseOutputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseOutputItemImageGenerationCallStatusInProgress ResponseOutputItemImageGenerationCallStatus = "in_progress"
const ResponseOutputItemImageGenerationCallStatusCompleted ResponseOutputItemImageGenerationCallStatus = "completed"
const ResponseOutputItemImageGenerationCallStatusGenerating ResponseOutputItemImageGenerationCallStatus = "generating"
const ResponseOutputItemImageGenerationCallStatusFailed ResponseOutputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseOutputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseOutputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseOutputItemLocalShellCallStatusInProgress ResponseOutputItemLocalShellCallStatus = "in_progress"
const ResponseOutputItemLocalShellCallStatusCompleted ResponseOutputItemLocalShellCallStatus = "completed"
const ResponseOutputItemLocalShellCallStatusIncomplete ResponseOutputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseFunctionShellToolCall struct{…}

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

ID string

The unique ID of the shell tool call. Populated when this item is returned via API.

Action ResponseFunctionShellToolCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string
MaxOutputLength int64

Optional maximum number of characters to return from each command.

TimeoutMs int64

Optional timeout in milliseconds for the commands.

CallID string

The unique ID of the shell tool call generated by the model.

Status ResponseFunctionShellToolCallStatus

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallStatusInProgress ResponseFunctionShellToolCallStatus = "in_progress"
const ResponseFunctionShellToolCallStatusCompleted ResponseFunctionShellToolCallStatus = "completed"
const ResponseFunctionShellToolCallStatusIncomplete ResponseFunctionShellToolCallStatus = "incomplete"
Type ShellCall

The type of the item. Always shell_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseFunctionShellToolCallOutput struct{…}

The output of a shell tool call that was emitted.

ID string

The unique ID of the shell call output. Populated when this item is returned via API.

CallID string

The unique ID of the shell tool call generated by the model.

MaxOutputLength int64

The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output.

Output []ResponseFunctionShellToolCallOutputOutput

An array of shell call output contents

Outcome ResponseFunctionShellToolCallOutputOutputOutcomeUnion

Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

Accepts one of the following:
type ResponseFunctionShellToolCallOutputOutputOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellToolCallOutputOutputOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

Exit code from the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

The standard error output that was captured.

Stdout string

The standard output that was captured.

CreatedBy stringoptional

The identifier of the actor that created the item.

Status ResponseFunctionShellToolCallOutputStatus

The status of the shell call output. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallOutputStatusInProgress ResponseFunctionShellToolCallOutputStatus = "in_progress"
const ResponseFunctionShellToolCallOutputStatusCompleted ResponseFunctionShellToolCallOutputStatus = "completed"
const ResponseFunctionShellToolCallOutputStatusIncomplete ResponseFunctionShellToolCallOutputStatus = "incomplete"
Type ShellCallOutput

The type of the shell call output. Always shell_call_output.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseApplyPatchToolCall struct{…}

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

ID string

The unique ID of the apply patch tool call. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Operation ResponseApplyPatchToolCallOperationUnion

One of the create_file, delete_file, or update_file operations applied via apply_patch.

Accepts one of the following:
type ResponseApplyPatchToolCallOperationCreateFile struct{…}

Instruction describing how to create a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to create.

Type CreateFile

Create a new file with the provided diff.

type ResponseApplyPatchToolCallOperationDeleteFile struct{…}

Instruction describing how to delete a file via the apply_patch tool.

Path string

Path of the file to delete.

Type DeleteFile

Delete the specified file.

type ResponseApplyPatchToolCallOperationUpdateFile struct{…}

Instruction describing how to update a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to update.

Type UpdateFile

Update an existing file with the provided diff.

Status ResponseApplyPatchToolCallStatus

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseApplyPatchToolCallStatusInProgress ResponseApplyPatchToolCallStatus = "in_progress"
const ResponseApplyPatchToolCallStatusCompleted ResponseApplyPatchToolCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseApplyPatchToolCallOutput struct{…}

The output emitted by an apply patch tool call.

ID string

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Status ResponseApplyPatchToolCallOutputStatus

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseApplyPatchToolCallOutputStatusCompleted ResponseApplyPatchToolCallOutputStatus = "completed"
const ResponseApplyPatchToolCallOutputStatusFailed ResponseApplyPatchToolCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

CreatedBy stringoptional

The ID of the entity that created this tool call output.

Output stringoptional

Optional textual output returned by the apply patch tool.

type ResponseOutputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseOutputItemMcpCallStatusInProgress ResponseOutputItemMcpCallStatus = "in_progress"
const ResponseOutputItemMcpCallStatusCompleted ResponseOutputItemMcpCallStatus = "completed"
const ResponseOutputItemMcpCallStatusIncomplete ResponseOutputItemMcpCallStatus = "incomplete"
const ResponseOutputItemMcpCallStatusCalling ResponseOutputItemMcpCallStatus = "calling"
const ResponseOutputItemMcpCallStatusFailed ResponseOutputItemMcpCallStatus = "failed"
type ResponseOutputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseOutputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseOutputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

OutputIndex int64

The index of the output item that was marked done.

SequenceNumber int64

The sequence number of this event.

Type ResponseOutputItemDone

The type of the event. Always response.output_item.done.

type ResponseReasoningSummaryPartAddedEvent struct{…}

Emitted when a new reasoning summary part is added.

ItemID string

The ID of the item this summary part is associated with.

OutputIndex int64

The index of the output item this summary part is associated with.

Part ResponseReasoningSummaryPartAddedEventPart

The summary part that was added.

Text string

The text of the summary part.

Type SummaryText

The type of the summary part. Always summary_text.

SequenceNumber int64

The sequence number of this event.

SummaryIndex int64

The index of the summary part within the reasoning summary.

Type ResponseReasoningSummaryPartAdded

The type of the event. Always response.reasoning_summary_part.added.

type ResponseReasoningSummaryPartDoneEvent struct{…}

Emitted when a reasoning summary part is completed.

ItemID string

The ID of the item this summary part is associated with.

OutputIndex int64

The index of the output item this summary part is associated with.

Part ResponseReasoningSummaryPartDoneEventPart

The completed summary part.

Text string

The text of the summary part.

Type SummaryText

The type of the summary part. Always summary_text.

SequenceNumber int64

The sequence number of this event.

SummaryIndex int64

The index of the summary part within the reasoning summary.

Type ResponseReasoningSummaryPartDone

The type of the event. Always response.reasoning_summary_part.done.

type ResponseReasoningSummaryTextDeltaEvent struct{…}

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

Delta string

The text delta that was added to the summary.

ItemID string

The ID of the item this summary text delta is associated with.

OutputIndex int64

The index of the output item this summary text delta is associated with.

SequenceNumber int64

The sequence number of this event.

SummaryIndex int64

The index of the summary part within the reasoning summary.

Type ResponseReasoningSummaryTextDelta

The type of the event. Always response.reasoning_summary_text.delta.

type ResponseReasoningSummaryTextDoneEvent struct{…}

Emitted when a reasoning summary text is completed.

ItemID string

The ID of the item this summary text is associated with.

OutputIndex int64

The index of the output item this summary text is associated with.

SequenceNumber int64

The sequence number of this event.

SummaryIndex int64

The index of the summary part within the reasoning summary.

Text string

The full text of the completed reasoning summary.

Type ResponseReasoningSummaryTextDone

The type of the event. Always response.reasoning_summary_text.done.

type ResponseReasoningTextDeltaEvent struct{…}

Emitted when a delta is added to a reasoning text.

ContentIndex int64

The index of the reasoning content part this delta is associated with.

Delta string

The text delta that was added to the reasoning content.

ItemID string

The ID of the item this reasoning text delta is associated with.

OutputIndex int64

The index of the output item this reasoning text delta is associated with.

SequenceNumber int64

The sequence number of this event.

Type ResponseReasoningTextDelta

The type of the event. Always response.reasoning_text.delta.

type ResponseReasoningTextDoneEvent struct{…}

Emitted when a reasoning text is completed.

ContentIndex int64

The index of the reasoning content part.

ItemID string

The ID of the item this reasoning text is associated with.

OutputIndex int64

The index of the output item this reasoning text is associated with.

SequenceNumber int64

The sequence number of this event.

Text string

The full text of the completed reasoning content.

Type ResponseReasoningTextDone

The type of the event. Always response.reasoning_text.done.

type ResponseRefusalDeltaEvent struct{…}

Emitted when there is a partial refusal text.

ContentIndex int64

The index of the content part that the refusal text is added to.

Delta string

The refusal text that is added.

ItemID string

The ID of the output item that the refusal text is added to.

OutputIndex int64

The index of the output item that the refusal text is added to.

SequenceNumber int64

The sequence number of this event.

Type ResponseRefusalDelta

The type of the event. Always response.refusal.delta.

type ResponseRefusalDoneEvent struct{…}

Emitted when refusal text is finalized.

ContentIndex int64

The index of the content part that the refusal text is finalized.

ItemID string

The ID of the output item that the refusal text is finalized.

OutputIndex int64

The index of the output item that the refusal text is finalized.

Refusal string

The refusal text that is finalized.

SequenceNumber int64

The sequence number of this event.

Type ResponseRefusalDone

The type of the event. Always response.refusal.done.

type ResponseTextDeltaEvent struct{…}

Emitted when there is an additional text delta.

ContentIndex int64

The index of the content part that the text delta was added to.

Delta string

The text delta that was added.

ItemID string

The ID of the output item that the text delta was added to.

Logprobs []ResponseTextDeltaEventLogprob

The log probabilities of the tokens in the delta.

Token string

A possible text token.

Logprob float64

The log probability of this token.

TopLogprobs []ResponseTextDeltaEventLogprobTopLogproboptional

The log probability of the top 20 most likely tokens.

Token stringoptional

A possible text token.

Logprob float64optional

The log probability of this token.

OutputIndex int64

The index of the output item that the text delta was added to.

SequenceNumber int64

The sequence number for this event.

Type ResponseOutputTextDelta

The type of the event. Always response.output_text.delta.

type ResponseTextDoneEvent struct{…}

Emitted when text content is finalized.

ContentIndex int64

The index of the content part that the text content is finalized.

ItemID string

The ID of the output item that the text content is finalized.

Logprobs []ResponseTextDoneEventLogprob

The log probabilities of the tokens in the delta.

Token string

A possible text token.

Logprob float64

The log probability of this token.

TopLogprobs []ResponseTextDoneEventLogprobTopLogproboptional

The log probability of the top 20 most likely tokens.

Token stringoptional

A possible text token.

Logprob float64optional

The log probability of this token.

OutputIndex int64

The index of the output item that the text content is finalized.

SequenceNumber int64

The sequence number for this event.

Text string

The text content that is finalized.

Type ResponseOutputTextDone

The type of the event. Always response.output_text.done.

type ResponseWebSearchCallCompletedEvent struct{…}

Emitted when a web search call is completed.

ItemID string

Unique ID for the output item associated with the web search call.

OutputIndex int64

The index of the output item that the web search call is associated with.

SequenceNumber int64

The sequence number of the web search call being processed.

Type ResponseWebSearchCallCompleted

The type of the event. Always response.web_search_call.completed.

type ResponseWebSearchCallInProgressEvent struct{…}

Emitted when a web search call is initiated.

ItemID string

Unique ID for the output item associated with the web search call.

OutputIndex int64

The index of the output item that the web search call is associated with.

SequenceNumber int64

The sequence number of the web search call being processed.

Type ResponseWebSearchCallInProgress

The type of the event. Always response.web_search_call.in_progress.

type ResponseWebSearchCallSearchingEvent struct{…}

Emitted when a web search call is executing.

ItemID string

Unique ID for the output item associated with the web search call.

OutputIndex int64

The index of the output item that the web search call is associated with.

SequenceNumber int64

The sequence number of the web search call being processed.

Type ResponseWebSearchCallSearching

The type of the event. Always response.web_search_call.searching.

type ResponseImageGenCallCompletedEvent struct{…}

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

ItemID string

The unique identifier of the image generation item being processed.

OutputIndex int64

The index of the output item in the response's output array.

SequenceNumber int64

The sequence number of this event.

Type ResponseImageGenerationCallCompleted

The type of the event. Always 'response.image_generation_call.completed'.

type ResponseImageGenCallGeneratingEvent struct{…}

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

ItemID string

The unique identifier of the image generation item being processed.

OutputIndex int64

The index of the output item in the response's output array.

SequenceNumber int64

The sequence number of the image generation item being processed.

Type ResponseImageGenerationCallGenerating

The type of the event. Always 'response.image_generation_call.generating'.

type ResponseImageGenCallInProgressEvent struct{…}

Emitted when an image generation tool call is in progress.

ItemID string

The unique identifier of the image generation item being processed.

OutputIndex int64

The index of the output item in the response's output array.

SequenceNumber int64

The sequence number of the image generation item being processed.

Type ResponseImageGenerationCallInProgress

The type of the event. Always 'response.image_generation_call.in_progress'.

type ResponseImageGenCallPartialImageEvent struct{…}

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

ItemID string

The unique identifier of the image generation item being processed.

OutputIndex int64

The index of the output item in the response's output array.

PartialImageB64 string

Base64-encoded partial image data, suitable for rendering as an image.

PartialImageIndex int64

0-based index for the partial image (backend is 1-based, but this is 0-based for the user).

SequenceNumber int64

The sequence number of the image generation item being processed.

Type ResponseImageGenerationCallPartialImage

The type of the event. Always 'response.image_generation_call.partial_image'.

type ResponseMcpCallArgumentsDeltaEvent struct{…}

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

Delta string

A JSON string containing the partial update to the arguments for the MCP tool call.

ItemID string

The unique identifier of the MCP tool call item being processed.

OutputIndex int64

The index of the output item in the response's output array.

SequenceNumber int64

The sequence number of this event.

Type ResponseMcpCallArgumentsDelta

The type of the event. Always 'response.mcp_call_arguments.delta'.

type ResponseMcpCallArgumentsDoneEvent struct{…}

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

Arguments string

A JSON string containing the finalized arguments for the MCP tool call.

ItemID string

The unique identifier of the MCP tool call item being processed.

OutputIndex int64

The index of the output item in the response's output array.

SequenceNumber int64

The sequence number of this event.

Type ResponseMcpCallArgumentsDone

The type of the event. Always 'response.mcp_call_arguments.done'.

type ResponseMcpCallCompletedEvent struct{…}

Emitted when an MCP tool call has completed successfully.

ItemID string

The ID of the MCP tool call item that completed.

OutputIndex int64

The index of the output item that completed.

SequenceNumber int64

The sequence number of this event.

Type ResponseMcpCallCompleted

The type of the event. Always 'response.mcp_call.completed'.

type ResponseMcpCallFailedEvent struct{…}

Emitted when an MCP tool call has failed.

ItemID string

The ID of the MCP tool call item that failed.

OutputIndex int64

The index of the output item that failed.

SequenceNumber int64

The sequence number of this event.

Type ResponseMcpCallFailed

The type of the event. Always 'response.mcp_call.failed'.

type ResponseMcpCallInProgressEvent struct{…}

Emitted when an MCP tool call is in progress.

ItemID string

The unique identifier of the MCP tool call item being processed.

OutputIndex int64

The index of the output item in the response's output array.

SequenceNumber int64

The sequence number of this event.

Type ResponseMcpCallInProgress

The type of the event. Always 'response.mcp_call.in_progress'.

type ResponseMcpListToolsCompletedEvent struct{…}

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

ItemID string

The ID of the MCP tool call item that produced this output.

OutputIndex int64

The index of the output item that was processed.

SequenceNumber int64

The sequence number of this event.

Type ResponseMcpListToolsCompleted

The type of the event. Always 'response.mcp_list_tools.completed'.

type ResponseMcpListToolsFailedEvent struct{…}

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

ItemID string

The ID of the MCP tool call item that failed.

OutputIndex int64

The index of the output item that failed.

SequenceNumber int64

The sequence number of this event.

Type ResponseMcpListToolsFailed

The type of the event. Always 'response.mcp_list_tools.failed'.

type ResponseMcpListToolsInProgressEvent struct{…}

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

ItemID string

The ID of the MCP tool call item that is being processed.

OutputIndex int64

The index of the output item that is being processed.

SequenceNumber int64

The sequence number of this event.

Type ResponseMcpListToolsInProgress

The type of the event. Always 'response.mcp_list_tools.in_progress'.

type ResponseOutputTextAnnotationAddedEvent struct{…}

Emitted when an annotation is added to output text content.

Annotation any

The annotation object being added. (See annotation schema for details.)

AnnotationIndex int64

The index of the annotation within the content part.

ContentIndex int64

The index of the content part within the output item.

ItemID string

The unique identifier of the item to which the annotation is being added.

OutputIndex int64

The index of the output item in the response's output array.

SequenceNumber int64

The sequence number of this event.

Type ResponseOutputTextAnnotationAdded

The type of the event. Always 'response.output_text.annotation.added'.

type ResponseQueuedEvent struct{…}

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

Response Response

The full response object that is queued.

ID string

Unique identifier for this Response.

CreatedAt float64

Unix timestamp (in seconds) of when this Response was created.

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

Code ResponseErrorCode

The error code for the response.

Accepts one of the following:
const ResponseErrorCodeServerError ResponseErrorCode = "server_error"
const ResponseErrorCodeRateLimitExceeded ResponseErrorCode = "rate_limit_exceeded"
const ResponseErrorCodeInvalidPrompt ResponseErrorCode = "invalid_prompt"
const ResponseErrorCodeVectorStoreTimeout ResponseErrorCode = "vector_store_timeout"
const ResponseErrorCodeInvalidImage ResponseErrorCode = "invalid_image"
const ResponseErrorCodeInvalidImageFormat ResponseErrorCode = "invalid_image_format"
const ResponseErrorCodeInvalidBase64Image ResponseErrorCode = "invalid_base64_image"
const ResponseErrorCodeInvalidImageURL ResponseErrorCode = "invalid_image_url"
const ResponseErrorCodeImageTooLarge ResponseErrorCode = "image_too_large"
const ResponseErrorCodeImageTooSmall ResponseErrorCode = "image_too_small"
const ResponseErrorCodeImageParseError ResponseErrorCode = "image_parse_error"
const ResponseErrorCodeImageContentPolicyViolation ResponseErrorCode = "image_content_policy_violation"
const ResponseErrorCodeInvalidImageMode ResponseErrorCode = "invalid_image_mode"
const ResponseErrorCodeImageFileTooLarge ResponseErrorCode = "image_file_too_large"
const ResponseErrorCodeUnsupportedImageMediaType ResponseErrorCode = "unsupported_image_media_type"
const ResponseErrorCodeEmptyImageFile ResponseErrorCode = "empty_image_file"
const ResponseErrorCodeFailedToDownloadImage ResponseErrorCode = "failed_to_download_image"
const ResponseErrorCodeImageFileNotFound ResponseErrorCode = "image_file_not_found"
Message string

A human-readable description of the error.

IncompleteDetails ResponseIncompleteDetails

Details about why the response is incomplete.

Reason stringoptional

The reason why the response is incomplete.

Accepts one of the following:
const ResponseIncompleteDetailsReasonMaxOutputTokens ResponseIncompleteDetailsReason = "max_output_tokens"
const ResponseIncompleteDetailsReasonContentFilter ResponseIncompleteDetailsReason = "content_filter"
Instructions ResponseInstructionsUnion

A system (or developer) message inserted into the model's context.

When using along with previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.

Accepts one of the following:
string
type ResponseInstructionsInputItemList []ResponseInputItemUnion

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

Accepts one of the following:
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.

Content EasyInputMessageContentUnion

Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.

Accepts one of the following:
string
type ResponseInputMessageContentList []ResponseInputContentUnion

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role EasyInputMessageRole

The role of the message input. One of user, assistant, system, or developer.

Accepts one of the following:
const EasyInputMessageRoleUser EasyInputMessageRole = "user"
const EasyInputMessageRoleAssistant EasyInputMessageRole = "assistant"
const EasyInputMessageRoleSystem EasyInputMessageRole = "system"
const EasyInputMessageRoleDeveloper EasyInputMessageRole = "developer"
Type EasyInputMessageTypeoptional

The type of the message input. Always message.

type ResponseInputItemMessage 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.

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

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Role string

The role of the message input. One of user, system, or developer.

Accepts one of the following:
const ResponseInputItemMessageRoleUser ResponseInputItemMessageRole = "user"
const ResponseInputItemMessageRoleSystem ResponseInputItemMessageRole = "system"
const ResponseInputItemMessageRoleDeveloper ResponseInputItemMessageRole = "developer"
Status stringoptional

The status of item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemMessageStatusInProgress ResponseInputItemMessageStatus = "in_progress"
const ResponseInputItemMessageStatusCompleted ResponseInputItemMessageStatus = "completed"
const ResponseInputItemMessageStatusIncomplete ResponseInputItemMessageStatus = "incomplete"
Type stringoptional

The type of the message input. Always set to message.

type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

type ResponseInputItemComputerCallOutput struct{…}

The output of a computer tool call.

CallID string

The ID of the computer tool call that produced the output.

maxLength64
minLength1

A computer screenshot image used with the computer use tool.

Type ComputerScreenshot

Specifies the event type. For a computer screenshot, this property is always set to computer_screenshot.

FileID stringoptional

The identifier of an uploaded file that contains the screenshot.

ImageURL stringoptional

The URL of the screenshot image.

Type ComputerCallOutput

The type of the computer tool call output. Always computer_call_output.

ID stringoptional

The ID of the computer tool call output.

AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckoptional

The safety checks reported by the API that have been acknowledged by the developer.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status stringoptional

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseInputItemComputerCallOutputStatusInProgress ResponseInputItemComputerCallOutputStatus = "in_progress"
const ResponseInputItemComputerCallOutputStatusCompleted ResponseInputItemComputerCallOutputStatus = "completed"
const ResponseInputItemComputerCallOutputStatusIncomplete ResponseInputItemComputerCallOutputStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
type ResponseInputItemFunctionCallOutput struct{…}

The output of a function tool call.

CallID string

The unique ID of the function tool call generated by the model.

maxLength64
minLength1
Output ResponseInputItemFunctionCallOutputOutputUnion

Text, image, or file output of the function tool call.

Accepts one of the following:
string
type ResponseFunctionCallOutputItemList []ResponseFunctionCallOutputItemUnion

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

Accepts one of the following:
type ResponseInputTextContent struct{…}

A text input to the model.

Text string

The text input to the model.

maxLength10485760
Type InputText

The type of the input item. Always input_text.

type ResponseInputImageContent struct{…}

An image input to the model. Learn about image inputs

Type InputImage

The type of the input item. Always input_image.

Detail ResponseInputImageContentDetailoptional

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageContentDetailLow ResponseInputImageContentDetail = "low"
const ResponseInputImageContentDetailHigh ResponseInputImageContentDetail = "high"
const ResponseInputImageContentDetailAuto ResponseInputImageContentDetail = "auto"
FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

maxLength20971520
type ResponseInputFileContent struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The base64-encoded data of the file to be sent to the model.

maxLength33554432
FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type FunctionCallOutput

The type of the function tool call output. Always function_call_output.

ID stringoptional

The unique ID of the function tool call output. Populated when this item is returned via API.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseInputItemFunctionCallOutputStatusInProgress ResponseInputItemFunctionCallOutputStatus = "in_progress"
const ResponseInputItemFunctionCallOutputStatusCompleted ResponseInputItemFunctionCallOutputStatus = "completed"
const ResponseInputItemFunctionCallOutputStatusIncomplete ResponseInputItemFunctionCallOutputStatus = "incomplete"
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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItemParamResp struct{…}

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

EncryptedContent string

The encrypted content of the compaction summary.

maxLength10485760
Type Compaction

The type of the item. Always compaction.

ID stringoptional

The ID of the compaction item.

type ResponseInputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseInputItemImageGenerationCallStatusInProgress ResponseInputItemImageGenerationCallStatus = "in_progress"
const ResponseInputItemImageGenerationCallStatusCompleted ResponseInputItemImageGenerationCallStatus = "completed"
const ResponseInputItemImageGenerationCallStatusGenerating ResponseInputItemImageGenerationCallStatus = "generating"
const ResponseInputItemImageGenerationCallStatusFailed ResponseInputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseInputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseInputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseInputItemLocalShellCallStatusInProgress ResponseInputItemLocalShellCallStatus = "in_progress"
const ResponseInputItemLocalShellCallStatusCompleted ResponseInputItemLocalShellCallStatus = "completed"
const ResponseInputItemLocalShellCallStatusIncomplete ResponseInputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseInputItemLocalShellCallOutput struct{…}

The output of a local shell tool call.

ID string

The unique ID of the local shell tool call generated by the model.

Output string

A JSON string of the output of the local shell tool call.

Type LocalShellCallOutput

The type of the local shell tool call output. Always local_shell_call_output.

Status stringoptional

The status of the item. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemLocalShellCallOutputStatusInProgress ResponseInputItemLocalShellCallOutputStatus = "in_progress"
const ResponseInputItemLocalShellCallOutputStatusCompleted ResponseInputItemLocalShellCallOutputStatus = "completed"
const ResponseInputItemLocalShellCallOutputStatusIncomplete ResponseInputItemLocalShellCallOutputStatus = "incomplete"
type ResponseInputItemShellCall struct{…}

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

Action ResponseInputItemShellCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string

Ordered shell commands for the execution environment to run.

MaxOutputLength int64optional

Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

TimeoutMs int64optional

Maximum wall-clock time in milliseconds to allow the shell commands to run.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1
Type ShellCall

The type of the item. Always shell_call.

ID stringoptional

The unique ID of the shell tool call. Populated when this item is returned via API.

Status stringoptional

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseInputItemShellCallStatusInProgress ResponseInputItemShellCallStatus = "in_progress"
const ResponseInputItemShellCallStatusCompleted ResponseInputItemShellCallStatus = "completed"
const ResponseInputItemShellCallStatusIncomplete ResponseInputItemShellCallStatus = "incomplete"
type ResponseInputItemShellCallOutput struct{…}

The streamed output items emitted by a shell tool call.

CallID string

The unique ID of the shell tool call generated by the model.

maxLength64
minLength1

Captured chunks of stdout and stderr output, along with their associated outcomes.

Outcome ResponseFunctionShellCallOutputContentOutcomeUnion

The exit or timeout outcome associated with this shell call.

Accepts one of the following:
type ResponseFunctionShellCallOutputContentOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellCallOutputContentOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

The exit code returned by the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

Captured stderr output for the shell call.

maxLength10485760
Stdout string

Captured stdout output for the shell call.

maxLength10485760
Type ShellCallOutput

The type of the item. Always shell_call_output.

ID stringoptional

The unique ID of the shell tool call output. Populated when this item is returned via API.

MaxOutputLength int64optional

The maximum number of UTF-8 characters captured for this shell call's combined output.

Status stringoptional

The status of the shell call output.

Accepts one of the following:
const ResponseInputItemShellCallOutputStatusInProgress ResponseInputItemShellCallOutputStatus = "in_progress"
const ResponseInputItemShellCallOutputStatusCompleted ResponseInputItemShellCallOutputStatus = "completed"
const ResponseInputItemShellCallOutputStatusIncomplete ResponseInputItemShellCallOutputStatus = "incomplete"
type ResponseInputItemApplyPatchCall struct{…}

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

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Operation ResponseInputItemApplyPatchCallOperationUnion

The specific create, delete, or update instruction for the apply_patch tool call.

Accepts one of the following:
type ResponseInputItemApplyPatchCallOperationCreateFile struct{…}

Instruction for creating a new file via the apply_patch tool.

Diff string

Unified diff content to apply when creating the file.

maxLength10485760
Path string

Path of the file to create relative to the workspace root.

minLength1
Type CreateFile

The operation type. Always create_file.

type ResponseInputItemApplyPatchCallOperationDeleteFile struct{…}

Instruction for deleting an existing file via the apply_patch tool.

Path string

Path of the file to delete relative to the workspace root.

minLength1
Type DeleteFile

The operation type. Always delete_file.

type ResponseInputItemApplyPatchCallOperationUpdateFile struct{…}

Instruction for updating an existing file via the apply_patch tool.

Diff string

Unified diff content to apply to the existing file.

maxLength10485760
Path string

Path of the file to update relative to the workspace root.

minLength1
Type UpdateFile

The operation type. Always update_file.

Status string

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallStatusInProgress ResponseInputItemApplyPatchCallStatus = "in_progress"
const ResponseInputItemApplyPatchCallStatusCompleted ResponseInputItemApplyPatchCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

ID stringoptional

The unique ID of the apply patch tool call. Populated when this item is returned via API.

type ResponseInputItemApplyPatchCallOutput struct{…}

The streamed output emitted by an apply patch tool call.

CallID string

The unique ID of the apply patch tool call generated by the model.

maxLength64
minLength1
Status string

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseInputItemApplyPatchCallOutputStatusCompleted ResponseInputItemApplyPatchCallOutputStatus = "completed"
const ResponseInputItemApplyPatchCallOutputStatusFailed ResponseInputItemApplyPatchCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

ID stringoptional

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

Output stringoptional

Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

maxLength10485760
type ResponseInputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseInputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseInputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseInputItemMcpApprovalResponse struct{…}

A response to an MCP approval request.

ApprovalRequestID string

The ID of the approval request being answered.

Approve bool

Whether the request was approved.

Type McpApprovalResponse

The type of the item. Always mcp_approval_response.

ID stringoptional

The unique ID of the approval response

Reason stringoptional

Optional reason for the decision.

type ResponseInputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseInputItemMcpCallStatusInProgress ResponseInputItemMcpCallStatus = "in_progress"
const ResponseInputItemMcpCallStatusCompleted ResponseInputItemMcpCallStatus = "completed"
const ResponseInputItemMcpCallStatusIncomplete ResponseInputItemMcpCallStatus = "incomplete"
const ResponseInputItemMcpCallStatusCalling ResponseInputItemMcpCallStatus = "calling"
const ResponseInputItemMcpCallStatusFailed ResponseInputItemMcpCallStatus = "failed"
type ResponseCustomToolCallOutput struct{…}

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

CallID string

The call ID, used to map this custom tool call output to a custom tool call.

Output ResponseCustomToolCallOutputOutputUnion

The output from the custom tool call generated by your code. Can be a string or an list of output content.

Accepts one of the following:
string
type ResponseCustomToolCallOutputOutputOutputContentList []ResponseCustomToolCallOutputOutputOutputContentListItemUnion

Text, image, or file output of the custom tool call.

Accepts one of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Type CustomToolCallOutput

The type of the custom tool call output. Always custom_tool_call_output.

ID stringoptional

The unique ID of the custom tool call output in the OpenAI platform.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

type ResponseInputItemItemReference struct{…}

An internal identifier for an item to reference.

ID string

The ID of the item to reference.

Type stringoptional

The type of item to reference. Always item_reference.

Metadata Metadata

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Model ResponsesModel

Model ID used to generate the response, like gpt-4o or o3. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.

Accepts one of the following:
string
type ChatModel string
Accepts one of the following:
const ChatModelGPT5_2 ChatModel = "gpt-5.2"
const ChatModelGPT5_2_2025_12_11 ChatModel = "gpt-5.2-2025-12-11"
const ChatModelGPT5_2ChatLatest ChatModel = "gpt-5.2-chat-latest"
const ChatModelGPT5_2Pro ChatModel = "gpt-5.2-pro"
const ChatModelGPT5_2Pro2025_12_11 ChatModel = "gpt-5.2-pro-2025-12-11"
const ChatModelGPT5_1 ChatModel = "gpt-5.1"
const ChatModelGPT5_1_2025_11_13 ChatModel = "gpt-5.1-2025-11-13"
const ChatModelGPT5_1Codex ChatModel = "gpt-5.1-codex"
const ChatModelGPT5_1Mini ChatModel = "gpt-5.1-mini"
const ChatModelGPT5_1ChatLatest ChatModel = "gpt-5.1-chat-latest"
const ChatModelGPT5 ChatModel = "gpt-5"
const ChatModelGPT5Mini ChatModel = "gpt-5-mini"
const ChatModelGPT5Nano ChatModel = "gpt-5-nano"
const ChatModelGPT5_2025_08_07 ChatModel = "gpt-5-2025-08-07"
const ChatModelGPT5Mini2025_08_07 ChatModel = "gpt-5-mini-2025-08-07"
const ChatModelGPT5Nano2025_08_07 ChatModel = "gpt-5-nano-2025-08-07"
const ChatModelGPT5ChatLatest ChatModel = "gpt-5-chat-latest"
const ChatModelGPT4_1 ChatModel = "gpt-4.1"
const ChatModelGPT4_1Mini ChatModel = "gpt-4.1-mini"
const ChatModelGPT4_1Nano ChatModel = "gpt-4.1-nano"
const ChatModelGPT4_1_2025_04_14 ChatModel = "gpt-4.1-2025-04-14"
const ChatModelGPT4_1Mini2025_04_14 ChatModel = "gpt-4.1-mini-2025-04-14"
const ChatModelGPT4_1Nano2025_04_14 ChatModel = "gpt-4.1-nano-2025-04-14"
const ChatModelO4Mini ChatModel = "o4-mini"
const ChatModelO4Mini2025_04_16 ChatModel = "o4-mini-2025-04-16"
const ChatModelO3 ChatModel = "o3"
const ChatModelO3_2025_04_16 ChatModel = "o3-2025-04-16"
const ChatModelO3Mini ChatModel = "o3-mini"
const ChatModelO3Mini2025_01_31 ChatModel = "o3-mini-2025-01-31"
const ChatModelO1 ChatModel = "o1"
const ChatModelO1_2024_12_17 ChatModel = "o1-2024-12-17"
const ChatModelO1Preview ChatModel = "o1-preview"
const ChatModelO1Preview2024_09_12 ChatModel = "o1-preview-2024-09-12"
const ChatModelO1Mini ChatModel = "o1-mini"
const ChatModelO1Mini2024_09_12 ChatModel = "o1-mini-2024-09-12"
const ChatModelGPT4o ChatModel = "gpt-4o"
const ChatModelGPT4o2024_11_20 ChatModel = "gpt-4o-2024-11-20"
const ChatModelGPT4o2024_08_06 ChatModel = "gpt-4o-2024-08-06"
const ChatModelGPT4o2024_05_13 ChatModel = "gpt-4o-2024-05-13"
const ChatModelGPT4oAudioPreview ChatModel = "gpt-4o-audio-preview"
const ChatModelGPT4oAudioPreview2024_10_01 ChatModel = "gpt-4o-audio-preview-2024-10-01"
const ChatModelGPT4oAudioPreview2024_12_17 ChatModel = "gpt-4o-audio-preview-2024-12-17"
const ChatModelGPT4oAudioPreview2025_06_03 ChatModel = "gpt-4o-audio-preview-2025-06-03"
const ChatModelGPT4oMiniAudioPreview ChatModel = "gpt-4o-mini-audio-preview"
const ChatModelGPT4oMiniAudioPreview2024_12_17 ChatModel = "gpt-4o-mini-audio-preview-2024-12-17"
const ChatModelGPT4oSearchPreview ChatModel = "gpt-4o-search-preview"
const ChatModelGPT4oMiniSearchPreview ChatModel = "gpt-4o-mini-search-preview"
const ChatModelGPT4oSearchPreview2025_03_11 ChatModel = "gpt-4o-search-preview-2025-03-11"
const ChatModelGPT4oMiniSearchPreview2025_03_11 ChatModel = "gpt-4o-mini-search-preview-2025-03-11"
const ChatModelChatgpt4oLatest ChatModel = "chatgpt-4o-latest"
const ChatModelCodexMiniLatest ChatModel = "codex-mini-latest"
const ChatModelGPT4oMini ChatModel = "gpt-4o-mini"
const ChatModelGPT4oMini2024_07_18 ChatModel = "gpt-4o-mini-2024-07-18"
const ChatModelGPT4Turbo ChatModel = "gpt-4-turbo"
const ChatModelGPT4Turbo2024_04_09 ChatModel = "gpt-4-turbo-2024-04-09"
const ChatModelGPT4_0125Preview ChatModel = "gpt-4-0125-preview"
const ChatModelGPT4TurboPreview ChatModel = "gpt-4-turbo-preview"
const ChatModelGPT4_1106Preview ChatModel = "gpt-4-1106-preview"
const ChatModelGPT4VisionPreview ChatModel = "gpt-4-vision-preview"
const ChatModelGPT4 ChatModel = "gpt-4"
const ChatModelGPT4_0314 ChatModel = "gpt-4-0314"
const ChatModelGPT4_0613 ChatModel = "gpt-4-0613"
const ChatModelGPT4_32k ChatModel = "gpt-4-32k"
const ChatModelGPT4_32k0314 ChatModel = "gpt-4-32k-0314"
const ChatModelGPT4_32k0613 ChatModel = "gpt-4-32k-0613"
const ChatModelGPT3_5Turbo ChatModel = "gpt-3.5-turbo"
const ChatModelGPT3_5Turbo16k ChatModel = "gpt-3.5-turbo-16k"
const ChatModelGPT3_5Turbo0301 ChatModel = "gpt-3.5-turbo-0301"
const ChatModelGPT3_5Turbo0613 ChatModel = "gpt-3.5-turbo-0613"
const ChatModelGPT3_5Turbo1106 ChatModel = "gpt-3.5-turbo-1106"
const ChatModelGPT3_5Turbo0125 ChatModel = "gpt-3.5-turbo-0125"
const ChatModelGPT3_5Turbo16k0613 ChatModel = "gpt-3.5-turbo-16k-0613"
type ResponsesModel string
Accepts one of the following:
const ResponsesModelO1Pro ResponsesModel = "o1-pro"
const ResponsesModelO1Pro2025_03_19 ResponsesModel = "o1-pro-2025-03-19"
const ResponsesModelO3Pro ResponsesModel = "o3-pro"
const ResponsesModelO3Pro2025_06_10 ResponsesModel = "o3-pro-2025-06-10"
const ResponsesModelO3DeepResearch ResponsesModel = "o3-deep-research"
const ResponsesModelO3DeepResearch2025_06_26 ResponsesModel = "o3-deep-research-2025-06-26"
const ResponsesModelO4MiniDeepResearch ResponsesModel = "o4-mini-deep-research"
const ResponsesModelO4MiniDeepResearch2025_06_26 ResponsesModel = "o4-mini-deep-research-2025-06-26"
const ResponsesModelComputerUsePreview ResponsesModel = "computer-use-preview"
const ResponsesModelComputerUsePreview2025_03_11 ResponsesModel = "computer-use-preview-2025-03-11"
const ResponsesModelGPT5Codex ResponsesModel = "gpt-5-codex"
const ResponsesModelGPT5Pro ResponsesModel = "gpt-5-pro"
const ResponsesModelGPT5Pro2025_10_06 ResponsesModel = "gpt-5-pro-2025-10-06"
const ResponsesModelGPT5_1CodexMax ResponsesModel = "gpt-5.1-codex-max"
Object Response

The object type of this resource - always set to response.

An array of content items generated by the model.

  • The length and order of items in the output array is dependent on the model's response.
  • Rather than accessing the first item in the output array and assuming it's an assistant message with the content generated by the model, you might consider using the output_text property where supported in SDKs.
Accepts one of the following:
type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

Accepts one of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

Accepts one of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

A citation for a web resource used to generate a model response.

EndIndex int64

The index of the last character of the URL citation in the message.

StartIndex int64

The index of the first character of the URL citation in the message.

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

A citation for a container file used to generate a model response.

ContainerID string

The ID of the container file.

EndIndex int64

The index of the last character of the container file citation in the message.

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

The index of the first character of the container file citation in the message.

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

Logprobs []ResponseOutputTextLogproboptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []ResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type ResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

The status of the message input. One of in_progress, completed, or incomplete. Populated when input items are returned via API.

Accepts one of the following:
const ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
const ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed"
const ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

The status of the file search tool call. One of in_progress, searching, incomplete or failed,

Accepts one of the following:
const ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
const ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching"
const ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed"
const ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
const ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

The type of the file search tool call. Always file_search_call.

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Accepts one of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

The relevance score of the file - a value between 0 and 1.

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseFunctionToolCall struct{…}

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

Arguments string

A JSON string of the arguments to pass to the function.

CallID string

The unique ID of the function tool call generated by the model.

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Status ResponseFunctionToolCallStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
Accepts one of the following:
Accepts one of the following:
type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

Action ResponseComputerToolCallActionUnion

A click action.

Accepts one of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

Indicates which mouse button was pressed during the click. One of left, right, wheel, back, or forward.

Accepts one of the following:
const ResponseComputerToolCallActionClickButtonLeft ResponseComputerToolCallActionClickButton = "left"
const ResponseComputerToolCallActionClickButtonRight ResponseComputerToolCallActionClickButton = "right"
const ResponseComputerToolCallActionClickButtonWheel ResponseComputerToolCallActionClickButton = "wheel"
const ResponseComputerToolCallActionClickButtonBack ResponseComputerToolCallActionClickButton = "back"
const ResponseComputerToolCallActionClickButtonForward ResponseComputerToolCallActionClickButton = "forward"
Type Click

Specifies the event type. For a click action, this property is always click.

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

type ResponseComputerToolCallActionDoubleClick struct{…}

A double click action.

Type DoubleClick

Specifies the event type. For a double click action, this property is always set to double_click.

X int64

The x-coordinate where the double click occurred.

Y int64

The y-coordinate where the double click occurred.

type ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg

[
  { x: 100, y: 200 },
  { x: 200, y: 300 }
]
X int64

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

Specifies the event type. For a drag action, this property is always set to drag.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.

Type Keypress

Specifies the event type. For a keypress action, this property is always set to keypress.

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

Specifies the event type. For a move action, this property is always set to move.

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

Specifies the event type. For a screenshot action, this property is always set to screenshot.

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

Specifies the event type. For a scroll action, this property is always set to scroll.

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

Specifies the event type. For a type action, this property is always set to type.

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

Specifies the event type. For a wait action, this property is always set to wait.

CallID string

An identifier used when responding to the tool call with output.

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
const ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed"
const ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
Type ResponseComputerToolCallType

The type of the computer call. Always computer_call.

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.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

A summary of the reasoning output from the model so far.

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.

Status ResponseReasoningItemStatusoptional

The status of the item. One of in_progress, completed, or incomplete. Populated when items are returned via API.

Accepts one of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseCompactionItem struct{…}

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

ID string

The unique ID of the compaction item.

EncryptedContent string

The encrypted content that was produced by compaction.

Type Compaction

The type of the item. Always compaction.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseOutputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

Accepts one of the following:
const ResponseOutputItemImageGenerationCallStatusInProgress ResponseOutputItemImageGenerationCallStatus = "in_progress"
const ResponseOutputItemImageGenerationCallStatusCompleted ResponseOutputItemImageGenerationCallStatus = "completed"
const ResponseOutputItemImageGenerationCallStatusGenerating ResponseOutputItemImageGenerationCallStatus = "generating"
const ResponseOutputItemImageGenerationCallStatusFailed ResponseOutputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

The outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.

Accepts one of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

The status of the code interpreter tool call. Valid values are in_progress, completed, incomplete, interpreting, and failed.

Accepts one of the following:
const ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress"
const ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed"
const ResponseCodeInterpreterToolCallStatusIncomplete ResponseCodeInterpreterToolCallStatus = "incomplete"
const ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
const ResponseCodeInterpreterToolCallStatusFailed ResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

The type of the code interpreter tool call. Always code_interpreter_call.

type ResponseOutputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseOutputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

The unique ID of the local shell tool call generated by the model.

Status string

The status of the local shell call.

Accepts one of the following:
const ResponseOutputItemLocalShellCallStatusInProgress ResponseOutputItemLocalShellCallStatus = "in_progress"
const ResponseOutputItemLocalShellCallStatusCompleted ResponseOutputItemLocalShellCallStatus = "completed"
const ResponseOutputItemLocalShellCallStatusIncomplete ResponseOutputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

type ResponseFunctionShellToolCall struct{…}

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

ID string

The unique ID of the shell tool call. Populated when this item is returned via API.

Action ResponseFunctionShellToolCallAction

The shell commands and limits that describe how to run the tool call.

Commands []string
MaxOutputLength int64

Optional maximum number of characters to return from each command.

TimeoutMs int64

Optional timeout in milliseconds for the commands.

CallID string

The unique ID of the shell tool call generated by the model.

Status ResponseFunctionShellToolCallStatus

The status of the shell call. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallStatusInProgress ResponseFunctionShellToolCallStatus = "in_progress"
const ResponseFunctionShellToolCallStatusCompleted ResponseFunctionShellToolCallStatus = "completed"
const ResponseFunctionShellToolCallStatusIncomplete ResponseFunctionShellToolCallStatus = "incomplete"
Type ShellCall

The type of the item. Always shell_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseFunctionShellToolCallOutput struct{…}

The output of a shell tool call that was emitted.

ID string

The unique ID of the shell call output. Populated when this item is returned via API.

CallID string

The unique ID of the shell tool call generated by the model.

MaxOutputLength int64

The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output.

Output []ResponseFunctionShellToolCallOutputOutput

An array of shell call output contents

Outcome ResponseFunctionShellToolCallOutputOutputOutcomeUnion

Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

Accepts one of the following:
type ResponseFunctionShellToolCallOutputOutputOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellToolCallOutputOutputOutcomeExit struct{…}

Indicates that the shell commands finished and returned an exit code.

ExitCode int64

Exit code from the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

The standard error output that was captured.

Stdout string

The standard output that was captured.

CreatedBy stringoptional

The identifier of the actor that created the item.

Status ResponseFunctionShellToolCallOutputStatus

The status of the shell call output. One of in_progress, completed, or incomplete.

Accepts one of the following:
const ResponseFunctionShellToolCallOutputStatusInProgress ResponseFunctionShellToolCallOutputStatus = "in_progress"
const ResponseFunctionShellToolCallOutputStatusCompleted ResponseFunctionShellToolCallOutputStatus = "completed"
const ResponseFunctionShellToolCallOutputStatusIncomplete ResponseFunctionShellToolCallOutputStatus = "incomplete"
Type ShellCallOutput

The type of the shell call output. Always shell_call_output.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseApplyPatchToolCall struct{…}

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

ID string

The unique ID of the apply patch tool call. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Operation ResponseApplyPatchToolCallOperationUnion

One of the create_file, delete_file, or update_file operations applied via apply_patch.

Accepts one of the following:
type ResponseApplyPatchToolCallOperationCreateFile struct{…}

Instruction describing how to create a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to create.

Type CreateFile

Create a new file with the provided diff.

type ResponseApplyPatchToolCallOperationDeleteFile struct{…}

Instruction describing how to delete a file via the apply_patch tool.

Path string

Path of the file to delete.

Type DeleteFile

Delete the specified file.

type ResponseApplyPatchToolCallOperationUpdateFile struct{…}

Instruction describing how to update a file via the apply_patch tool.

Diff string

Diff to apply.

Path string

Path of the file to update.

Type UpdateFile

Update an existing file with the provided diff.

Status ResponseApplyPatchToolCallStatus

The status of the apply patch tool call. One of in_progress or completed.

Accepts one of the following:
const ResponseApplyPatchToolCallStatusInProgress ResponseApplyPatchToolCallStatus = "in_progress"
const ResponseApplyPatchToolCallStatusCompleted ResponseApplyPatchToolCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseApplyPatchToolCallOutput struct{…}

The output emitted by an apply patch tool call.

ID string

The unique ID of the apply patch tool call output. Populated when this item is returned via API.

CallID string

The unique ID of the apply patch tool call generated by the model.

Status ResponseApplyPatchToolCallOutputStatus

The status of the apply patch tool call output. One of completed or failed.

Accepts one of the following:
const ResponseApplyPatchToolCallOutputStatusCompleted ResponseApplyPatchToolCallOutputStatus = "completed"
const ResponseApplyPatchToolCallOutputStatusFailed ResponseApplyPatchToolCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

CreatedBy stringoptional

The ID of the entity that created this tool call output.

Output stringoptional

Optional textual output returned by the apply patch tool.

type ResponseOutputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

Unique identifier for the MCP tool call approval request. Include this value in a subsequent mcp_approval_response input to approve or reject the corresponding tool call.

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

The status of the tool call. One of in_progress, completed, incomplete, calling, or failed.

Accepts one of the following:
const ResponseOutputItemMcpCallStatusInProgress ResponseOutputItemMcpCallStatus = "in_progress"
const ResponseOutputItemMcpCallStatusCompleted ResponseOutputItemMcpCallStatus = "completed"
const ResponseOutputItemMcpCallStatusIncomplete ResponseOutputItemMcpCallStatus = "incomplete"
const ResponseOutputItemMcpCallStatusCalling ResponseOutputItemMcpCallStatus = "calling"
const ResponseOutputItemMcpCallStatusFailed ResponseOutputItemMcpCallStatus = "failed"
type ResponseOutputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseOutputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseOutputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

An identifier used to map this custom tool call to a tool call output.

Input string

The input for the custom tool call generated by the model.

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

The unique ID of the custom tool call in the OpenAI platform.

ParallelToolCalls bool

Whether to allow the model to run tool calls in parallel.

Temperature float64

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.

minimum0
maximum2
ToolChoice ResponseToolChoiceUnion

How the model should select which tool (or tools) to use when generating a response. See the tools parameter to see how to specify which tools the model can call.

Accepts one of the following:
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.

Accepts one of the following:
const ToolChoiceOptionsNone ToolChoiceOptions = "none"
const ToolChoiceOptionsAuto ToolChoiceOptions = "auto"
const ToolChoiceOptionsRequired ToolChoiceOptions = "required"
type ToolChoiceAllowed struct{…}

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

Mode ToolChoiceAllowedMode

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

auto allows the model to pick from among the allowed tools and generate a message.

required requires the model to call one or more of the allowed tools.

Accepts one of the following:
const ToolChoiceAllowedModeAuto ToolChoiceAllowedMode = "auto"
const ToolChoiceAllowedModeRequired ToolChoiceAllowedMode = "required"
Tools []map[string, any]

A list of tool definitions that the model should be allowed to call.

For the Responses API, the list of tool definitions might look like:

[
  { "type": "function", "name": "get_weather" },
  { "type": "mcp", "server_label": "deepwiki" },
  { "type": "image_generation" }
]
Type AllowedTools

Allowed tool configuration type. Always allowed_tools.

type ToolChoiceTypes struct{…}

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

Type ToolChoiceTypesType

The type of hosted tool the model should to use. Learn more about built-in tools.

Allowed values are:

  • file_search
  • web_search_preview
  • computer_use_preview
  • code_interpreter
  • image_generation
Accepts one of the following:
const ToolChoiceTypesTypeFileSearch ToolChoiceTypesType = "file_search"
const ToolChoiceTypesTypeWebSearchPreview ToolChoiceTypesType = "web_search_preview"
const ToolChoiceTypesTypeComputerUsePreview ToolChoiceTypesType = "computer_use_preview"
const ToolChoiceTypesTypeWebSearchPreview2025_03_11 ToolChoiceTypesType = "web_search_preview_2025_03_11"
const ToolChoiceTypesTypeImageGeneration ToolChoiceTypesType = "image_generation"
const ToolChoiceTypesTypeCodeInterpreter ToolChoiceTypesType = "code_interpreter"
type ToolChoiceFunction struct{…}

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

Name string

The name of the function to call.

Type Function

For function calling, the type is always function.

type ToolChoiceMcp struct{…}

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

ServerLabel string

The label of the MCP server to use.

Type Mcp

For MCP tools, the type is always mcp.

Name stringoptional

The name of the tool to call on the server.

type ToolChoiceCustom struct{…}

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

Name string

The name of the custom tool to call.

Type Custom

For custom tool calling, the type is always custom.

type ToolChoiceApplyPatch struct{…}

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

Type ApplyPatch

The tool to call. Always apply_patch.

type ToolChoiceShell struct{…}

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

Type Shell

The tool to call. Always shell.

Tools []ToolUnion

An array of tools the model may call while generating a response. You can specify which tool to use by setting the tool_choice parameter.

We support the following categories of tools:

  • Built-in tools: Tools that are provided by OpenAI that extend the model's capabilities, like web search or file search. Learn more about built-in tools.
  • MCP Tools: Integrations with third-party systems via custom MCP servers or predefined connectors such as Google Drive and SharePoint. Learn more about MCP Tools.
  • Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code with strongly typed arguments and outputs. Learn more about function calling. You can also use custom tools to call your own code.
Accepts one of the following:
type FunctionTool struct{…}

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

Name string

The name of the function to call.

Parameters map[string, any]

A JSON schema object describing the parameters of the function.

Strict bool

Whether to enforce strict parameter validation. Default true.

Type Function

The type of the function tool. Always function.

Description stringoptional

A description of the function. Used by the model to determine whether or not to call the function.

type FileSearchTool struct{…}

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

Type FileSearch

The type of the file search tool. Always file_search.

VectorStoreIDs []string

The IDs of the vector stores to search.

Filters FileSearchToolFiltersUnionoptional

A filter to apply.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
type CompoundFilter struct{…}

Combine multiple filters using and or or.

Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.

Accepts one of the following:
type ComparisonFilter struct{…}

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

Key string

The key to compare against the value.

Type ComparisonFilterType

Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.

  • eq: equals
  • ne: not equal
  • gt: greater than
  • gte: greater than or equal
  • lt: less than
  • lte: less than or equal
  • in: in
  • nin: not in
Accepts one of the following:
const ComparisonFilterTypeEq ComparisonFilterType = "eq"
const ComparisonFilterTypeNe ComparisonFilterType = "ne"
const ComparisonFilterTypeGt ComparisonFilterType = "gt"
const ComparisonFilterTypeGte ComparisonFilterType = "gte"
const ComparisonFilterTypeLt ComparisonFilterType = "lt"
const ComparisonFilterTypeLte ComparisonFilterType = "lte"
Value ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

Accepts one of the following:
string
float64
bool
type ComparisonFilterValueArray []ComparisonFilterValueArrayItemUnion
Accepts one of the following:
string
float64
Type CompoundFilterType

Type of operation: and or or.

Accepts one of the following:
const CompoundFilterTypeAnd CompoundFilterType = "and"
const CompoundFilterTypeOr CompoundFilterType = "or"
MaxNumResults int64optional

The maximum number of results to return. This number should be between 1 and 50 inclusive.

RankingOptions FileSearchToolRankingOptionsoptional

Ranking options for search.

Ranker stringoptional

The ranker to use for the file search.

Accepts one of the following:
const FileSearchToolRankingOptionsRankerAuto FileSearchToolRankingOptionsRanker = "auto"
const FileSearchToolRankingOptionsRankerDefault2024_11_15 FileSearchToolRankingOptionsRanker = "default-2024-11-15"
ScoreThreshold float64optional

The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.

type ComputerTool struct{…}

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

DisplayHeight int64

The height of the computer display.

DisplayWidth int64

The width of the computer display.

Environment ComputerToolEnvironment

The type of computer environment to control.

Accepts one of the following:
const ComputerToolEnvironmentWindows ComputerToolEnvironment = "windows"
const ComputerToolEnvironmentMac ComputerToolEnvironment = "mac"
const ComputerToolEnvironmentLinux ComputerToolEnvironment = "linux"
const ComputerToolEnvironmentUbuntu ComputerToolEnvironment = "ubuntu"
const ComputerToolEnvironmentBrowser ComputerToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type WebSearchTool struct{…}

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

Type WebSearchToolType

The type of the web search tool. One of web_search or web_search_2025_08_26.

Accepts one of the following:
const WebSearchToolTypeWebSearch WebSearchToolType = "web_search"
const WebSearchToolTypeWebSearch2025_08_26 WebSearchToolType = "web_search_2025_08_26"
Filters WebSearchToolFiltersoptional

Filters for the search.

AllowedDomains []stringoptional

Allowed domains for the search. If not provided, all domains are allowed. Subdomains of the provided domains are allowed as well.

Example: ["pubmed.ncbi.nlm.nih.gov"]

SearchContextSize WebSearchToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchToolSearchContextSizeLow WebSearchToolSearchContextSize = "low"
const WebSearchToolSearchContextSizeMedium WebSearchToolSearchContextSize = "medium"
const WebSearchToolSearchContextSizeHigh WebSearchToolSearchContextSize = "high"
UserLocation WebSearchToolUserLocationoptional

The approximate location of the user.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

Type stringoptional

The type of location approximation. Always approximate.

type ToolMcp struct{…}

Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.

ServerLabel string

A label for this MCP server, used to identify it in tool calls.

Type Mcp

The type of the MCP tool. Always mcp.

AllowedTools ToolMcpAllowedToolsUnionoptional

List of allowed tool names or a filter object.

Accepts one of the following:
type ToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type ToolMcpAllowedToolsMcpToolFilter struct{…}

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Authorization stringoptional

An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.

ConnectorID stringoptional

Identifier for service connectors, like those available in ChatGPT. One of server_url or connector_id must be provided. Learn more about service connectors here.

Currently supported connector_id values are:

  • Dropbox: connector_dropbox
  • Gmail: connector_gmail
  • Google Calendar: connector_googlecalendar
  • Google Drive: connector_googledrive
  • Microsoft Teams: connector_microsoftteams
  • Outlook Calendar: connector_outlookcalendar
  • Outlook Email: connector_outlookemail
  • SharePoint: connector_sharepoint
Accepts one of the following:
const ToolMcpConnectorIDConnectorDropbox ToolMcpConnectorID = "connector_dropbox"
const ToolMcpConnectorIDConnectorGmail ToolMcpConnectorID = "connector_gmail"
const ToolMcpConnectorIDConnectorGooglecalendar ToolMcpConnectorID = "connector_googlecalendar"
const ToolMcpConnectorIDConnectorGoogledrive ToolMcpConnectorID = "connector_googledrive"
const ToolMcpConnectorIDConnectorMicrosoftteams ToolMcpConnectorID = "connector_microsoftteams"
const ToolMcpConnectorIDConnectorOutlookcalendar ToolMcpConnectorID = "connector_outlookcalendar"
const ToolMcpConnectorIDConnectorOutlookemail ToolMcpConnectorID = "connector_outlookemail"
const ToolMcpConnectorIDConnectorSharepoint ToolMcpConnectorID = "connector_sharepoint"
Headers map[string, string]optional

Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.

RequireApproval ToolMcpRequireApprovalUnionoptional

Specify which of the MCP server's tools require approval.

Accepts one of the following:
type ToolMcpRequireApprovalMcpToolApprovalFilter struct{…}

Specify which of the MCP server's tools require approval. Can be always, never, or a filter object associated with tools that require approval.

Always ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysoptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

Never ToolMcpRequireApprovalMcpToolApprovalFilterNeveroptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

Indicates whether or not a tool modifies data or is read-only. If an MCP server is annotated with readOnlyHint, it will match this filter.

ToolNames []stringoptional

List of allowed tool names.

type ToolMcpRequireApprovalMcpToolApprovalSetting string

Specify a single approval policy for all tools. One of always or never. When set to always, all tools will require approval. When set to never, all tools will not require approval.

Accepts one of the following:
const ToolMcpRequireApprovalMcpToolApprovalSettingAlways ToolMcpRequireApprovalMcpToolApprovalSetting = "always"
const ToolMcpRequireApprovalMcpToolApprovalSettingNever ToolMcpRequireApprovalMcpToolApprovalSetting = "never"
ServerDescription stringoptional

Optional description of the MCP server, used to provide more context.

ServerURL stringoptional

The URL for the MCP server. One of server_url or connector_id must be provided.

type ToolCodeInterpreter struct{…}

A tool that runs Python code to help generate a response to a prompt.

Container ToolCodeInterpreterContainerUnion

The code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional memory_limit setting.

Accepts one of the following:
string
type ToolCodeInterpreterContainerCodeInterpreterContainerAuto struct{…}

Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

Type Auto

Always auto.

FileIDs []stringoptional

An optional list of uploaded files to make available to your code.

MemoryLimit stringoptional

The memory limit for the code interpreter container.

Accepts one of the following:
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
Type CodeInterpreter

The type of the code interpreter tool. Always code_interpreter.

type ToolImageGeneration struct{…}

A tool that generates images using the GPT image models.

Type ImageGeneration

The type of the image generation tool. Always image_generation.

Action stringoptional

Whether to generate a new image or edit an existing image. Default: auto.

Accepts one of the following:
const ToolImageGenerationActionGenerate ToolImageGenerationAction = "generate"
const ToolImageGenerationActionEdit ToolImageGenerationAction = "edit"
const ToolImageGenerationActionAuto ToolImageGenerationAction = "auto"
Background stringoptional

Background type for the generated image. One of transparent, opaque, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationBackgroundTransparent ToolImageGenerationBackground = "transparent"
const ToolImageGenerationBackgroundOpaque ToolImageGenerationBackground = "opaque"
const ToolImageGenerationBackgroundAuto ToolImageGenerationBackground = "auto"
InputFidelity stringoptional

Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for gpt-image-1 and gpt-image-1.5 and later models, unsupported for gpt-image-1-mini. Supports high and low. Defaults to low.

Accepts one of the following:
const ToolImageGenerationInputFidelityHigh ToolImageGenerationInputFidelity = "high"
const ToolImageGenerationInputFidelityLow ToolImageGenerationInputFidelity = "low"
InputImageMask ToolImageGenerationInputImageMaskoptional

Optional mask for inpainting. Contains image_url (string, optional) and file_id (string, optional).

FileID stringoptional

File ID for the mask image.

ImageURL stringoptional

Base64-encoded mask image.

Model stringoptional

The image generation model to use. Default: gpt-image-1.

Accepts one of the following:
string
string
Accepts one of the following:
const ToolImageGenerationModelGPTImage1 ToolImageGenerationModel = "gpt-image-1"
const ToolImageGenerationModelGPTImage1Mini ToolImageGenerationModel = "gpt-image-1-mini"
const ToolImageGenerationModelGPTImage1_5 ToolImageGenerationModel = "gpt-image-1.5"
Moderation stringoptional

Moderation level for the generated image. Default: auto.

Accepts one of the following:
const ToolImageGenerationModerationAuto ToolImageGenerationModeration = "auto"
const ToolImageGenerationModerationLow ToolImageGenerationModeration = "low"
OutputCompression int64optional

Compression level for the output image. Default: 100.

minimum0
maximum100
OutputFormat stringoptional

The output format of the generated image. One of png, webp, or jpeg. Default: png.

Accepts one of the following:
const ToolImageGenerationOutputFormatPNG ToolImageGenerationOutputFormat = "png"
const ToolImageGenerationOutputFormatWebP ToolImageGenerationOutputFormat = "webp"
const ToolImageGenerationOutputFormatJPEG ToolImageGenerationOutputFormat = "jpeg"
PartialImages int64optional

Number of partial images to generate in streaming mode, from 0 (default value) to 3.

minimum0
maximum3
Quality stringoptional

The quality of the generated image. One of low, medium, high, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationQualityLow ToolImageGenerationQuality = "low"
const ToolImageGenerationQualityMedium ToolImageGenerationQuality = "medium"
const ToolImageGenerationQualityHigh ToolImageGenerationQuality = "high"
const ToolImageGenerationQualityAuto ToolImageGenerationQuality = "auto"
Size stringoptional

The size of the generated image. One of 1024x1024, 1024x1536, 1536x1024, or auto. Default: auto.

Accepts one of the following:
const ToolImageGenerationSize1024x1024 ToolImageGenerationSize = "1024x1024"
const ToolImageGenerationSize1024x1536 ToolImageGenerationSize = "1024x1536"
const ToolImageGenerationSize1536x1024 ToolImageGenerationSize = "1536x1024"
const ToolImageGenerationSizeAuto ToolImageGenerationSize = "auto"
type ToolLocalShell struct{…}

A tool that allows the model to execute shell commands in a local environment.

Type LocalShell

The type of the local shell tool. Always local_shell.

type FunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

type CustomTool struct{…}

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

Name string

The name of the custom tool, used to identify it in tool calls.

Type Custom

The type of the custom tool. Always custom.

Description stringoptional

Optional description of the custom tool, used to provide more context.

The input format for the custom tool. Default is unconstrained text.

Accepts one of the following:
type CustomToolInputFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

type CustomToolInputFormatGrammar struct{…}

A grammar defined by the user.

Definition string

The grammar definition.

Syntax string

The syntax of the grammar definition. One of lark or regex.

Accepts one of the following:
const CustomToolInputFormatGrammarSyntaxLark CustomToolInputFormatGrammarSyntax = "lark"
const CustomToolInputFormatGrammarSyntaxRegex CustomToolInputFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

type WebSearchPreviewTool struct{…}

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

Type WebSearchPreviewToolType

The type of the web search tool. One of web_search_preview or web_search_preview_2025_03_11.

Accepts one of the following:
const WebSearchPreviewToolTypeWebSearchPreview WebSearchPreviewToolType = "web_search_preview"
const WebSearchPreviewToolTypeWebSearchPreview2025_03_11 WebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContextSize WebSearchPreviewToolSearchContextSizeoptional

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Accepts one of the following:
const WebSearchPreviewToolSearchContextSizeLow WebSearchPreviewToolSearchContextSize = "low"
const WebSearchPreviewToolSearchContextSizeMedium WebSearchPreviewToolSearchContextSize = "medium"
const WebSearchPreviewToolSearchContextSizeHigh WebSearchPreviewToolSearchContextSize = "high"
UserLocation WebSearchPreviewToolUserLocationoptional

The user's location.

Type Approximate

The type of location approximation. Always approximate.

City stringoptional

Free text input for the city of the user, e.g. San Francisco.

Country stringoptional

The two-letter ISO country code of the user, e.g. US.

Region stringoptional

Free text input for the region of the user, e.g. California.

Timezone stringoptional

The IANA timezone of the user, e.g. America/Los_Angeles.

type ApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

TopP float64

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

minimum0
maximum1
Background booloptional

Whether to run the model response in the background. Learn more.

CompletedAt float64optional

Unix timestamp (in seconds) of when this Response was completed. Only present when the status is completed.

Conversation ResponseConversationoptional

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

ID string

The unique ID of the conversation that this response was associated with.

MaxOutputTokens int64optional

An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.

MaxToolCalls int64optional

The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

PreviousResponseID stringoptional

The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state. Cannot be used in conjunction with conversation.

Prompt ResponsePromptoptional

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

ID string

The unique identifier of the prompt template to use.

Variables map[string, ResponsePromptVariableUnion]optional

Optional map of values to substitute in for variables in your prompt. The substitution values can either be strings, or other Response input types like images or files.

Accepts one of the following:
string
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

The detail level of the image to be sent to the model. One of high, low, or auto. Defaults to auto.

Accepts one of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
Type InputImage

The type of the input item. Always input_image.

FileID stringoptional

The ID of the file to be sent to the model.

ImageURL stringoptional

The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

The content of the file to be sent to the model.

FileID stringoptional

The ID of the file to be sent to the model.

FileURL stringoptional

The URL of the file to be sent to the model.

Filename stringoptional

The name of the file to be sent to the model.

Version stringoptional

Optional version of the prompt template.

PromptCacheKey stringoptional

Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the user field. Learn more.

PromptCacheRetention ResponsePromptCacheRetentionoptional

The retention policy for the prompt cache. Set to 24h to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. Learn more.

Accepts one of the following:
const ResponsePromptCacheRetentionInMemory ResponsePromptCacheRetention = "in-memory"
const ResponsePromptCacheRetention24h ResponsePromptCacheRetention = "24h"
Reasoning Reasoningoptional

gpt-5 and o-series models only

Configuration options for reasoning models.

Effort ReasoningEffortoptional

Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, and xhigh. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.

  • gpt-5.1 defaults to none, which does not perform reasoning. The supported reasoning values for gpt-5.1 are none, low, medium, and high. Tool calls are supported for all reasoning values in gpt-5.1.
  • All models before gpt-5.1 default to medium reasoning effort, and do not support none.
  • The gpt-5-pro model defaults to (and only supports) high reasoning effort.
  • xhigh is supported for all models after gpt-5.1-codex-max.
Accepts one of the following:
const ReasoningEffortNone ReasoningEffort = "none"
const ReasoningEffortMinimal ReasoningEffort = "minimal"
const ReasoningEffortLow ReasoningEffort = "low"
const ReasoningEffortMedium ReasoningEffort = "medium"
const ReasoningEffortHigh ReasoningEffort = "high"
const ReasoningEffortXhigh ReasoningEffort = "xhigh"
DeprecatedGenerateSummary ReasoningGenerateSummaryoptional

Deprecated: use summary instead.

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.

Accepts one of the following:
const ReasoningGenerateSummaryAuto ReasoningGenerateSummary = "auto"
const ReasoningGenerateSummaryConcise ReasoningGenerateSummary = "concise"
const ReasoningGenerateSummaryDetailed ReasoningGenerateSummary = "detailed"
Summary ReasoningSummaryoptional

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.

concise is supported for computer-use-preview models and all reasoning models after gpt-5.

Accepts one of the following:
const ReasoningSummaryAuto ReasoningSummary = "auto"
const ReasoningSummaryConcise ReasoningSummary = "concise"
const ReasoningSummaryDetailed ReasoningSummary = "detailed"
SafetyIdentifier stringoptional

A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. Learn more.

ServiceTier ResponseServiceTieroptional

Specifies the processing type used for serving the request.

  • If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
  • If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
  • If set to 'flex' or 'priority', then the request will be processed with the corresponding service tier.
  • When not set, the default behavior is 'auto'.

When the service_tier parameter is set, the response body will include the service_tier value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

Accepts one of the following:
const ResponseServiceTierAuto ResponseServiceTier = "auto"
const ResponseServiceTierDefault ResponseServiceTier = "default"
const ResponseServiceTierFlex ResponseServiceTier = "flex"
const ResponseServiceTierScale ResponseServiceTier = "scale"
const ResponseServiceTierPriority ResponseServiceTier = "priority"
Status ResponseStatusoptional

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

Accepts one of the following:
const ResponseStatusCompleted ResponseStatus = "completed"
const ResponseStatusFailed ResponseStatus = "failed"
const ResponseStatusInProgress ResponseStatus = "in_progress"
const ResponseStatusCancelled ResponseStatus = "cancelled"
const ResponseStatusQueued ResponseStatus = "queued"
const ResponseStatusIncomplete ResponseStatus = "incomplete"
Text ResponseTextConfigoptional

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

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.

Accepts one of the following:
type ResponseFormatText struct{…}

Default response format. Used to generate text responses.

Type Text

The type of response format being defined. Always text.

type ResponseFormatTextJSONSchemaConfig struct{…}

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

Name string

The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.

Schema map[string, any]

The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.

Type JSONSchema

The type of response format being defined. Always json_schema.

Description stringoptional

A description of what the response format is for, used by the model to determine how to respond in the format.

Strict booloptional

Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true. To learn more, read the Structured Outputs guide.

type ResponseFormatJSONObject struct{…}

JSON object response format. An older method of generating JSON responses. Using json_schema is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.

Type JSONObject

The type of response format being defined. Always json_object.

Verbosity ResponseTextConfigVerbosityoptional

Constrains the verbosity of the model's response. Lower values will result in more concise responses, while higher values will result in more verbose responses. Currently supported values are low, medium, and high.

Accepts one of the following:
const ResponseTextConfigVerbosityLow ResponseTextConfigVerbosity = "low"
const ResponseTextConfigVerbosityMedium ResponseTextConfigVerbosity = "medium"
const ResponseTextConfigVerbosityHigh ResponseTextConfigVerbosity = "high"
TopLogprobs int64optional

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.

minimum0
maximum20
Truncation ResponseTruncationoptional

The truncation strategy to use for the model response.

  • auto: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation.
  • disabled (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.
Accepts one of the following:
const ResponseTruncationAuto ResponseTruncation = "auto"
const ResponseTruncationDisabled ResponseTruncation = "disabled"
Usage ResponseUsageoptional

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

InputTokens int64

The number of input tokens.

InputTokensDetails ResponseUsageInputTokensDetails

A detailed breakdown of the input tokens.

CachedTokens int64

The number of tokens that were retrieved from the cache. More on prompt caching.

OutputTokens int64

The number of output tokens.

OutputTokensDetails ResponseUsageOutputTokensDetails

A detailed breakdown of the output tokens.

ReasoningTokens int64

The number of reasoning tokens.

TotalTokens int64

The total number of tokens used.

DeprecatedUser stringoptional

This field is being replaced by safety_identifier and prompt_cache_key. Use prompt_cache_key instead to maintain caching optimizations. A stable identifier for your end-users. Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. Learn more.

SequenceNumber int64

The sequence number for this event.

Type ResponseQueued

The type of the event. Always 'response.queued'.

type ResponseCustomToolCallInputDeltaEvent struct{…}

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

Delta string

The incremental input data (delta) for the custom tool call.

ItemID string

Unique identifier for the API item associated with this event.

OutputIndex int64

The index of the output this delta applies to.

SequenceNumber int64

The sequence number of this event.

Type ResponseCustomToolCallInputDelta

The event type identifier.

type ResponseCustomToolCallInputDoneEvent struct{…}

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

Input string

The complete input data for the custom tool call.

ItemID string

Unique identifier for the API item associated with this event.

OutputIndex int64

The index of the output this event applies to.

SequenceNumber int64

The sequence number of this event.

Type ResponseCustomToolCallInputDone

The event type identifier.

Create a model response

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
  "github.com/openai/openai-go/responses"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  response, err := client.Responses.New(context.TODO(), responses.ResponseNewParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.ID)
}
{
  "id": "id",
  "created_at": 0,
  "error": {
    "code": "server_error",
    "message": "message"
  },
  "incomplete_details": {
    "reason": "max_output_tokens"
  },
  "instructions": "string",
  "metadata": {
    "foo": "string"
  },
  "model": "gpt-5.1",
  "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"
    }
  ],
  "parallel_tool_calls": true,
  "temperature": 1,
  "tool_choice": "none",
  "tools": [
    {
      "name": "name",
      "parameters": {
        "foo": "bar"
      },
      "strict": true,
      "type": "function",
      "description": "description"
    }
  ],
  "top_p": 1,
  "background": true,
  "completed_at": 0,
  "conversation": {
    "id": "id"
  },
  "max_output_tokens": 0,
  "max_tool_calls": 0,
  "output_text": "output_text",
  "previous_response_id": "previous_response_id",
  "prompt": {
    "id": "id",
    "variables": {
      "foo": "string"
    },
    "version": "version"
  },
  "prompt_cache_key": "prompt-cache-key-1234",
  "prompt_cache_retention": "in-memory",
  "reasoning": {
    "effort": "none",
    "generate_summary": "auto",
    "summary": "auto"
  },
  "safety_identifier": "safety-identifier-1234",
  "service_tier": "auto",
  "status": "completed",
  "text": {
    "format": {
      "type": "text"
    },
    "verbosity": "low"
  },
  "top_logprobs": 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-1234"
}
Returns Examples
{
  "id": "id",
  "created_at": 0,
  "error": {
    "code": "server_error",
    "message": "message"
  },
  "incomplete_details": {
    "reason": "max_output_tokens"
  },
  "instructions": "string",
  "metadata": {
    "foo": "string"
  },
  "model": "gpt-5.1",
  "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"
    }
  ],
  "parallel_tool_calls": true,
  "temperature": 1,
  "tool_choice": "none",
  "tools": [
    {
      "name": "name",
      "parameters": {
        "foo": "bar"
      },
      "strict": true,
      "type": "function",
      "description": "description"
    }
  ],
  "top_p": 1,
  "background": true,
  "completed_at": 0,
  "conversation": {
    "id": "id"
  },
  "max_output_tokens": 0,
  "max_tool_calls": 0,
  "output_text": "output_text",
  "previous_response_id": "previous_response_id",
  "prompt": {
    "id": "id",
    "variables": {
      "foo": "string"
    },
    "version": "version"
  },
  "prompt_cache_key": "prompt-cache-key-1234",
  "prompt_cache_retention": "in-memory",
  "reasoning": {
    "effort": "none",
    "generate_summary": "auto",
    "summary": "auto"
  },
  "safety_identifier": "safety-identifier-1234",
  "service_tier": "auto",
  "status": "completed",
  "text": {
    "format": {
      "type": "text"
    },
    "verbosity": "low"
  },
  "top_logprobs": 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-1234"
}