Skip to content
Primary navigation

Cancel a response

client.Beta.Responses.Cancel(ctx, responseID, body) (*BetaResponse, error)
POST/responses/{response_id}/cancel

Cancels a model response with the given ID. Only responses created with the background parameter set to true can be cancelled. Learn more.

ParametersExpand Collapse
responseID string
body BetaResponseCancelParams
Betas param.Field[[]string]Optional

Optional beta features to enable for this request.

const BetaResponseCancelParamsOpenAIBetaResponsesMultiAgentV1 BetaResponseCancelParamsOpenAIBeta = "responses_multi_agent=v1"
ReturnsExpand Collapse
type BetaResponse struct{…}
ID string

Unique identifier for this Response.

CreatedAt float64

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

formatunixtime

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

Code BetaResponseErrorCode

The error code for the response.

One of the following:
const BetaResponseErrorCodeServerError BetaResponseErrorCode = "server_error"
const BetaResponseErrorCodeRateLimitExceeded BetaResponseErrorCode = "rate_limit_exceeded"
const BetaResponseErrorCodeInvalidPrompt BetaResponseErrorCode = "invalid_prompt"
const BetaResponseErrorCodeDataResidencyMismatch BetaResponseErrorCode = "data_residency_mismatch"
const BetaResponseErrorCodeBioPolicy BetaResponseErrorCode = "bio_policy"
const BetaResponseErrorCodeVectorStoreTimeout BetaResponseErrorCode = "vector_store_timeout"
const BetaResponseErrorCodeInvalidImage BetaResponseErrorCode = "invalid_image"
const BetaResponseErrorCodeInvalidImageFormat BetaResponseErrorCode = "invalid_image_format"
const BetaResponseErrorCodeInvalidBase64Image BetaResponseErrorCode = "invalid_base64_image"
const BetaResponseErrorCodeInvalidImageURL BetaResponseErrorCode = "invalid_image_url"
const BetaResponseErrorCodeImageTooLarge BetaResponseErrorCode = "image_too_large"
const BetaResponseErrorCodeImageTooSmall BetaResponseErrorCode = "image_too_small"
const BetaResponseErrorCodeImageParseError BetaResponseErrorCode = "image_parse_error"
const BetaResponseErrorCodeImageContentPolicyViolation BetaResponseErrorCode = "image_content_policy_violation"
const BetaResponseErrorCodeInvalidImageMode BetaResponseErrorCode = "invalid_image_mode"
const BetaResponseErrorCodeImageFileTooLarge BetaResponseErrorCode = "image_file_too_large"
const BetaResponseErrorCodeUnsupportedImageMediaType BetaResponseErrorCode = "unsupported_image_media_type"
const BetaResponseErrorCodeEmptyImageFile BetaResponseErrorCode = "empty_image_file"
const BetaResponseErrorCodeFailedToDownloadImage BetaResponseErrorCode = "failed_to_download_image"
const BetaResponseErrorCodeImageFileNotFound BetaResponseErrorCode = "image_file_not_found"
Message string

A human-readable description of the error.

IncompleteDetails BetaResponseIncompleteDetails

Details about why the response is incomplete.

Reason stringOptional

The reason why the response is incomplete.

One of the following:
const BetaResponseIncompleteDetailsReasonMaxOutputTokens BetaResponseIncompleteDetailsReason = "max_output_tokens"
const BetaResponseIncompleteDetailsReasonContentFilter BetaResponseIncompleteDetailsReason = "content_filter"
Instructions BetaResponseInstructionsUnion

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.

One of the following:
string
type BetaResponseInstructionsInputItemList []BetaResponseInputItemUnion

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

One of the following:
type BetaEasyInputMessage 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 BetaEasyInputMessageContentUnion

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

One of the following:
string
type BetaResponseInputMessageContentList []BetaResponseInputContentUnion

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

One of the following:
type BetaResponseInputText 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.

PromptCacheBreakpoint BetaResponseInputTextPromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputImage struct{…}

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

Detail BetaResponseInputImageDetail

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

One of the following:
const BetaResponseInputImageDetailLow BetaResponseInputImageDetail = "low"
const BetaResponseInputImageDetailHigh BetaResponseInputImageDetail = "high"
const BetaResponseInputImageDetailAuto BetaResponseInputImageDetail = "auto"
const BetaResponseInputImageDetailOriginal BetaResponseInputImageDetail = "original"
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.

formaturi
PromptCacheBreakpoint BetaResponseInputImagePromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

Detail BetaResponseInputFileDetailOptional

The detail level of the file to be sent to the model. Use auto to let the system select the detail level; for GPT-5.6 and later models, auto uses high-quality rendering, which may increase input token usage. Use low for lower-cost rendering, or high to render the file at higher quality. Defaults to auto.

One of the following:
const BetaResponseInputFileDetailAuto BetaResponseInputFileDetail = "auto"
const BetaResponseInputFileDetailLow BetaResponseInputFileDetail = "low"
const BetaResponseInputFileDetailHigh BetaResponseInputFileDetail = "high"
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.

formaturi
Filename stringOptional

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

PromptCacheBreakpoint BetaResponseInputFilePromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

Role BetaEasyInputMessageRole

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

One of the following:
const BetaEasyInputMessageRoleUser BetaEasyInputMessageRole = "user"
const BetaEasyInputMessageRoleAssistant BetaEasyInputMessageRole = "assistant"
const BetaEasyInputMessageRoleSystem BetaEasyInputMessageRole = "system"
const BetaEasyInputMessageRoleDeveloper BetaEasyInputMessageRole = "developer"
Phase BetaEasyInputMessagePhaseOptional

Labels an assistant message as intermediate commentary (commentary) or the final answer (final_answer). For models like gpt-5.3-codex and beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.

One of the following:
const BetaEasyInputMessagePhaseCommentary BetaEasyInputMessagePhase = "commentary"
const BetaEasyInputMessagePhaseFinalAnswer BetaEasyInputMessagePhase = "final_answer"
Type BetaEasyInputMessageTypeOptional

The type of the message input. Always message.

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

One of the following:
type BetaResponseInputText 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.

PromptCacheBreakpoint BetaResponseInputTextPromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputImage struct{…}

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

Detail BetaResponseInputImageDetail

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

One of the following:
const BetaResponseInputImageDetailLow BetaResponseInputImageDetail = "low"
const BetaResponseInputImageDetailHigh BetaResponseInputImageDetail = "high"
const BetaResponseInputImageDetailAuto BetaResponseInputImageDetail = "auto"
const BetaResponseInputImageDetailOriginal BetaResponseInputImageDetail = "original"
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.

formaturi
PromptCacheBreakpoint BetaResponseInputImagePromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

Detail BetaResponseInputFileDetailOptional

The detail level of the file to be sent to the model. Use auto to let the system select the detail level; for GPT-5.6 and later models, auto uses high-quality rendering, which may increase input token usage. Use low for lower-cost rendering, or high to render the file at higher quality. Defaults to auto.

One of the following:
const BetaResponseInputFileDetailAuto BetaResponseInputFileDetail = "auto"
const BetaResponseInputFileDetailLow BetaResponseInputFileDetail = "low"
const BetaResponseInputFileDetailHigh BetaResponseInputFileDetail = "high"
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.

formaturi
Filename stringOptional

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

PromptCacheBreakpoint BetaResponseInputFilePromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

Role string

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

One of the following:
const BetaResponseInputItemMessageRoleUser BetaResponseInputItemMessageRole = "user"
const BetaResponseInputItemMessageRoleSystem BetaResponseInputItemMessageRole = "system"
const BetaResponseInputItemMessageRoleDeveloper BetaResponseInputItemMessageRole = "developer"
Agent BetaResponseInputItemMessageAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Status stringOptional

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

One of the following:
const BetaResponseInputItemMessageStatusInProgress BetaResponseInputItemMessageStatus = "in_progress"
const BetaResponseInputItemMessageStatusCompleted BetaResponseInputItemMessageStatus = "completed"
const BetaResponseInputItemMessageStatusIncomplete BetaResponseInputItemMessageStatus = "incomplete"
Type stringOptional

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

type BetaResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []BetaResponseOutputMessageContentUnion

The content of the output message.

One of the following:
type BetaResponseOutputText struct{…}

A text output from the model.

Annotations []BetaResponseOutputTextAnnotationUnion

The annotations of the text output.

One of the following:
type BetaResponseOutputTextAnnotationFileCitation 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 BetaResponseOutputTextAnnotationURLCitation 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.

formaturi
type BetaResponseOutputTextAnnotationContainerFileCitation 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 BetaResponseOutputTextAnnotationFilePath 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 []BetaResponseOutputTextLogprobOptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []BetaResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type BetaResponseOutputRefusal 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 BetaResponseOutputMessageStatus

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

One of the following:
const BetaResponseOutputMessageStatusInProgress BetaResponseOutputMessageStatus = "in_progress"
const BetaResponseOutputMessageStatusCompleted BetaResponseOutputMessageStatus = "completed"
const BetaResponseOutputMessageStatusIncomplete BetaResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

Agent BetaResponseOutputMessageAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Phase BetaResponseOutputMessagePhaseOptional

Labels an assistant message as intermediate commentary (commentary) or the final answer (final_answer). For models like gpt-5.3-codex and beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.

One of the following:
const BetaResponseOutputMessagePhaseCommentary BetaResponseOutputMessagePhase = "commentary"
const BetaResponseOutputMessagePhaseFinalAnswer BetaResponseOutputMessagePhase = "final_answer"
type BetaResponseFileSearchToolCall 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 BetaResponseFileSearchToolCallStatus

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

One of the following:
const BetaResponseFileSearchToolCallStatusInProgress BetaResponseFileSearchToolCallStatus = "in_progress"
const BetaResponseFileSearchToolCallStatusSearching BetaResponseFileSearchToolCallStatus = "searching"
const BetaResponseFileSearchToolCallStatusCompleted BetaResponseFileSearchToolCallStatus = "completed"
const BetaResponseFileSearchToolCallStatusIncomplete BetaResponseFileSearchToolCallStatus = "incomplete"
const BetaResponseFileSearchToolCallStatusFailed BetaResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

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

Agent BetaResponseFileSearchToolCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Results []BetaResponseFileSearchToolCallResultOptional

The results of the file search tool call.

Attributes map[string, BetaResponseFileSearchToolCallResultAttributeUnion]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.

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

CallID string

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

PendingSafetyChecks []BetaResponseComputerToolCallPendingSafetyCheck

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 BetaResponseComputerToolCallStatus

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

One of the following:
const BetaResponseComputerToolCallStatusInProgress BetaResponseComputerToolCallStatus = "in_progress"
const BetaResponseComputerToolCallStatusCompleted BetaResponseComputerToolCallStatus = "completed"
const BetaResponseComputerToolCallStatusIncomplete BetaResponseComputerToolCallStatus = "incomplete"
Type BetaResponseComputerToolCallType

The type of the computer call. Always computer_call.

A click action.

One of the following:
type BetaComputerActionClick struct{…}

A click action.

Button string

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

One of the following:
const BetaComputerActionClickButtonLeft BetaComputerActionClickButton = "left"
const BetaComputerActionClickButtonRight BetaComputerActionClickButton = "right"
const BetaComputerActionClickButtonWheel BetaComputerActionClickButton = "wheel"
const BetaComputerActionClickButtonBack BetaComputerActionClickButton = "back"
const BetaComputerActionClickButtonForward BetaComputerActionClickButton = "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.

Keys []stringOptional

The keys being held while clicking.

type BetaComputerActionDoubleClick struct{…}

A double click action.

Keys []string

The keys being held while double-clicking.

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 BetaComputerActionDrag struct{…}

A drag action.

Path []BetaComputerActionDragPath

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.

Keys []stringOptional

The keys being held while dragging the mouse.

type BetaComputerActionKeypress 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 BetaComputerActionMove 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.

Keys []stringOptional

The keys being held while moving the mouse.

type BetaComputerActionScreenshot struct{…}

A screenshot action.

Type Screenshot

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

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

Keys []stringOptional

The keys being held while scrolling.

type BetaComputerActionType 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 BetaComputerActionWait struct{…}

A wait action.

Type Wait

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

Actions BetaComputerActionListOptional

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

One of the following:
type BetaComputerActionClick struct{…}

A click action.

Button string

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

One of the following:
const BetaComputerActionClickButtonLeft BetaComputerActionClickButton = "left"
const BetaComputerActionClickButtonRight BetaComputerActionClickButton = "right"
const BetaComputerActionClickButtonWheel BetaComputerActionClickButton = "wheel"
const BetaComputerActionClickButtonBack BetaComputerActionClickButton = "back"
const BetaComputerActionClickButtonForward BetaComputerActionClickButton = "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.

Keys []stringOptional

The keys being held while clicking.

type BetaComputerActionDoubleClick struct{…}

A double click action.

Keys []string

The keys being held while double-clicking.

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 BetaComputerActionDrag struct{…}

A drag action.

Path []BetaComputerActionDragPath

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.

Keys []stringOptional

The keys being held while dragging the mouse.

type BetaComputerActionKeypress 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 BetaComputerActionMove 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.

Keys []stringOptional

The keys being held while moving the mouse.

type BetaComputerActionScreenshot struct{…}

A screenshot action.

Type Screenshot

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

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

Keys []stringOptional

The keys being held while scrolling.

type BetaComputerActionType 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 BetaComputerActionWait struct{…}

A wait action.

Type Wait

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

Agent BetaResponseComputerToolCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

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

formaturi
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 []BetaResponseInputItemComputerCallOutputAcknowledgedSafetyCheckOptional

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.

Agent BetaResponseInputItemComputerCallOutputAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Status stringOptional

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

One of the following:
const BetaResponseInputItemComputerCallOutputStatusInProgress BetaResponseInputItemComputerCallOutputStatus = "in_progress"
const BetaResponseInputItemComputerCallOutputStatusCompleted BetaResponseInputItemComputerCallOutputStatus = "completed"
const BetaResponseInputItemComputerCallOutputStatusIncomplete BetaResponseInputItemComputerCallOutputStatus = "incomplete"
One of the following:
One of the following:
type BetaResponseFunctionToolCall 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.

Agent BetaResponseFunctionToolCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseFunctionToolCallCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseFunctionToolCallCallerDirect struct{…}
Type Direct
type BetaResponseFunctionToolCallCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

Type Program
Namespace stringOptional

The namespace of the function to run.

Status BetaResponseFunctionToolCallStatusOptional

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

One of the following:
const BetaResponseFunctionToolCallStatusInProgress BetaResponseFunctionToolCallStatus = "in_progress"
const BetaResponseFunctionToolCallStatusCompleted BetaResponseFunctionToolCallStatus = "completed"
const BetaResponseFunctionToolCallStatusIncomplete BetaResponseFunctionToolCallStatus = "incomplete"
type BetaResponseInputItemFunctionCallOutput 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 BetaResponseInputItemFunctionCallOutputOutputUnion

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

One of the following:
string
type BetaResponseFunctionCallOutputItemList []BetaResponseFunctionCallOutputItemUnion

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

One of the following:
type BetaResponseInputTextContent 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.

PromptCacheBreakpoint BetaResponseInputTextContentPromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputImageContent struct{…}

An image input to the model. Learn about image inputs

Type InputImage

The type of the input item. Always input_image.

Detail BetaResponseInputImageContentDetailOptional

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

One of the following:
const BetaResponseInputImageContentDetailLow BetaResponseInputImageContentDetail = "low"
const BetaResponseInputImageContentDetailHigh BetaResponseInputImageContentDetail = "high"
const BetaResponseInputImageContentDetailAuto BetaResponseInputImageContentDetail = "auto"
const BetaResponseInputImageContentDetailOriginal BetaResponseInputImageContentDetail = "original"
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
formaturi
PromptCacheBreakpoint BetaResponseInputImageContentPromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputFileContent struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

Detail BetaResponseInputFileContentDetailOptional

The detail level of the file to be sent to the model. Use auto to let the system select the detail level; for GPT-5.6 and later models, auto uses high-quality rendering, which may increase input token usage. Use low for lower-cost rendering, or high to render the file at higher quality. Defaults to auto.

One of the following:
const BetaResponseInputFileContentDetailAuto BetaResponseInputFileContentDetail = "auto"
const BetaResponseInputFileContentDetailLow BetaResponseInputFileContentDetail = "low"
const BetaResponseInputFileContentDetailHigh BetaResponseInputFileContentDetail = "high"
FileData stringOptional

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

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

formaturi
Filename stringOptional

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

PromptCacheBreakpoint BetaResponseInputFileContentPromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

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.

Agent BetaResponseInputItemFunctionCallOutputAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseInputItemFunctionCallOutputCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseInputItemFunctionCallOutputCallerDirect struct{…}
Type Direct

The caller type. Always direct.

type BetaResponseInputItemFunctionCallOutputCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

maxLength64
minLength1
Type Program

The caller type. Always program.

Status stringOptional

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

One of the following:
const BetaResponseInputItemFunctionCallOutputStatusInProgress BetaResponseInputItemFunctionCallOutputStatus = "in_progress"
const BetaResponseInputItemFunctionCallOutputStatusCompleted BetaResponseInputItemFunctionCallOutputStatus = "completed"
const BetaResponseInputItemFunctionCallOutputStatusIncomplete BetaResponseInputItemFunctionCallOutputStatus = "incomplete"
type BetaResponseInputItemAgentMessage struct{…}

A message routed between agents.

Author string

The sending agent identity.

Content []BetaResponseInputItemAgentMessageContentUnion

Plaintext, image, or encrypted content sent between agents.

One of the following:
type BetaResponseInputTextContent 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.

PromptCacheBreakpoint BetaResponseInputTextContentPromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputImageContent struct{…}

An image input to the model. Learn about image inputs

Type InputImage

The type of the input item. Always input_image.

Detail BetaResponseInputImageContentDetailOptional

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

One of the following:
const BetaResponseInputImageContentDetailLow BetaResponseInputImageContentDetail = "low"
const BetaResponseInputImageContentDetailHigh BetaResponseInputImageContentDetail = "high"
const BetaResponseInputImageContentDetailAuto BetaResponseInputImageContentDetail = "auto"
const BetaResponseInputImageContentDetailOriginal BetaResponseInputImageContentDetail = "original"
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
formaturi
PromptCacheBreakpoint BetaResponseInputImageContentPromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputItemAgentMessageContentEncryptedContent struct{…}

Opaque encrypted content that Responses API decrypts inside trusted model execution.

EncryptedContent string

Opaque encrypted content.

maxLength10485760
Type EncryptedContent

The type of the input item. Always encrypted_content.

Recipient string

The destination agent identity.

Type AgentMessage

The item type. Always agent_message.

ID stringOptional

The unique ID of this agent message item.

Agent BetaResponseInputItemAgentMessageAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseInputItemMultiAgentCall struct{…}
Action string

The multi-agent action that was executed.

One of the following:
const BetaResponseInputItemMultiAgentCallActionSpawnAgent BetaResponseInputItemMultiAgentCallAction = "spawn_agent"
const BetaResponseInputItemMultiAgentCallActionInterruptAgent BetaResponseInputItemMultiAgentCallAction = "interrupt_agent"
const BetaResponseInputItemMultiAgentCallActionListAgents BetaResponseInputItemMultiAgentCallAction = "list_agents"
const BetaResponseInputItemMultiAgentCallActionSendMessage BetaResponseInputItemMultiAgentCallAction = "send_message"
const BetaResponseInputItemMultiAgentCallActionFollowupTask BetaResponseInputItemMultiAgentCallAction = "followup_task"
const BetaResponseInputItemMultiAgentCallActionWaitAgent BetaResponseInputItemMultiAgentCallAction = "wait_agent"
Arguments string

The action arguments as a JSON string.

CallID string

The unique ID linking this call to its output.

maxLength64
minLength1
Type MultiAgentCall

The item type. Always multi_agent_call.

ID stringOptional

The unique ID of this multi-agent call.

Agent BetaResponseInputItemMultiAgentCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseInputItemMultiAgentCallOutput struct{…}
Action string

The multi-agent action that produced this result.

One of the following:
const BetaResponseInputItemMultiAgentCallOutputActionSpawnAgent BetaResponseInputItemMultiAgentCallOutputAction = "spawn_agent"
const BetaResponseInputItemMultiAgentCallOutputActionInterruptAgent BetaResponseInputItemMultiAgentCallOutputAction = "interrupt_agent"
const BetaResponseInputItemMultiAgentCallOutputActionListAgents BetaResponseInputItemMultiAgentCallOutputAction = "list_agents"
const BetaResponseInputItemMultiAgentCallOutputActionSendMessage BetaResponseInputItemMultiAgentCallOutputAction = "send_message"
const BetaResponseInputItemMultiAgentCallOutputActionFollowupTask BetaResponseInputItemMultiAgentCallOutputAction = "followup_task"
const BetaResponseInputItemMultiAgentCallOutputActionWaitAgent BetaResponseInputItemMultiAgentCallOutputAction = "wait_agent"
CallID string

The unique ID of the multi-agent call.

maxLength64
minLength1
Output []BetaResponseInputItemMultiAgentCallOutputOutput

Text output returned by the multi-agent action.

Text string

The text content.

maxLength10485760
Type OutputText

The content type. Always output_text.

Annotations []BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionOptional

Citations associated with the text content.

One of the following:
type BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitation struct{…}
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.

minimum0
Type FileCitation

The citation type. Always file_citation.

type BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitation struct{…}
EndIndex int64

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

minimum0
StartIndex int64

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

minimum0
Title string

The title of the cited resource.

Type URLCitation

The citation type. Always url_citation.

URL string

The URL of the cited resource.

formaturi
type BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitation struct{…}
ContainerID string

The ID of the container.

EndIndex int64

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

minimum0
FileID string

The ID of the container file.

Filename string

The filename of the container file cited.

StartIndex int64

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

minimum0
Type ContainerFileCitation

The citation type. Always container_file_citation.

Type MultiAgentCallOutput

The item type. Always multi_agent_call_output.

ID stringOptional

The unique ID of this multi-agent call output.

Agent BetaResponseInputItemMultiAgentCallOutputAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseInputItemToolSearchCall struct{…}
Arguments any

The arguments supplied to the tool search call.

Type ToolSearchCall

The item type. Always tool_search_call.

ID stringOptional

The unique ID of this tool search call.

Agent BetaResponseInputItemToolSearchCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

CallID stringOptional

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

maxLength64
minLength1
Execution stringOptional

Whether tool search was executed by the server or by the client.

One of the following:
const BetaResponseInputItemToolSearchCallExecutionServer BetaResponseInputItemToolSearchCallExecution = "server"
const BetaResponseInputItemToolSearchCallExecutionClient BetaResponseInputItemToolSearchCallExecution = "client"
Status stringOptional

The status of the tool search call.

One of the following:
const BetaResponseInputItemToolSearchCallStatusInProgress BetaResponseInputItemToolSearchCallStatus = "in_progress"
const BetaResponseInputItemToolSearchCallStatusCompleted BetaResponseInputItemToolSearchCallStatus = "completed"
const BetaResponseInputItemToolSearchCallStatusIncomplete BetaResponseInputItemToolSearchCallStatus = "incomplete"
type BetaResponseToolSearchOutputItemParamResp struct{…}

The loaded tool definitions returned by the tool search output.

One of the following:
type BetaFunctionTool 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 strict parameter validation is enforced for this function tool.

Type Function

The type of the function tool. Always function.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaFunctionToolAllowedCallerDirect BetaFunctionToolAllowedCaller = "direct"
const BetaFunctionToolAllowedCallerProgrammatic BetaFunctionToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this function is deferred and loaded via tool search.

Description stringOptional

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

OutputSchema map[string, any]Optional

A JSON schema object describing the JSON value encoded in string outputs for this function.

type BetaFileSearchTool 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 BetaFileSearchToolFiltersUnionOptional

A filter to apply.

One of the following:
type BetaFileSearchToolFiltersComparisonFilter 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 string

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
One of the following:
const BetaFileSearchToolFiltersComparisonFilterTypeEq BetaFileSearchToolFiltersComparisonFilterType = "eq"
const BetaFileSearchToolFiltersComparisonFilterTypeNe BetaFileSearchToolFiltersComparisonFilterType = "ne"
const BetaFileSearchToolFiltersComparisonFilterTypeGt BetaFileSearchToolFiltersComparisonFilterType = "gt"
const BetaFileSearchToolFiltersComparisonFilterTypeGte BetaFileSearchToolFiltersComparisonFilterType = "gte"
const BetaFileSearchToolFiltersComparisonFilterTypeLt BetaFileSearchToolFiltersComparisonFilterType = "lt"
const BetaFileSearchToolFiltersComparisonFilterTypeLte BetaFileSearchToolFiltersComparisonFilterType = "lte"
const BetaFileSearchToolFiltersComparisonFilterTypeIn BetaFileSearchToolFiltersComparisonFilterType = "in"
const BetaFileSearchToolFiltersComparisonFilterTypeNin BetaFileSearchToolFiltersComparisonFilterType = "nin"
Value BetaFileSearchToolFiltersComparisonFilterValueUnion

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

One of the following:
string
float64
bool
type BetaFileSearchToolFiltersComparisonFilterValueArray []BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion
One of the following:
string
float64
type BetaFileSearchToolFiltersCompoundFilter struct{…}

Combine multiple filters using and or or.

Filters []BetaFileSearchToolFiltersCompoundFilterFilter

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

One of the following:
type BetaFileSearchToolFiltersCompoundFilterFilter 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 string

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
One of the following:
const BetaFileSearchToolFiltersCompoundFilterFilterTypeEq BetaFileSearchToolFiltersCompoundFilterFilterType = "eq"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeNe BetaFileSearchToolFiltersCompoundFilterFilterType = "ne"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeGt BetaFileSearchToolFiltersCompoundFilterFilterType = "gt"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeGte BetaFileSearchToolFiltersCompoundFilterFilterType = "gte"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeLt BetaFileSearchToolFiltersCompoundFilterFilterType = "lt"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeLte BetaFileSearchToolFiltersCompoundFilterFilterType = "lte"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeIn BetaFileSearchToolFiltersCompoundFilterFilterType = "in"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeNin BetaFileSearchToolFiltersCompoundFilterFilterType = "nin"
Value BetaFileSearchToolFiltersCompoundFilterFilterValueUnion

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

One of the following:
string
float64
bool
type BetaFileSearchToolFiltersCompoundFilterFilterValueArray []BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion
One of the following:
string
float64
Type string

Type of operation: and or or.

One of the following:
const BetaFileSearchToolFiltersCompoundFilterTypeAnd BetaFileSearchToolFiltersCompoundFilterType = "and"
const BetaFileSearchToolFiltersCompoundFilterTypeOr BetaFileSearchToolFiltersCompoundFilterType = "or"
MaxNumResults int64Optional

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

RankingOptions BetaFileSearchToolRankingOptionsOptional

Ranking options for search.

Ranker stringOptional

The ranker to use for the file search.

One of the following:
const BetaFileSearchToolRankingOptionsRankerAuto BetaFileSearchToolRankingOptionsRanker = "auto"
const BetaFileSearchToolRankingOptionsRankerDefault2024_11_15 BetaFileSearchToolRankingOptionsRanker = "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 BetaComputerTool struct{…}

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

Type Computer

The type of the computer tool. Always computer.

type BetaComputerUsePreviewTool 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 BetaComputerUsePreviewToolEnvironment

The type of computer environment to control.

One of the following:
const BetaComputerUsePreviewToolEnvironmentWindows BetaComputerUsePreviewToolEnvironment = "windows"
const BetaComputerUsePreviewToolEnvironmentMac BetaComputerUsePreviewToolEnvironment = "mac"
const BetaComputerUsePreviewToolEnvironmentLinux BetaComputerUsePreviewToolEnvironment = "linux"
const BetaComputerUsePreviewToolEnvironmentUbuntu BetaComputerUsePreviewToolEnvironment = "ubuntu"
const BetaComputerUsePreviewToolEnvironmentBrowser BetaComputerUsePreviewToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type BetaWebSearchTool struct{…}

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

Type BetaWebSearchToolType

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

One of the following:
const BetaWebSearchToolTypeWebSearch BetaWebSearchToolType = "web_search"
const BetaWebSearchToolTypeWebSearch2025_08_26 BetaWebSearchToolType = "web_search_2025_08_26"
Filters BetaWebSearchToolFiltersOptional

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 BetaWebSearchToolSearchContextSizeOptional

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.

One of the following:
const BetaWebSearchToolSearchContextSizeLow BetaWebSearchToolSearchContextSize = "low"
const BetaWebSearchToolSearchContextSizeMedium BetaWebSearchToolSearchContextSize = "medium"
const BetaWebSearchToolSearchContextSizeHigh BetaWebSearchToolSearchContextSize = "high"
UserLocation BetaWebSearchToolUserLocationOptional

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaToolMcpAllowedCallerDirect BetaToolMcpAllowedCaller = "direct"
const BetaToolMcpAllowedCallerProgrammatic BetaToolMcpAllowedCaller = "programmatic"
AllowedTools BetaToolMcpAllowedToolsUnionOptional

List of allowed tool names or a filter object.

One of the following:
type BetaToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type BetaToolMcpAllowedToolsMcpToolFilter 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, connector_id, or tunnel_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
One of the following:
const BetaToolMcpConnectorIDConnectorDropbox BetaToolMcpConnectorID = "connector_dropbox"
const BetaToolMcpConnectorIDConnectorGmail BetaToolMcpConnectorID = "connector_gmail"
const BetaToolMcpConnectorIDConnectorGooglecalendar BetaToolMcpConnectorID = "connector_googlecalendar"
const BetaToolMcpConnectorIDConnectorGoogledrive BetaToolMcpConnectorID = "connector_googledrive"
const BetaToolMcpConnectorIDConnectorMicrosoftteams BetaToolMcpConnectorID = "connector_microsoftteams"
const BetaToolMcpConnectorIDConnectorOutlookcalendar BetaToolMcpConnectorID = "connector_outlookcalendar"
const BetaToolMcpConnectorIDConnectorOutlookemail BetaToolMcpConnectorID = "connector_outlookemail"
const BetaToolMcpConnectorIDConnectorSharepoint BetaToolMcpConnectorID = "connector_sharepoint"
DeferLoading boolOptional

Whether this MCP tool is deferred and discovered via tool search.

Headers map[string, string]Optional

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

RequireApproval BetaToolMcpRequireApprovalUnionOptional

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

One of the following:
type BetaToolMcpRequireApprovalMcpToolApprovalFilter 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 BetaToolMcpRequireApprovalMcpToolApprovalFilterAlwaysOptional

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 BetaToolMcpRequireApprovalMcpToolApprovalFilterNeverOptional

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

One of the following:
const BetaToolMcpRequireApprovalMcpToolApprovalSettingAlways BetaToolMcpRequireApprovalMcpToolApprovalSetting = "always"
const BetaToolMcpRequireApprovalMcpToolApprovalSettingNever BetaToolMcpRequireApprovalMcpToolApprovalSetting = "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, connector_id, or tunnel_id must be provided.

formaturi
TunnelID stringOptional

The Secure MCP Tunnel ID to use instead of a direct server URL. One of server_url, connector_id, or tunnel_id must be provided.

type BetaToolCodeInterpreter struct{…}

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

Container BetaToolCodeInterpreterContainerUnion

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.

One of the following:
string
type BetaToolCodeInterpreterContainerCodeInterpreterToolAuto 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.

One of the following:
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
NetworkPolicy BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionOptional

Network access policy for the container.

One of the following:
type BetaContainerNetworkPolicyDisabled struct{…}
Type Disabled

Disable outbound network access. Always disabled.

type BetaContainerNetworkPolicyAllowlist struct{…}
AllowedDomains []string

A list of allowed domains when type is allowlist.

Type Allowlist

Allow outbound network access only to specified domains. Always allowlist.

Optional domain-scoped secrets for allowlisted domains.

Domain string

The domain associated with the secret.

minLength1
Name string

The name of the secret to inject for the domain.

minLength1
Value string

The secret value to inject for the domain.

maxLength10485760
minLength1
Type CodeInterpreter

The type of the code interpreter tool. Always code_interpreter.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaToolCodeInterpreterAllowedCallerDirect BetaToolCodeInterpreterAllowedCaller = "direct"
const BetaToolCodeInterpreterAllowedCallerProgrammatic BetaToolCodeInterpreterAllowedCaller = "programmatic"
type BetaToolProgrammaticToolCalling struct{…}
Type ProgrammaticToolCalling

The type of the tool. Always programmatic_tool_calling.

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

One of the following:
const BetaToolImageGenerationActionGenerate BetaToolImageGenerationAction = "generate"
const BetaToolImageGenerationActionEdit BetaToolImageGenerationAction = "edit"
const BetaToolImageGenerationActionAuto BetaToolImageGenerationAction = "auto"
Background stringOptional

Allows to set transparency for the background of the generated image(s). This parameter is only supported for GPT image models that support transparent backgrounds. Must be one of transparent, opaque, or auto (default value). When auto is used, the model will automatically determine the best background for the image.

gpt-image-2 and gpt-image-2-2026-04-21 do not support transparent backgrounds. Requests with background set to transparent will return an error for these models; use opaque or auto instead.

If transparent, the output format needs to support transparency, so it should be set to either png (default value) or webp.

One of the following:
const BetaToolImageGenerationBackgroundTransparent BetaToolImageGenerationBackground = "transparent"
const BetaToolImageGenerationBackgroundOpaque BetaToolImageGenerationBackground = "opaque"
const BetaToolImageGenerationBackgroundAuto BetaToolImageGenerationBackground = "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.

One of the following:
const BetaToolImageGenerationInputFidelityHigh BetaToolImageGenerationInputFidelity = "high"
const BetaToolImageGenerationInputFidelityLow BetaToolImageGenerationInputFidelity = "low"
InputImageMask BetaToolImageGenerationInputImageMaskOptional

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.

One of the following:
string
string
One of the following:
const BetaToolImageGenerationModelGPTImage1 BetaToolImageGenerationModel = "gpt-image-1"
const BetaToolImageGenerationModelGPTImage1Mini BetaToolImageGenerationModel = "gpt-image-1-mini"
const BetaToolImageGenerationModelGPTImage2 BetaToolImageGenerationModel = "gpt-image-2"
const BetaToolImageGenerationModelGPTImage2_2026_04_21 BetaToolImageGenerationModel = "gpt-image-2-2026-04-21"
const BetaToolImageGenerationModelGPTImage1_5 BetaToolImageGenerationModel = "gpt-image-1.5"
const BetaToolImageGenerationModelChatgptImageLatest BetaToolImageGenerationModel = "chatgpt-image-latest"
Moderation stringOptional

Moderation level for the generated image. Default: auto.

One of the following:
const BetaToolImageGenerationModerationAuto BetaToolImageGenerationModeration = "auto"
const BetaToolImageGenerationModerationLow BetaToolImageGenerationModeration = "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.

One of the following:
const BetaToolImageGenerationOutputFormatPNG BetaToolImageGenerationOutputFormat = "png"
const BetaToolImageGenerationOutputFormatWebP BetaToolImageGenerationOutputFormat = "webp"
const BetaToolImageGenerationOutputFormatJPEG BetaToolImageGenerationOutputFormat = "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.

One of the following:
const BetaToolImageGenerationQualityLow BetaToolImageGenerationQuality = "low"
const BetaToolImageGenerationQualityMedium BetaToolImageGenerationQuality = "medium"
const BetaToolImageGenerationQualityHigh BetaToolImageGenerationQuality = "high"
const BetaToolImageGenerationQualityAuto BetaToolImageGenerationQuality = "auto"
Size stringOptional

The size of the generated images. For gpt-image-2 and gpt-image-2-2026-04-21, arbitrary resolutions are supported as WIDTHxHEIGHT strings, for example 1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above 2560x1440 are experimental, and the maximum supported resolution is 3840x2160. The requested size must also satisfy the model’s current pixel and edge limits. The standard sizes 1024x1024, 1536x1024, and 1024x1536 are supported by the GPT image models; auto is supported for models that allow automatic sizing. For dall-e-2, use one of 256x256, 512x512, or 1024x1024. For dall-e-3, use one of 1024x1024, 1792x1024, or 1024x1792.

One of the following:
string
string
One of the following:
const BetaToolImageGenerationSize1024x1024 BetaToolImageGenerationSize = "1024x1024"
const BetaToolImageGenerationSize1024x1536 BetaToolImageGenerationSize = "1024x1536"
const BetaToolImageGenerationSize1536x1024 BetaToolImageGenerationSize = "1536x1024"
const BetaToolImageGenerationSizeAuto BetaToolImageGenerationSize = "auto"
type BetaToolLocalShell 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 BetaFunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaFunctionShellToolAllowedCallerDirect BetaFunctionShellToolAllowedCaller = "direct"
const BetaFunctionShellToolAllowedCallerProgrammatic BetaFunctionShellToolAllowedCaller = "programmatic"
Environment BetaFunctionShellToolEnvironmentUnionOptional
One of the following:
type BetaContainerAuto struct{…}
Type ContainerAuto

Automatically creates a container for this request

FileIDs []stringOptional

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

MemoryLimit BetaContainerAutoMemoryLimitOptional

The memory limit for the container.

One of the following:
const BetaContainerAutoMemoryLimit1g BetaContainerAutoMemoryLimit = "1g"
const BetaContainerAutoMemoryLimit4g BetaContainerAutoMemoryLimit = "4g"
const BetaContainerAutoMemoryLimit16g BetaContainerAutoMemoryLimit = "16g"
const BetaContainerAutoMemoryLimit64g BetaContainerAutoMemoryLimit = "64g"
NetworkPolicy BetaContainerAutoNetworkPolicyUnionOptional

Network access policy for the container.

One of the following:
type BetaContainerNetworkPolicyDisabled struct{…}
Type Disabled

Disable outbound network access. Always disabled.

type BetaContainerNetworkPolicyAllowlist struct{…}
AllowedDomains []string

A list of allowed domains when type is allowlist.

Type Allowlist

Allow outbound network access only to specified domains. Always allowlist.

Optional domain-scoped secrets for allowlisted domains.

Domain string

The domain associated with the secret.

minLength1
Name string

The name of the secret to inject for the domain.

minLength1
Value string

The secret value to inject for the domain.

maxLength10485760
minLength1
Skills []BetaContainerAutoSkillUnionOptional

An optional list of skills referenced by id or inline data.

One of the following:
type BetaSkillReference struct{…}
SkillID string

The ID of the referenced skill.

maxLength64
minLength1
Type SkillReference

References a skill created with the /v1/skills endpoint.

Version stringOptional

Optional skill version. Use a positive integer or ‘latest’. Omit for default.

type BetaInlineSkill struct{…}
Description string

The description of the skill.

Name string

The name of the skill.

Inline skill payload

Data string

Base64-encoded skill zip bundle.

maxLength70254592
minLength1
MediaType ApplicationZip

The media type of the inline skill payload. Must be application/zip.

Type Base64

The type of the inline skill source. Must be base64.

Type Inline

Defines an inline skill for this request.

type BetaLocalEnvironment struct{…}
Type Local

Use a local computer environment.

Skills []BetaLocalSkillOptional

An optional list of skills.

Description string

The description of the skill.

Name string

The name of the skill.

Path string

The path to the directory containing the skill.

type BetaContainerReference struct{…}
ContainerID string

The ID of the referenced container.

Type ContainerReference

References a container created with the /v1/containers endpoint

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaCustomToolAllowedCallerDirect BetaCustomToolAllowedCaller = "direct"
const BetaCustomToolAllowedCallerProgrammatic BetaCustomToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this tool should be deferred and discovered via tool search.

Description stringOptional

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

Format BetaCustomToolFormatUnionOptional

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

One of the following:
type BetaCustomToolFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

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

One of the following:
const BetaCustomToolFormatGrammarSyntaxLark BetaCustomToolFormatGrammarSyntax = "lark"
const BetaCustomToolFormatGrammarSyntaxRegex BetaCustomToolFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

type BetaNamespaceTool struct{…}

Groups function/custom tools under a shared namespace.

Description string

A description of the namespace shown to the model.

minLength1
Name string

The namespace name used in tool calls (for example, crm).

minLength1
Tools []BetaNamespaceToolToolUnion

The function/custom tools available inside this namespace.

One of the following:
type BetaNamespaceToolToolFunction struct{…}
Name string
maxLength128
minLength1
Type Function
AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaNamespaceToolToolFunctionAllowedCallerDirect BetaNamespaceToolToolFunctionAllowedCaller = "direct"
const BetaNamespaceToolToolFunctionAllowedCallerProgrammatic BetaNamespaceToolToolFunctionAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this function should be deferred and discovered via tool search.

Description stringOptional
OutputSchema map[string, any]Optional

A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

Parameters anyOptional
Strict boolOptional

Whether to enforce strict parameter validation. If omitted, Responses attempts to use strict validation when the schema is compatible, and falls back to non-strict validation otherwise.

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaCustomToolAllowedCallerDirect BetaCustomToolAllowedCaller = "direct"
const BetaCustomToolAllowedCallerProgrammatic BetaCustomToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this tool should be deferred and discovered via tool search.

Description stringOptional

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

Format BetaCustomToolFormatUnionOptional

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

One of the following:
type BetaCustomToolFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

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

One of the following:
const BetaCustomToolFormatGrammarSyntaxLark BetaCustomToolFormatGrammarSyntax = "lark"
const BetaCustomToolFormatGrammarSyntaxRegex BetaCustomToolFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

Type Namespace

The type of the tool. Always namespace.

type BetaToolSearchTool struct{…}

Hosted or BYOT tool search configuration for deferred tools.

Type ToolSearch

The type of the tool. Always tool_search.

Description stringOptional

Description shown to the model for a client-executed tool search tool.

Execution BetaToolSearchToolExecutionOptional

Whether tool search is executed by the server or by the client.

One of the following:
const BetaToolSearchToolExecutionServer BetaToolSearchToolExecution = "server"
const BetaToolSearchToolExecutionClient BetaToolSearchToolExecution = "client"
Parameters anyOptional

Parameter schema for a client-executed tool search tool.

type BetaWebSearchPreviewTool struct{…}

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

Type BetaWebSearchPreviewToolType

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

One of the following:
const BetaWebSearchPreviewToolTypeWebSearchPreview BetaWebSearchPreviewToolType = "web_search_preview"
const BetaWebSearchPreviewToolTypeWebSearchPreview2025_03_11 BetaWebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContentTypes []stringOptional
One of the following:
const BetaWebSearchPreviewToolSearchContentTypeText BetaWebSearchPreviewToolSearchContentType = "text"
const BetaWebSearchPreviewToolSearchContentTypeImage BetaWebSearchPreviewToolSearchContentType = "image"
SearchContextSize BetaWebSearchPreviewToolSearchContextSizeOptional

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.

One of the following:
const BetaWebSearchPreviewToolSearchContextSizeLow BetaWebSearchPreviewToolSearchContextSize = "low"
const BetaWebSearchPreviewToolSearchContextSizeMedium BetaWebSearchPreviewToolSearchContextSize = "medium"
const BetaWebSearchPreviewToolSearchContextSizeHigh BetaWebSearchPreviewToolSearchContextSize = "high"
UserLocation BetaWebSearchPreviewToolUserLocationOptional

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 BetaApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaApplyPatchToolAllowedCallerDirect BetaApplyPatchToolAllowedCaller = "direct"
const BetaApplyPatchToolAllowedCallerProgrammatic BetaApplyPatchToolAllowedCaller = "programmatic"
Type ToolSearchOutput

The item type. Always tool_search_output.

ID stringOptional

The unique ID of this tool search output.

Agent BetaResponseToolSearchOutputItemParamAgentRespOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

CallID stringOptional

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

maxLength64
minLength1
Execution BetaResponseToolSearchOutputItemParamExecutionOptional

Whether tool search was executed by the server or by the client.

One of the following:
const BetaResponseToolSearchOutputItemParamExecutionServer BetaResponseToolSearchOutputItemParamExecution = "server"
const BetaResponseToolSearchOutputItemParamExecutionClient BetaResponseToolSearchOutputItemParamExecution = "client"
Status BetaResponseToolSearchOutputItemParamStatusOptional

The status of the tool search output.

One of the following:
const BetaResponseToolSearchOutputItemParamStatusInProgress BetaResponseToolSearchOutputItemParamStatus = "in_progress"
const BetaResponseToolSearchOutputItemParamStatusCompleted BetaResponseToolSearchOutputItemParamStatus = "completed"
const BetaResponseToolSearchOutputItemParamStatusIncomplete BetaResponseToolSearchOutputItemParamStatus = "incomplete"
type BetaResponseInputItemAdditionalTools struct{…}
Role Developer

The role that provided the additional tools. Only developer is supported.

A list of additional tools made available at this item.

One of the following:
type BetaFunctionTool 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 strict parameter validation is enforced for this function tool.

Type Function

The type of the function tool. Always function.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaFunctionToolAllowedCallerDirect BetaFunctionToolAllowedCaller = "direct"
const BetaFunctionToolAllowedCallerProgrammatic BetaFunctionToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this function is deferred and loaded via tool search.

Description stringOptional

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

OutputSchema map[string, any]Optional

A JSON schema object describing the JSON value encoded in string outputs for this function.

type BetaFileSearchTool 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 BetaFileSearchToolFiltersUnionOptional

A filter to apply.

One of the following:
type BetaFileSearchToolFiltersComparisonFilter 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 string

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
One of the following:
const BetaFileSearchToolFiltersComparisonFilterTypeEq BetaFileSearchToolFiltersComparisonFilterType = "eq"
const BetaFileSearchToolFiltersComparisonFilterTypeNe BetaFileSearchToolFiltersComparisonFilterType = "ne"
const BetaFileSearchToolFiltersComparisonFilterTypeGt BetaFileSearchToolFiltersComparisonFilterType = "gt"
const BetaFileSearchToolFiltersComparisonFilterTypeGte BetaFileSearchToolFiltersComparisonFilterType = "gte"
const BetaFileSearchToolFiltersComparisonFilterTypeLt BetaFileSearchToolFiltersComparisonFilterType = "lt"
const BetaFileSearchToolFiltersComparisonFilterTypeLte BetaFileSearchToolFiltersComparisonFilterType = "lte"
const BetaFileSearchToolFiltersComparisonFilterTypeIn BetaFileSearchToolFiltersComparisonFilterType = "in"
const BetaFileSearchToolFiltersComparisonFilterTypeNin BetaFileSearchToolFiltersComparisonFilterType = "nin"
Value BetaFileSearchToolFiltersComparisonFilterValueUnion

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

One of the following:
string
float64
bool
type BetaFileSearchToolFiltersComparisonFilterValueArray []BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion
One of the following:
string
float64
type BetaFileSearchToolFiltersCompoundFilter struct{…}

Combine multiple filters using and or or.

Filters []BetaFileSearchToolFiltersCompoundFilterFilter

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

One of the following:
type BetaFileSearchToolFiltersCompoundFilterFilter 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 string

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
One of the following:
const BetaFileSearchToolFiltersCompoundFilterFilterTypeEq BetaFileSearchToolFiltersCompoundFilterFilterType = "eq"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeNe BetaFileSearchToolFiltersCompoundFilterFilterType = "ne"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeGt BetaFileSearchToolFiltersCompoundFilterFilterType = "gt"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeGte BetaFileSearchToolFiltersCompoundFilterFilterType = "gte"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeLt BetaFileSearchToolFiltersCompoundFilterFilterType = "lt"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeLte BetaFileSearchToolFiltersCompoundFilterFilterType = "lte"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeIn BetaFileSearchToolFiltersCompoundFilterFilterType = "in"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeNin BetaFileSearchToolFiltersCompoundFilterFilterType = "nin"
Value BetaFileSearchToolFiltersCompoundFilterFilterValueUnion

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

One of the following:
string
float64
bool
type BetaFileSearchToolFiltersCompoundFilterFilterValueArray []BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion
One of the following:
string
float64
Type string

Type of operation: and or or.

One of the following:
const BetaFileSearchToolFiltersCompoundFilterTypeAnd BetaFileSearchToolFiltersCompoundFilterType = "and"
const BetaFileSearchToolFiltersCompoundFilterTypeOr BetaFileSearchToolFiltersCompoundFilterType = "or"
MaxNumResults int64Optional

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

RankingOptions BetaFileSearchToolRankingOptionsOptional

Ranking options for search.

Ranker stringOptional

The ranker to use for the file search.

One of the following:
const BetaFileSearchToolRankingOptionsRankerAuto BetaFileSearchToolRankingOptionsRanker = "auto"
const BetaFileSearchToolRankingOptionsRankerDefault2024_11_15 BetaFileSearchToolRankingOptionsRanker = "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 BetaComputerTool struct{…}

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

Type Computer

The type of the computer tool. Always computer.

type BetaComputerUsePreviewTool 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 BetaComputerUsePreviewToolEnvironment

The type of computer environment to control.

One of the following:
const BetaComputerUsePreviewToolEnvironmentWindows BetaComputerUsePreviewToolEnvironment = "windows"
const BetaComputerUsePreviewToolEnvironmentMac BetaComputerUsePreviewToolEnvironment = "mac"
const BetaComputerUsePreviewToolEnvironmentLinux BetaComputerUsePreviewToolEnvironment = "linux"
const BetaComputerUsePreviewToolEnvironmentUbuntu BetaComputerUsePreviewToolEnvironment = "ubuntu"
const BetaComputerUsePreviewToolEnvironmentBrowser BetaComputerUsePreviewToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type BetaWebSearchTool struct{…}

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

Type BetaWebSearchToolType

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

One of the following:
const BetaWebSearchToolTypeWebSearch BetaWebSearchToolType = "web_search"
const BetaWebSearchToolTypeWebSearch2025_08_26 BetaWebSearchToolType = "web_search_2025_08_26"
Filters BetaWebSearchToolFiltersOptional

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 BetaWebSearchToolSearchContextSizeOptional

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.

One of the following:
const BetaWebSearchToolSearchContextSizeLow BetaWebSearchToolSearchContextSize = "low"
const BetaWebSearchToolSearchContextSizeMedium BetaWebSearchToolSearchContextSize = "medium"
const BetaWebSearchToolSearchContextSizeHigh BetaWebSearchToolSearchContextSize = "high"
UserLocation BetaWebSearchToolUserLocationOptional

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaToolMcpAllowedCallerDirect BetaToolMcpAllowedCaller = "direct"
const BetaToolMcpAllowedCallerProgrammatic BetaToolMcpAllowedCaller = "programmatic"
AllowedTools BetaToolMcpAllowedToolsUnionOptional

List of allowed tool names or a filter object.

One of the following:
type BetaToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type BetaToolMcpAllowedToolsMcpToolFilter 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, connector_id, or tunnel_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
One of the following:
const BetaToolMcpConnectorIDConnectorDropbox BetaToolMcpConnectorID = "connector_dropbox"
const BetaToolMcpConnectorIDConnectorGmail BetaToolMcpConnectorID = "connector_gmail"
const BetaToolMcpConnectorIDConnectorGooglecalendar BetaToolMcpConnectorID = "connector_googlecalendar"
const BetaToolMcpConnectorIDConnectorGoogledrive BetaToolMcpConnectorID = "connector_googledrive"
const BetaToolMcpConnectorIDConnectorMicrosoftteams BetaToolMcpConnectorID = "connector_microsoftteams"
const BetaToolMcpConnectorIDConnectorOutlookcalendar BetaToolMcpConnectorID = "connector_outlookcalendar"
const BetaToolMcpConnectorIDConnectorOutlookemail BetaToolMcpConnectorID = "connector_outlookemail"
const BetaToolMcpConnectorIDConnectorSharepoint BetaToolMcpConnectorID = "connector_sharepoint"
DeferLoading boolOptional

Whether this MCP tool is deferred and discovered via tool search.

Headers map[string, string]Optional

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

RequireApproval BetaToolMcpRequireApprovalUnionOptional

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

One of the following:
type BetaToolMcpRequireApprovalMcpToolApprovalFilter 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 BetaToolMcpRequireApprovalMcpToolApprovalFilterAlwaysOptional

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 BetaToolMcpRequireApprovalMcpToolApprovalFilterNeverOptional

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

One of the following:
const BetaToolMcpRequireApprovalMcpToolApprovalSettingAlways BetaToolMcpRequireApprovalMcpToolApprovalSetting = "always"
const BetaToolMcpRequireApprovalMcpToolApprovalSettingNever BetaToolMcpRequireApprovalMcpToolApprovalSetting = "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, connector_id, or tunnel_id must be provided.

formaturi
TunnelID stringOptional

The Secure MCP Tunnel ID to use instead of a direct server URL. One of server_url, connector_id, or tunnel_id must be provided.

type BetaToolCodeInterpreter struct{…}

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

Container BetaToolCodeInterpreterContainerUnion

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.

One of the following:
string
type BetaToolCodeInterpreterContainerCodeInterpreterToolAuto 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.

One of the following:
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
NetworkPolicy BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionOptional

Network access policy for the container.

One of the following:
type BetaContainerNetworkPolicyDisabled struct{…}
Type Disabled

Disable outbound network access. Always disabled.

type BetaContainerNetworkPolicyAllowlist struct{…}
AllowedDomains []string

A list of allowed domains when type is allowlist.

Type Allowlist

Allow outbound network access only to specified domains. Always allowlist.

Optional domain-scoped secrets for allowlisted domains.

Domain string

The domain associated with the secret.

minLength1
Name string

The name of the secret to inject for the domain.

minLength1
Value string

The secret value to inject for the domain.

maxLength10485760
minLength1
Type CodeInterpreter

The type of the code interpreter tool. Always code_interpreter.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaToolCodeInterpreterAllowedCallerDirect BetaToolCodeInterpreterAllowedCaller = "direct"
const BetaToolCodeInterpreterAllowedCallerProgrammatic BetaToolCodeInterpreterAllowedCaller = "programmatic"
type BetaToolProgrammaticToolCalling struct{…}
Type ProgrammaticToolCalling

The type of the tool. Always programmatic_tool_calling.

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

One of the following:
const BetaToolImageGenerationActionGenerate BetaToolImageGenerationAction = "generate"
const BetaToolImageGenerationActionEdit BetaToolImageGenerationAction = "edit"
const BetaToolImageGenerationActionAuto BetaToolImageGenerationAction = "auto"
Background stringOptional

Allows to set transparency for the background of the generated image(s). This parameter is only supported for GPT image models that support transparent backgrounds. Must be one of transparent, opaque, or auto (default value). When auto is used, the model will automatically determine the best background for the image.

gpt-image-2 and gpt-image-2-2026-04-21 do not support transparent backgrounds. Requests with background set to transparent will return an error for these models; use opaque or auto instead.

If transparent, the output format needs to support transparency, so it should be set to either png (default value) or webp.

One of the following:
const BetaToolImageGenerationBackgroundTransparent BetaToolImageGenerationBackground = "transparent"
const BetaToolImageGenerationBackgroundOpaque BetaToolImageGenerationBackground = "opaque"
const BetaToolImageGenerationBackgroundAuto BetaToolImageGenerationBackground = "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.

One of the following:
const BetaToolImageGenerationInputFidelityHigh BetaToolImageGenerationInputFidelity = "high"
const BetaToolImageGenerationInputFidelityLow BetaToolImageGenerationInputFidelity = "low"
InputImageMask BetaToolImageGenerationInputImageMaskOptional

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.

One of the following:
string
string
One of the following:
const BetaToolImageGenerationModelGPTImage1 BetaToolImageGenerationModel = "gpt-image-1"
const BetaToolImageGenerationModelGPTImage1Mini BetaToolImageGenerationModel = "gpt-image-1-mini"
const BetaToolImageGenerationModelGPTImage2 BetaToolImageGenerationModel = "gpt-image-2"
const BetaToolImageGenerationModelGPTImage2_2026_04_21 BetaToolImageGenerationModel = "gpt-image-2-2026-04-21"
const BetaToolImageGenerationModelGPTImage1_5 BetaToolImageGenerationModel = "gpt-image-1.5"
const BetaToolImageGenerationModelChatgptImageLatest BetaToolImageGenerationModel = "chatgpt-image-latest"
Moderation stringOptional

Moderation level for the generated image. Default: auto.

One of the following:
const BetaToolImageGenerationModerationAuto BetaToolImageGenerationModeration = "auto"
const BetaToolImageGenerationModerationLow BetaToolImageGenerationModeration = "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.

One of the following:
const BetaToolImageGenerationOutputFormatPNG BetaToolImageGenerationOutputFormat = "png"
const BetaToolImageGenerationOutputFormatWebP BetaToolImageGenerationOutputFormat = "webp"
const BetaToolImageGenerationOutputFormatJPEG BetaToolImageGenerationOutputFormat = "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.

One of the following:
const BetaToolImageGenerationQualityLow BetaToolImageGenerationQuality = "low"
const BetaToolImageGenerationQualityMedium BetaToolImageGenerationQuality = "medium"
const BetaToolImageGenerationQualityHigh BetaToolImageGenerationQuality = "high"
const BetaToolImageGenerationQualityAuto BetaToolImageGenerationQuality = "auto"
Size stringOptional

The size of the generated images. For gpt-image-2 and gpt-image-2-2026-04-21, arbitrary resolutions are supported as WIDTHxHEIGHT strings, for example 1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above 2560x1440 are experimental, and the maximum supported resolution is 3840x2160. The requested size must also satisfy the model’s current pixel and edge limits. The standard sizes 1024x1024, 1536x1024, and 1024x1536 are supported by the GPT image models; auto is supported for models that allow automatic sizing. For dall-e-2, use one of 256x256, 512x512, or 1024x1024. For dall-e-3, use one of 1024x1024, 1792x1024, or 1024x1792.

One of the following:
string
string
One of the following:
const BetaToolImageGenerationSize1024x1024 BetaToolImageGenerationSize = "1024x1024"
const BetaToolImageGenerationSize1024x1536 BetaToolImageGenerationSize = "1024x1536"
const BetaToolImageGenerationSize1536x1024 BetaToolImageGenerationSize = "1536x1024"
const BetaToolImageGenerationSizeAuto BetaToolImageGenerationSize = "auto"
type BetaToolLocalShell 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 BetaFunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaFunctionShellToolAllowedCallerDirect BetaFunctionShellToolAllowedCaller = "direct"
const BetaFunctionShellToolAllowedCallerProgrammatic BetaFunctionShellToolAllowedCaller = "programmatic"
Environment BetaFunctionShellToolEnvironmentUnionOptional
One of the following:
type BetaContainerAuto struct{…}
Type ContainerAuto

Automatically creates a container for this request

FileIDs []stringOptional

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

MemoryLimit BetaContainerAutoMemoryLimitOptional

The memory limit for the container.

One of the following:
const BetaContainerAutoMemoryLimit1g BetaContainerAutoMemoryLimit = "1g"
const BetaContainerAutoMemoryLimit4g BetaContainerAutoMemoryLimit = "4g"
const BetaContainerAutoMemoryLimit16g BetaContainerAutoMemoryLimit = "16g"
const BetaContainerAutoMemoryLimit64g BetaContainerAutoMemoryLimit = "64g"
NetworkPolicy BetaContainerAutoNetworkPolicyUnionOptional

Network access policy for the container.

One of the following:
type BetaContainerNetworkPolicyDisabled struct{…}
Type Disabled

Disable outbound network access. Always disabled.

type BetaContainerNetworkPolicyAllowlist struct{…}
AllowedDomains []string

A list of allowed domains when type is allowlist.

Type Allowlist

Allow outbound network access only to specified domains. Always allowlist.

Optional domain-scoped secrets for allowlisted domains.

Domain string

The domain associated with the secret.

minLength1
Name string

The name of the secret to inject for the domain.

minLength1
Value string

The secret value to inject for the domain.

maxLength10485760
minLength1
Skills []BetaContainerAutoSkillUnionOptional

An optional list of skills referenced by id or inline data.

One of the following:
type BetaSkillReference struct{…}
SkillID string

The ID of the referenced skill.

maxLength64
minLength1
Type SkillReference

References a skill created with the /v1/skills endpoint.

Version stringOptional

Optional skill version. Use a positive integer or ‘latest’. Omit for default.

type BetaInlineSkill struct{…}
Description string

The description of the skill.

Name string

The name of the skill.

Inline skill payload

Data string

Base64-encoded skill zip bundle.

maxLength70254592
minLength1
MediaType ApplicationZip

The media type of the inline skill payload. Must be application/zip.

Type Base64

The type of the inline skill source. Must be base64.

Type Inline

Defines an inline skill for this request.

type BetaLocalEnvironment struct{…}
Type Local

Use a local computer environment.

Skills []BetaLocalSkillOptional

An optional list of skills.

Description string

The description of the skill.

Name string

The name of the skill.

Path string

The path to the directory containing the skill.

type BetaContainerReference struct{…}
ContainerID string

The ID of the referenced container.

Type ContainerReference

References a container created with the /v1/containers endpoint

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaCustomToolAllowedCallerDirect BetaCustomToolAllowedCaller = "direct"
const BetaCustomToolAllowedCallerProgrammatic BetaCustomToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this tool should be deferred and discovered via tool search.

Description stringOptional

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

Format BetaCustomToolFormatUnionOptional

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

One of the following:
type BetaCustomToolFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

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

One of the following:
const BetaCustomToolFormatGrammarSyntaxLark BetaCustomToolFormatGrammarSyntax = "lark"
const BetaCustomToolFormatGrammarSyntaxRegex BetaCustomToolFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

type BetaNamespaceTool struct{…}

Groups function/custom tools under a shared namespace.

Description string

A description of the namespace shown to the model.

minLength1
Name string

The namespace name used in tool calls (for example, crm).

minLength1
Tools []BetaNamespaceToolToolUnion

The function/custom tools available inside this namespace.

One of the following:
type BetaNamespaceToolToolFunction struct{…}
Name string
maxLength128
minLength1
Type Function
AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaNamespaceToolToolFunctionAllowedCallerDirect BetaNamespaceToolToolFunctionAllowedCaller = "direct"
const BetaNamespaceToolToolFunctionAllowedCallerProgrammatic BetaNamespaceToolToolFunctionAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this function should be deferred and discovered via tool search.

Description stringOptional
OutputSchema map[string, any]Optional

A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

Parameters anyOptional
Strict boolOptional

Whether to enforce strict parameter validation. If omitted, Responses attempts to use strict validation when the schema is compatible, and falls back to non-strict validation otherwise.

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaCustomToolAllowedCallerDirect BetaCustomToolAllowedCaller = "direct"
const BetaCustomToolAllowedCallerProgrammatic BetaCustomToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this tool should be deferred and discovered via tool search.

Description stringOptional

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

Format BetaCustomToolFormatUnionOptional

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

One of the following:
type BetaCustomToolFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

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

One of the following:
const BetaCustomToolFormatGrammarSyntaxLark BetaCustomToolFormatGrammarSyntax = "lark"
const BetaCustomToolFormatGrammarSyntaxRegex BetaCustomToolFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

Type Namespace

The type of the tool. Always namespace.

type BetaToolSearchTool struct{…}

Hosted or BYOT tool search configuration for deferred tools.

Type ToolSearch

The type of the tool. Always tool_search.

Description stringOptional

Description shown to the model for a client-executed tool search tool.

Execution BetaToolSearchToolExecutionOptional

Whether tool search is executed by the server or by the client.

One of the following:
const BetaToolSearchToolExecutionServer BetaToolSearchToolExecution = "server"
const BetaToolSearchToolExecutionClient BetaToolSearchToolExecution = "client"
Parameters anyOptional

Parameter schema for a client-executed tool search tool.

type BetaWebSearchPreviewTool struct{…}

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

Type BetaWebSearchPreviewToolType

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

One of the following:
const BetaWebSearchPreviewToolTypeWebSearchPreview BetaWebSearchPreviewToolType = "web_search_preview"
const BetaWebSearchPreviewToolTypeWebSearchPreview2025_03_11 BetaWebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContentTypes []stringOptional
One of the following:
const BetaWebSearchPreviewToolSearchContentTypeText BetaWebSearchPreviewToolSearchContentType = "text"
const BetaWebSearchPreviewToolSearchContentTypeImage BetaWebSearchPreviewToolSearchContentType = "image"
SearchContextSize BetaWebSearchPreviewToolSearchContextSizeOptional

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.

One of the following:
const BetaWebSearchPreviewToolSearchContextSizeLow BetaWebSearchPreviewToolSearchContextSize = "low"
const BetaWebSearchPreviewToolSearchContextSizeMedium BetaWebSearchPreviewToolSearchContextSize = "medium"
const BetaWebSearchPreviewToolSearchContextSizeHigh BetaWebSearchPreviewToolSearchContextSize = "high"
UserLocation BetaWebSearchPreviewToolUserLocationOptional

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 BetaApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaApplyPatchToolAllowedCallerDirect BetaApplyPatchToolAllowedCaller = "direct"
const BetaApplyPatchToolAllowedCallerProgrammatic BetaApplyPatchToolAllowedCaller = "programmatic"
Type AdditionalTools

The item type. Always additional_tools.

ID stringOptional

The unique ID of this additional tools item.

Agent BetaResponseInputItemAdditionalToolsAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseReasoningItem 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 []BetaResponseReasoningItemSummary

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.

Agent BetaResponseReasoningItemAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Content []BetaResponseReasoningItemContentOptional

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. This is populated by default for reasoning items returned by POST /v1/responses and WebSocket response.create requests.

Status BetaResponseReasoningItemStatusOptional

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

One of the following:
const BetaResponseReasoningItemStatusInProgress BetaResponseReasoningItemStatus = "in_progress"
const BetaResponseReasoningItemStatusCompleted BetaResponseReasoningItemStatus = "completed"
const BetaResponseReasoningItemStatusIncomplete BetaResponseReasoningItemStatus = "incomplete"
type BetaResponseCompactionItemParamResp 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.

Agent BetaResponseCompactionItemParamAgentRespOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

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

One of the following:
const BetaResponseInputItemImageGenerationCallStatusInProgress BetaResponseInputItemImageGenerationCallStatus = "in_progress"
const BetaResponseInputItemImageGenerationCallStatusCompleted BetaResponseInputItemImageGenerationCallStatus = "completed"
const BetaResponseInputItemImageGenerationCallStatusGenerating BetaResponseInputItemImageGenerationCallStatus = "generating"
const BetaResponseInputItemImageGenerationCallStatusFailed BetaResponseInputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

Agent BetaResponseInputItemImageGenerationCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseCodeInterpreterToolCall 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 []BetaResponseCodeInterpreterToolCallOutputUnion

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

One of the following:
type BetaResponseCodeInterpreterToolCallOutputLogs 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 BetaResponseCodeInterpreterToolCallOutputImage 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.

formaturi
Status BetaResponseCodeInterpreterToolCallStatus

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

One of the following:
const BetaResponseCodeInterpreterToolCallStatusInProgress BetaResponseCodeInterpreterToolCallStatus = "in_progress"
const BetaResponseCodeInterpreterToolCallStatusCompleted BetaResponseCodeInterpreterToolCallStatus = "completed"
const BetaResponseCodeInterpreterToolCallStatusIncomplete BetaResponseCodeInterpreterToolCallStatus = "incomplete"
const BetaResponseCodeInterpreterToolCallStatusInterpreting BetaResponseCodeInterpreterToolCallStatus = "interpreting"
const BetaResponseCodeInterpreterToolCallStatusFailed BetaResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

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

Agent BetaResponseCodeInterpreterToolCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseInputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action BetaResponseInputItemLocalShellCallAction

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.

One of the following:
const BetaResponseInputItemLocalShellCallStatusInProgress BetaResponseInputItemLocalShellCallStatus = "in_progress"
const BetaResponseInputItemLocalShellCallStatusCompleted BetaResponseInputItemLocalShellCallStatus = "completed"
const BetaResponseInputItemLocalShellCallStatusIncomplete BetaResponseInputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

Agent BetaResponseInputItemLocalShellCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

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

Agent BetaResponseInputItemLocalShellCallOutputAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Status stringOptional

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

One of the following:
const BetaResponseInputItemLocalShellCallOutputStatusInProgress BetaResponseInputItemLocalShellCallOutputStatus = "in_progress"
const BetaResponseInputItemLocalShellCallOutputStatusCompleted BetaResponseInputItemLocalShellCallOutputStatus = "completed"
const BetaResponseInputItemLocalShellCallOutputStatusIncomplete BetaResponseInputItemLocalShellCallOutputStatus = "incomplete"
type BetaResponseInputItemShellCall struct{…}

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

Action BetaResponseInputItemShellCallAction

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.

Agent BetaResponseInputItemShellCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseInputItemShellCallCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseInputItemShellCallCallerDirect struct{…}
Type Direct

The caller type. Always direct.

type BetaResponseInputItemShellCallCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

maxLength64
minLength1
Type Program

The caller type. Always program.

Environment BetaResponseInputItemShellCallEnvironmentUnionOptional

The environment to execute the shell commands in.

One of the following:
type BetaLocalEnvironment struct{…}
Type Local

Use a local computer environment.

Skills []BetaLocalSkillOptional

An optional list of skills.

Description string

The description of the skill.

Name string

The name of the skill.

Path string

The path to the directory containing the skill.

type BetaContainerReference struct{…}
ContainerID string

The ID of the referenced container.

Type ContainerReference

References a container created with the /v1/containers endpoint

Status stringOptional

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

One of the following:
const BetaResponseInputItemShellCallStatusInProgress BetaResponseInputItemShellCallStatus = "in_progress"
const BetaResponseInputItemShellCallStatusCompleted BetaResponseInputItemShellCallStatus = "completed"
const BetaResponseInputItemShellCallStatusIncomplete BetaResponseInputItemShellCallStatus = "incomplete"
type BetaResponseInputItemShellCallOutput 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 BetaResponseFunctionShellCallOutputContentOutcomeUnion

The exit or timeout outcome associated with this shell call.

One of the following:
type BetaResponseFunctionShellCallOutputContentOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

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

Agent BetaResponseInputItemShellCallOutputAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseInputItemShellCallOutputCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseInputItemShellCallOutputCallerDirect struct{…}
Type Direct

The caller type. Always direct.

type BetaResponseInputItemShellCallOutputCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

maxLength64
minLength1
Type Program

The caller type. Always program.

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.

One of the following:
const BetaResponseInputItemShellCallOutputStatusInProgress BetaResponseInputItemShellCallOutputStatus = "in_progress"
const BetaResponseInputItemShellCallOutputStatusCompleted BetaResponseInputItemShellCallOutputStatus = "completed"
const BetaResponseInputItemShellCallOutputStatusIncomplete BetaResponseInputItemShellCallOutputStatus = "incomplete"
type BetaResponseInputItemApplyPatchCall 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 BetaResponseInputItemApplyPatchCallOperationUnion

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

One of the following:
type BetaResponseInputItemApplyPatchCallOperationCreateFile 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 BetaResponseInputItemApplyPatchCallOperationDeleteFile 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 BetaResponseInputItemApplyPatchCallOperationUpdateFile 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.

One of the following:
const BetaResponseInputItemApplyPatchCallStatusInProgress BetaResponseInputItemApplyPatchCallStatus = "in_progress"
const BetaResponseInputItemApplyPatchCallStatusCompleted BetaResponseInputItemApplyPatchCallStatus = "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.

Agent BetaResponseInputItemApplyPatchCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseInputItemApplyPatchCallCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseInputItemApplyPatchCallCallerDirect struct{…}
Type Direct

The caller type. Always direct.

type BetaResponseInputItemApplyPatchCallCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

maxLength64
minLength1
Type Program

The caller type. Always program.

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

One of the following:
const BetaResponseInputItemApplyPatchCallOutputStatusCompleted BetaResponseInputItemApplyPatchCallOutputStatus = "completed"
const BetaResponseInputItemApplyPatchCallOutputStatusFailed BetaResponseInputItemApplyPatchCallOutputStatus = "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.

Agent BetaResponseInputItemApplyPatchCallOutputAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseInputItemApplyPatchCallOutputCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseInputItemApplyPatchCallOutputCallerDirect struct{…}
Type Direct

The caller type. Always direct.

type BetaResponseInputItemApplyPatchCallOutputCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

maxLength64
minLength1
Type Program

The caller type. Always program.

Output stringOptional

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

maxLength10485760
type BetaResponseInputItemMcpListTools 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 []BetaResponseInputItemMcpListToolsTool

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.

Agent BetaResponseInputItemMcpListToolsAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Error stringOptional

Error message if the server could not list tools.

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

Agent BetaResponseInputItemMcpApprovalRequestAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseInputItemMcpApprovalResponse 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

Agent BetaResponseInputItemMcpApprovalResponseAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Reason stringOptional

Optional reason for the decision.

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

Agent BetaResponseInputItemMcpCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

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.

One of the following:
const BetaResponseInputItemMcpCallStatusInProgress BetaResponseInputItemMcpCallStatus = "in_progress"
const BetaResponseInputItemMcpCallStatusCompleted BetaResponseInputItemMcpCallStatus = "completed"
const BetaResponseInputItemMcpCallStatusIncomplete BetaResponseInputItemMcpCallStatus = "incomplete"
const BetaResponseInputItemMcpCallStatusCalling BetaResponseInputItemMcpCallStatus = "calling"
const BetaResponseInputItemMcpCallStatusFailed BetaResponseInputItemMcpCallStatus = "failed"
type BetaResponseCustomToolCallOutput 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 BetaResponseCustomToolCallOutputOutputUnion

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

One of the following:
string
type BetaResponseCustomToolCallOutputOutputOutputContentList []BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion

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

One of the following:
type BetaResponseInputText 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.

PromptCacheBreakpoint BetaResponseInputTextPromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputImage struct{…}

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

Detail BetaResponseInputImageDetail

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

One of the following:
const BetaResponseInputImageDetailLow BetaResponseInputImageDetail = "low"
const BetaResponseInputImageDetailHigh BetaResponseInputImageDetail = "high"
const BetaResponseInputImageDetailAuto BetaResponseInputImageDetail = "auto"
const BetaResponseInputImageDetailOriginal BetaResponseInputImageDetail = "original"
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.

formaturi
PromptCacheBreakpoint BetaResponseInputImagePromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

Detail BetaResponseInputFileDetailOptional

The detail level of the file to be sent to the model. Use auto to let the system select the detail level; for GPT-5.6 and later models, auto uses high-quality rendering, which may increase input token usage. Use low for lower-cost rendering, or high to render the file at higher quality. Defaults to auto.

One of the following:
const BetaResponseInputFileDetailAuto BetaResponseInputFileDetail = "auto"
const BetaResponseInputFileDetailLow BetaResponseInputFileDetail = "low"
const BetaResponseInputFileDetailHigh BetaResponseInputFileDetail = "high"
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.

formaturi
Filename stringOptional

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

PromptCacheBreakpoint BetaResponseInputFilePromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

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.

Agent BetaResponseCustomToolCallOutputAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseCustomToolCallOutputCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseCustomToolCallOutputCallerDirect struct{…}
Type Direct

The caller type. Always direct.

type BetaResponseCustomToolCallOutputCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

maxLength64
minLength1
Type Program

The caller type. Always program.

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

Agent BetaResponseCustomToolCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseCustomToolCallCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseCustomToolCallCallerDirect struct{…}
Type Direct
type BetaResponseCustomToolCallCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

Type Program
Namespace stringOptional

The namespace of the custom tool being called.

type BetaResponseInputItemCompactionTrigger struct{…}

Compacts the current context. Must be the final input item.

Type CompactionTrigger

The type of the item. Always compaction_trigger.

Agent BetaResponseInputItemCompactionTriggerAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseInputItemItemReference struct{…}

An internal identifier for an item to reference.

ID string

The ID of the item to reference.

Agent BetaResponseInputItemItemReferenceAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Type stringOptional

The type of item to reference. Always item_reference.

type BetaResponseInputItemProgram struct{…}
ID string

The unique ID of this program item.

CallID string

The stable call ID of the program item.

maxLength64
minLength1
Code string

The JavaScript source executed by programmatic tool calling.

maxLength10485760
Fingerprint string

Opaque program replay fingerprint that must be round-tripped.

maxLength10485760
Type Program

The item type. Always program.

Agent BetaResponseInputItemProgramAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseInputItemProgramOutput struct{…}
ID string

The unique ID of this program output item.

CallID string

The call ID of the program item.

maxLength64
minLength1
Result string

The result produced by the program item.

maxLength10485760
Status string

The terminal status of the program output.

One of the following:
const BetaResponseInputItemProgramOutputStatusCompleted BetaResponseInputItemProgramOutputStatus = "completed"
const BetaResponseInputItemProgramOutputStatusIncomplete BetaResponseInputItemProgramOutputStatus = "incomplete"
Type ProgramOutput

The item type. Always program_output.

Agent BetaResponseInputItemProgramOutputAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Metadata map[string, string]

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 BetaResponseModel

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.

One of the following:
type BetaResponseModel string

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.

One of the following:
const BetaResponseModelGPT5_6Sol BetaResponseModel = "gpt-5.6-sol"
const BetaResponseModelGPT5_6Terra BetaResponseModel = "gpt-5.6-terra"
const BetaResponseModelGPT5_6Luna BetaResponseModel = "gpt-5.6-luna"
const BetaResponseModelGPT5_4 BetaResponseModel = "gpt-5.4"
const BetaResponseModelGPT5_4Mini BetaResponseModel = "gpt-5.4-mini"
const BetaResponseModelGPT5_4Nano BetaResponseModel = "gpt-5.4-nano"
const BetaResponseModelGPT5_4Mini2026_03_17 BetaResponseModel = "gpt-5.4-mini-2026-03-17"
const BetaResponseModelGPT5_4Nano2026_03_17 BetaResponseModel = "gpt-5.4-nano-2026-03-17"
const BetaResponseModelGPT5_3ChatLatest BetaResponseModel = "gpt-5.3-chat-latest"
const BetaResponseModelGPT5_2 BetaResponseModel = "gpt-5.2"
const BetaResponseModelGPT5_2_2025_12_11 BetaResponseModel = "gpt-5.2-2025-12-11"
const BetaResponseModelGPT5_2ChatLatest BetaResponseModel = "gpt-5.2-chat-latest"
const BetaResponseModelGPT5_2Pro BetaResponseModel = "gpt-5.2-pro"
const BetaResponseModelGPT5_2Pro2025_12_11 BetaResponseModel = "gpt-5.2-pro-2025-12-11"
const BetaResponseModelGPT5_1 BetaResponseModel = "gpt-5.1"
const BetaResponseModelGPT5_1_2025_11_13 BetaResponseModel = "gpt-5.1-2025-11-13"
const BetaResponseModelGPT5_1Codex BetaResponseModel = "gpt-5.1-codex"
const BetaResponseModelGPT5_1Mini BetaResponseModel = "gpt-5.1-mini"
const BetaResponseModelGPT5_1ChatLatest BetaResponseModel = "gpt-5.1-chat-latest"
const BetaResponseModelGPT5 BetaResponseModel = "gpt-5"
const BetaResponseModelGPT5Mini BetaResponseModel = "gpt-5-mini"
const BetaResponseModelGPT5Nano BetaResponseModel = "gpt-5-nano"
const BetaResponseModelGPT5_2025_08_07 BetaResponseModel = "gpt-5-2025-08-07"
const BetaResponseModelGPT5Mini2025_08_07 BetaResponseModel = "gpt-5-mini-2025-08-07"
const BetaResponseModelGPT5Nano2025_08_07 BetaResponseModel = "gpt-5-nano-2025-08-07"
const BetaResponseModelGPT5ChatLatest BetaResponseModel = "gpt-5-chat-latest"
const BetaResponseModelGPT4_1 BetaResponseModel = "gpt-4.1"
const BetaResponseModelGPT4_1Mini BetaResponseModel = "gpt-4.1-mini"
const BetaResponseModelGPT4_1Nano BetaResponseModel = "gpt-4.1-nano"
const BetaResponseModelGPT4_1_2025_04_14 BetaResponseModel = "gpt-4.1-2025-04-14"
const BetaResponseModelGPT4_1Mini2025_04_14 BetaResponseModel = "gpt-4.1-mini-2025-04-14"
const BetaResponseModelGPT4_1Nano2025_04_14 BetaResponseModel = "gpt-4.1-nano-2025-04-14"
const BetaResponseModelO4Mini BetaResponseModel = "o4-mini"
const BetaResponseModelO4Mini2025_04_16 BetaResponseModel = "o4-mini-2025-04-16"
const BetaResponseModelO3 BetaResponseModel = "o3"
const BetaResponseModelO3_2025_04_16 BetaResponseModel = "o3-2025-04-16"
const BetaResponseModelO3Mini BetaResponseModel = "o3-mini"
const BetaResponseModelO3Mini2025_01_31 BetaResponseModel = "o3-mini-2025-01-31"
const BetaResponseModelO1 BetaResponseModel = "o1"
const BetaResponseModelO1_2024_12_17 BetaResponseModel = "o1-2024-12-17"
const BetaResponseModelO1Preview BetaResponseModel = "o1-preview"
const BetaResponseModelO1Preview2024_09_12 BetaResponseModel = "o1-preview-2024-09-12"
const BetaResponseModelO1Mini BetaResponseModel = "o1-mini"
const BetaResponseModelO1Mini2024_09_12 BetaResponseModel = "o1-mini-2024-09-12"
const BetaResponseModelGPT4o BetaResponseModel = "gpt-4o"
const BetaResponseModelGPT4o2024_11_20 BetaResponseModel = "gpt-4o-2024-11-20"
const BetaResponseModelGPT4o2024_08_06 BetaResponseModel = "gpt-4o-2024-08-06"
const BetaResponseModelGPT4o2024_05_13 BetaResponseModel = "gpt-4o-2024-05-13"
const BetaResponseModelGPT4oAudioPreview BetaResponseModel = "gpt-4o-audio-preview"
const BetaResponseModelGPT4oAudioPreview2024_10_01 BetaResponseModel = "gpt-4o-audio-preview-2024-10-01"
const BetaResponseModelGPT4oAudioPreview2024_12_17 BetaResponseModel = "gpt-4o-audio-preview-2024-12-17"
const BetaResponseModelGPT4oAudioPreview2025_06_03 BetaResponseModel = "gpt-4o-audio-preview-2025-06-03"
const BetaResponseModelGPT4oMiniAudioPreview BetaResponseModel = "gpt-4o-mini-audio-preview"
const BetaResponseModelGPT4oMiniAudioPreview2024_12_17 BetaResponseModel = "gpt-4o-mini-audio-preview-2024-12-17"
const BetaResponseModelGPT4oSearchPreview BetaResponseModel = "gpt-4o-search-preview"
const BetaResponseModelGPT4oMiniSearchPreview BetaResponseModel = "gpt-4o-mini-search-preview"
const BetaResponseModelGPT4oSearchPreview2025_03_11 BetaResponseModel = "gpt-4o-search-preview-2025-03-11"
const BetaResponseModelGPT4oMiniSearchPreview2025_03_11 BetaResponseModel = "gpt-4o-mini-search-preview-2025-03-11"
const BetaResponseModelChatgpt4oLatest BetaResponseModel = "chatgpt-4o-latest"
const BetaResponseModelCodexMiniLatest BetaResponseModel = "codex-mini-latest"
const BetaResponseModelGPT4oMini BetaResponseModel = "gpt-4o-mini"
const BetaResponseModelGPT4oMini2024_07_18 BetaResponseModel = "gpt-4o-mini-2024-07-18"
const BetaResponseModelGPT4Turbo BetaResponseModel = "gpt-4-turbo"
const BetaResponseModelGPT4Turbo2024_04_09 BetaResponseModel = "gpt-4-turbo-2024-04-09"
const BetaResponseModelGPT4_0125Preview BetaResponseModel = "gpt-4-0125-preview"
const BetaResponseModelGPT4TurboPreview BetaResponseModel = "gpt-4-turbo-preview"
const BetaResponseModelGPT4_1106Preview BetaResponseModel = "gpt-4-1106-preview"
const BetaResponseModelGPT4VisionPreview BetaResponseModel = "gpt-4-vision-preview"
const BetaResponseModelGPT4 BetaResponseModel = "gpt-4"
const BetaResponseModelGPT4_0314 BetaResponseModel = "gpt-4-0314"
const BetaResponseModelGPT4_0613 BetaResponseModel = "gpt-4-0613"
const BetaResponseModelGPT4_32k BetaResponseModel = "gpt-4-32k"
const BetaResponseModelGPT4_32k0314 BetaResponseModel = "gpt-4-32k-0314"
const BetaResponseModelGPT4_32k0613 BetaResponseModel = "gpt-4-32k-0613"
const BetaResponseModelGPT3_5Turbo BetaResponseModel = "gpt-3.5-turbo"
const BetaResponseModelGPT3_5Turbo16k BetaResponseModel = "gpt-3.5-turbo-16k"
const BetaResponseModelGPT3_5Turbo0301 BetaResponseModel = "gpt-3.5-turbo-0301"
const BetaResponseModelGPT3_5Turbo0613 BetaResponseModel = "gpt-3.5-turbo-0613"
const BetaResponseModelGPT3_5Turbo1106 BetaResponseModel = "gpt-3.5-turbo-1106"
const BetaResponseModelGPT3_5Turbo0125 BetaResponseModel = "gpt-3.5-turbo-0125"
const BetaResponseModelGPT3_5Turbo16k0613 BetaResponseModel = "gpt-3.5-turbo-16k-0613"
const BetaResponseModelO1Pro BetaResponseModel = "o1-pro"
const BetaResponseModelO1Pro2025_03_19 BetaResponseModel = "o1-pro-2025-03-19"
const BetaResponseModelO3Pro BetaResponseModel = "o3-pro"
const BetaResponseModelO3Pro2025_06_10 BetaResponseModel = "o3-pro-2025-06-10"
const BetaResponseModelO3DeepResearch BetaResponseModel = "o3-deep-research"
const BetaResponseModelO3DeepResearch2025_06_26 BetaResponseModel = "o3-deep-research-2025-06-26"
const BetaResponseModelO4MiniDeepResearch BetaResponseModel = "o4-mini-deep-research"
const BetaResponseModelO4MiniDeepResearch2025_06_26 BetaResponseModel = "o4-mini-deep-research-2025-06-26"
const BetaResponseModelComputerUsePreview BetaResponseModel = "computer-use-preview"
const BetaResponseModelComputerUsePreview2025_03_11 BetaResponseModel = "computer-use-preview-2025-03-11"
const BetaResponseModelGPT5Codex BetaResponseModel = "gpt-5-codex"
const BetaResponseModelGPT5Pro BetaResponseModel = "gpt-5-pro"
const BetaResponseModelGPT5Pro2025_10_06 BetaResponseModel = "gpt-5-pro-2025-10-06"
const BetaResponseModelGPT5_1CodexMax BetaResponseModel = "gpt-5.1-codex-max"
string
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.
One of the following:
type BetaResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []BetaResponseOutputMessageContentUnion

The content of the output message.

One of the following:
type BetaResponseOutputText struct{…}

A text output from the model.

Annotations []BetaResponseOutputTextAnnotationUnion

The annotations of the text output.

One of the following:
type BetaResponseOutputTextAnnotationFileCitation 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 BetaResponseOutputTextAnnotationURLCitation 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.

formaturi
type BetaResponseOutputTextAnnotationContainerFileCitation 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 BetaResponseOutputTextAnnotationFilePath 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 []BetaResponseOutputTextLogprobOptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []BetaResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type BetaResponseOutputRefusal 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 BetaResponseOutputMessageStatus

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

One of the following:
const BetaResponseOutputMessageStatusInProgress BetaResponseOutputMessageStatus = "in_progress"
const BetaResponseOutputMessageStatusCompleted BetaResponseOutputMessageStatus = "completed"
const BetaResponseOutputMessageStatusIncomplete BetaResponseOutputMessageStatus = "incomplete"
Type Message

The type of the output message. Always message.

Agent BetaResponseOutputMessageAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Phase BetaResponseOutputMessagePhaseOptional

Labels an assistant message as intermediate commentary (commentary) or the final answer (final_answer). For models like gpt-5.3-codex and beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.

One of the following:
const BetaResponseOutputMessagePhaseCommentary BetaResponseOutputMessagePhase = "commentary"
const BetaResponseOutputMessagePhaseFinalAnswer BetaResponseOutputMessagePhase = "final_answer"
type BetaResponseFileSearchToolCall 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 BetaResponseFileSearchToolCallStatus

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

One of the following:
const BetaResponseFileSearchToolCallStatusInProgress BetaResponseFileSearchToolCallStatus = "in_progress"
const BetaResponseFileSearchToolCallStatusSearching BetaResponseFileSearchToolCallStatus = "searching"
const BetaResponseFileSearchToolCallStatusCompleted BetaResponseFileSearchToolCallStatus = "completed"
const BetaResponseFileSearchToolCallStatusIncomplete BetaResponseFileSearchToolCallStatus = "incomplete"
const BetaResponseFileSearchToolCallStatusFailed BetaResponseFileSearchToolCallStatus = "failed"
Type FileSearchCall

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

Agent BetaResponseFileSearchToolCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Results []BetaResponseFileSearchToolCallResultOptional

The results of the file search tool call.

Attributes map[string, BetaResponseFileSearchToolCallResultAttributeUnion]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.

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

Agent BetaResponseFunctionToolCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseFunctionToolCallCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseFunctionToolCallCallerDirect struct{…}
Type Direct
type BetaResponseFunctionToolCallCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

Type Program
Namespace stringOptional

The namespace of the function to run.

Status BetaResponseFunctionToolCallStatusOptional

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

One of the following:
const BetaResponseFunctionToolCallStatusInProgress BetaResponseFunctionToolCallStatus = "in_progress"
const BetaResponseFunctionToolCallStatusCompleted BetaResponseFunctionToolCallStatus = "completed"
const BetaResponseFunctionToolCallStatusIncomplete BetaResponseFunctionToolCallStatus = "incomplete"
type BetaResponseFunctionToolCallOutputItem struct{…}
ID string

The unique ID of the function call tool output.

CallID string

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

Output BetaResponseFunctionToolCallOutputItemOutputUnion

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

One of the following:
string
type BetaResponseFunctionToolCallOutputItemOutputOutputContentList []BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion

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

One of the following:
type BetaResponseInputText 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.

PromptCacheBreakpoint BetaResponseInputTextPromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputImage struct{…}

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

Detail BetaResponseInputImageDetail

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

One of the following:
const BetaResponseInputImageDetailLow BetaResponseInputImageDetail = "low"
const BetaResponseInputImageDetailHigh BetaResponseInputImageDetail = "high"
const BetaResponseInputImageDetailAuto BetaResponseInputImageDetail = "auto"
const BetaResponseInputImageDetailOriginal BetaResponseInputImageDetail = "original"
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.

formaturi
PromptCacheBreakpoint BetaResponseInputImagePromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

Detail BetaResponseInputFileDetailOptional

The detail level of the file to be sent to the model. Use auto to let the system select the detail level; for GPT-5.6 and later models, auto uses high-quality rendering, which may increase input token usage. Use low for lower-cost rendering, or high to render the file at higher quality. Defaults to auto.

One of the following:
const BetaResponseInputFileDetailAuto BetaResponseInputFileDetail = "auto"
const BetaResponseInputFileDetailLow BetaResponseInputFileDetail = "low"
const BetaResponseInputFileDetailHigh BetaResponseInputFileDetail = "high"
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.

formaturi
Filename stringOptional

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

PromptCacheBreakpoint BetaResponseInputFilePromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

Status BetaResponseFunctionToolCallOutputItemStatus

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

One of the following:
const BetaResponseFunctionToolCallOutputItemStatusInProgress BetaResponseFunctionToolCallOutputItemStatus = "in_progress"
const BetaResponseFunctionToolCallOutputItemStatusCompleted BetaResponseFunctionToolCallOutputItemStatus = "completed"
const BetaResponseFunctionToolCallOutputItemStatusIncomplete BetaResponseFunctionToolCallOutputItemStatus = "incomplete"
Type FunctionCallOutput

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

Agent BetaResponseFunctionToolCallOutputItemAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseFunctionToolCallOutputItemCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseFunctionToolCallOutputItemCallerDirect struct{…}
Type Direct

The caller type. Always direct.

type BetaResponseFunctionToolCallOutputItemCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

maxLength64
minLength1
Type Program

The caller type. Always program.

CreatedBy stringOptional

The identifier of the actor that created the item.

type BetaResponseOutputItemAgentMessage struct{…}
ID string

The unique ID of the agent message.

Author string

The sending agent identity.

Content []BetaResponseOutputItemAgentMessageContentUnion

Encrypted content sent between agents.

One of the following:
type BetaResponseInputText 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.

PromptCacheBreakpoint BetaResponseInputTextPromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseOutputText struct{…}

A text output from the model.

Annotations []BetaResponseOutputTextAnnotationUnion

The annotations of the text output.

One of the following:
type BetaResponseOutputTextAnnotationFileCitation 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 BetaResponseOutputTextAnnotationURLCitation 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.

formaturi
type BetaResponseOutputTextAnnotationContainerFileCitation 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 BetaResponseOutputTextAnnotationFilePath 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 []BetaResponseOutputTextLogprobOptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []BetaResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
type BetaResponseOutputItemAgentMessageContentText struct{…}

A text content.

Text string
Type Text
type BetaResponseOutputItemAgentMessageContentSummaryText struct{…}

A summary text from the model.

Text string

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

Type SummaryText

The type of the object. Always summary_text.

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

type BetaResponseOutputRefusal struct{…}

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

type BetaResponseInputImage struct{…}

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

Detail BetaResponseInputImageDetail

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

One of the following:
const BetaResponseInputImageDetailLow BetaResponseInputImageDetail = "low"
const BetaResponseInputImageDetailHigh BetaResponseInputImageDetail = "high"
const BetaResponseInputImageDetailAuto BetaResponseInputImageDetail = "auto"
const BetaResponseInputImageDetailOriginal BetaResponseInputImageDetail = "original"
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.

formaturi
PromptCacheBreakpoint BetaResponseInputImagePromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseOutputItemAgentMessageContentComputerScreenshot struct{…}

A screenshot of a computer.

Detail string

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

One of the following:
const BetaResponseOutputItemAgentMessageContentComputerScreenshotDetailLow BetaResponseOutputItemAgentMessageContentComputerScreenshotDetail = "low"
const BetaResponseOutputItemAgentMessageContentComputerScreenshotDetailHigh BetaResponseOutputItemAgentMessageContentComputerScreenshotDetail = "high"
const BetaResponseOutputItemAgentMessageContentComputerScreenshotDetailAuto BetaResponseOutputItemAgentMessageContentComputerScreenshotDetail = "auto"
const BetaResponseOutputItemAgentMessageContentComputerScreenshotDetailOriginal BetaResponseOutputItemAgentMessageContentComputerScreenshotDetail = "original"
FileID string

The identifier of an uploaded file that contains the screenshot.

ImageURL string

The URL of the screenshot image.

formaturi
Type ComputerScreenshot

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

PromptCacheBreakpoint BetaResponseOutputItemAgentMessageContentComputerScreenshotPromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

Detail BetaResponseInputFileDetailOptional

The detail level of the file to be sent to the model. Use auto to let the system select the detail level; for GPT-5.6 and later models, auto uses high-quality rendering, which may increase input token usage. Use low for lower-cost rendering, or high to render the file at higher quality. Defaults to auto.

One of the following:
const BetaResponseInputFileDetailAuto BetaResponseInputFileDetail = "auto"
const BetaResponseInputFileDetailLow BetaResponseInputFileDetail = "low"
const BetaResponseInputFileDetailHigh BetaResponseInputFileDetail = "high"
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.

formaturi
Filename stringOptional

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

PromptCacheBreakpoint BetaResponseInputFilePromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseOutputItemAgentMessageContentEncryptedContent struct{…}

Opaque encrypted content that Responses API decrypts inside trusted model execution.

EncryptedContent string

Opaque encrypted content.

Type EncryptedContent

The type of the input item. Always encrypted_content.

Recipient string

The destination agent identity.

Type AgentMessage

The type of the item. Always agent_message.

Agent BetaResponseOutputItemAgentMessageAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseOutputItemMultiAgentCall struct{…}
ID string

The unique ID of the multi-agent call item.

Action string

The multi-agent action to execute.

One of the following:
const BetaResponseOutputItemMultiAgentCallActionSpawnAgent BetaResponseOutputItemMultiAgentCallAction = "spawn_agent"
const BetaResponseOutputItemMultiAgentCallActionInterruptAgent BetaResponseOutputItemMultiAgentCallAction = "interrupt_agent"
const BetaResponseOutputItemMultiAgentCallActionListAgents BetaResponseOutputItemMultiAgentCallAction = "list_agents"
const BetaResponseOutputItemMultiAgentCallActionSendMessage BetaResponseOutputItemMultiAgentCallAction = "send_message"
const BetaResponseOutputItemMultiAgentCallActionFollowupTask BetaResponseOutputItemMultiAgentCallAction = "followup_task"
const BetaResponseOutputItemMultiAgentCallActionWaitAgent BetaResponseOutputItemMultiAgentCallAction = "wait_agent"
Arguments string

The JSON string of arguments generated for the action.

CallID string

The unique ID linking this call to its output.

Type MultiAgentCall

The type of the multi-agent call. Always multi_agent_call.

Agent BetaResponseOutputItemMultiAgentCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseOutputItemMultiAgentCallOutput struct{…}
ID string

The unique ID of the multi-agent call output item.

Action string

The multi-agent action that produced this result.

One of the following:
const BetaResponseOutputItemMultiAgentCallOutputActionSpawnAgent BetaResponseOutputItemMultiAgentCallOutputAction = "spawn_agent"
const BetaResponseOutputItemMultiAgentCallOutputActionInterruptAgent BetaResponseOutputItemMultiAgentCallOutputAction = "interrupt_agent"
const BetaResponseOutputItemMultiAgentCallOutputActionListAgents BetaResponseOutputItemMultiAgentCallOutputAction = "list_agents"
const BetaResponseOutputItemMultiAgentCallOutputActionSendMessage BetaResponseOutputItemMultiAgentCallOutputAction = "send_message"
const BetaResponseOutputItemMultiAgentCallOutputActionFollowupTask BetaResponseOutputItemMultiAgentCallOutputAction = "followup_task"
const BetaResponseOutputItemMultiAgentCallOutputActionWaitAgent BetaResponseOutputItemMultiAgentCallOutputAction = "wait_agent"
CallID string

The unique ID of the multi-agent call.

Text output returned by the multi-agent action.

Annotations []BetaResponseOutputTextAnnotationUnion

The annotations of the text output.

One of the following:
type BetaResponseOutputTextAnnotationFileCitation 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 BetaResponseOutputTextAnnotationURLCitation 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.

formaturi
type BetaResponseOutputTextAnnotationContainerFileCitation 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 BetaResponseOutputTextAnnotationFilePath 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 []BetaResponseOutputTextLogprobOptional
Token string
Bytes []int64
Logprob float64
TopLogprobs []BetaResponseOutputTextLogprobTopLogprob
Token string
Bytes []int64
Logprob float64
Type MultiAgentCallOutput

The type of the multi-agent result. Always multi_agent_call_output.

Agent BetaResponseOutputItemMultiAgentCallOutputAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

One of the following:
One of the following:
type BetaResponseComputerToolCall 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.

CallID string

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

PendingSafetyChecks []BetaResponseComputerToolCallPendingSafetyCheck

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 BetaResponseComputerToolCallStatus

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

One of the following:
const BetaResponseComputerToolCallStatusInProgress BetaResponseComputerToolCallStatus = "in_progress"
const BetaResponseComputerToolCallStatusCompleted BetaResponseComputerToolCallStatus = "completed"
const BetaResponseComputerToolCallStatusIncomplete BetaResponseComputerToolCallStatus = "incomplete"
Type BetaResponseComputerToolCallType

The type of the computer call. Always computer_call.

A click action.

One of the following:
type BetaComputerActionClick struct{…}

A click action.

Button string

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

One of the following:
const BetaComputerActionClickButtonLeft BetaComputerActionClickButton = "left"
const BetaComputerActionClickButtonRight BetaComputerActionClickButton = "right"
const BetaComputerActionClickButtonWheel BetaComputerActionClickButton = "wheel"
const BetaComputerActionClickButtonBack BetaComputerActionClickButton = "back"
const BetaComputerActionClickButtonForward BetaComputerActionClickButton = "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.

Keys []stringOptional

The keys being held while clicking.

type BetaComputerActionDoubleClick struct{…}

A double click action.

Keys []string

The keys being held while double-clicking.

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 BetaComputerActionDrag struct{…}

A drag action.

Path []BetaComputerActionDragPath

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.

Keys []stringOptional

The keys being held while dragging the mouse.

type BetaComputerActionKeypress 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 BetaComputerActionMove 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.

Keys []stringOptional

The keys being held while moving the mouse.

type BetaComputerActionScreenshot struct{…}

A screenshot action.

Type Screenshot

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

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

Keys []stringOptional

The keys being held while scrolling.

type BetaComputerActionType 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 BetaComputerActionWait struct{…}

A wait action.

Type Wait

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

Actions BetaComputerActionListOptional

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

One of the following:
type BetaComputerActionClick struct{…}

A click action.

Button string

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

One of the following:
const BetaComputerActionClickButtonLeft BetaComputerActionClickButton = "left"
const BetaComputerActionClickButtonRight BetaComputerActionClickButton = "right"
const BetaComputerActionClickButtonWheel BetaComputerActionClickButton = "wheel"
const BetaComputerActionClickButtonBack BetaComputerActionClickButton = "back"
const BetaComputerActionClickButtonForward BetaComputerActionClickButton = "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.

Keys []stringOptional

The keys being held while clicking.

type BetaComputerActionDoubleClick struct{…}

A double click action.

Keys []string

The keys being held while double-clicking.

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 BetaComputerActionDrag struct{…}

A drag action.

Path []BetaComputerActionDragPath

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.

Keys []stringOptional

The keys being held while dragging the mouse.

type BetaComputerActionKeypress 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 BetaComputerActionMove 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.

Keys []stringOptional

The keys being held while moving the mouse.

type BetaComputerActionScreenshot struct{…}

A screenshot action.

Type Screenshot

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

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

Keys []stringOptional

The keys being held while scrolling.

type BetaComputerActionType 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 BetaComputerActionWait struct{…}

A wait action.

Type Wait

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

Agent BetaResponseComputerToolCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseComputerToolCallOutputItem struct{…}
ID string

The unique ID of the computer call tool output.

CallID string

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

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.

formaturi
Status BetaResponseComputerToolCallOutputItemStatus

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

One of the following:
const BetaResponseComputerToolCallOutputItemStatusCompleted BetaResponseComputerToolCallOutputItemStatus = "completed"
const BetaResponseComputerToolCallOutputItemStatusIncomplete BetaResponseComputerToolCallOutputItemStatus = "incomplete"
const BetaResponseComputerToolCallOutputItemStatusFailed BetaResponseComputerToolCallOutputItemStatus = "failed"
const BetaResponseComputerToolCallOutputItemStatusInProgress BetaResponseComputerToolCallOutputItemStatus = "in_progress"
Type ComputerCallOutput

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

AcknowledgedSafetyChecks []BetaResponseComputerToolCallOutputItemAcknowledgedSafetyCheckOptional

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.

Agent BetaResponseComputerToolCallOutputItemAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

CreatedBy stringOptional

The identifier of the actor that created the item.

type BetaResponseReasoningItem 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 []BetaResponseReasoningItemSummary

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.

Agent BetaResponseReasoningItemAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Content []BetaResponseReasoningItemContentOptional

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. This is populated by default for reasoning items returned by POST /v1/responses and WebSocket response.create requests.

Status BetaResponseReasoningItemStatusOptional

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

One of the following:
const BetaResponseReasoningItemStatusInProgress BetaResponseReasoningItemStatus = "in_progress"
const BetaResponseReasoningItemStatusCompleted BetaResponseReasoningItemStatus = "completed"
const BetaResponseReasoningItemStatusIncomplete BetaResponseReasoningItemStatus = "incomplete"
type BetaResponseOutputItemProgram struct{…}
ID string

The unique ID of the program item.

CallID string

The stable call ID of the program item.

Code string

The JavaScript source executed by programmatic tool calling.

Fingerprint string

Opaque program replay fingerprint that must be round-tripped.

Type Program

The type of the item. Always program.

Agent BetaResponseOutputItemProgramAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseOutputItemProgramOutput struct{…}
ID string

The unique ID of the program output item.

CallID string

The call ID of the program item.

Result string

The result produced by the program item.

Status string

The terminal status of the program output item.

One of the following:
const BetaResponseOutputItemProgramOutputStatusCompleted BetaResponseOutputItemProgramOutputStatus = "completed"
const BetaResponseOutputItemProgramOutputStatusIncomplete BetaResponseOutputItemProgramOutputStatus = "incomplete"
Type ProgramOutput

The type of the item. Always program_output.

Agent BetaResponseOutputItemProgramOutputAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseToolSearchCall struct{…}
ID string

The unique ID of the tool search call item.

Arguments any

Arguments used for the tool search call.

CallID string

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

Execution BetaResponseToolSearchCallExecution

Whether tool search was executed by the server or by the client.

One of the following:
const BetaResponseToolSearchCallExecutionServer BetaResponseToolSearchCallExecution = "server"
const BetaResponseToolSearchCallExecutionClient BetaResponseToolSearchCallExecution = "client"
Status BetaResponseToolSearchCallStatus

The status of the tool search call item that was recorded.

One of the following:
const BetaResponseToolSearchCallStatusInProgress BetaResponseToolSearchCallStatus = "in_progress"
const BetaResponseToolSearchCallStatusCompleted BetaResponseToolSearchCallStatus = "completed"
const BetaResponseToolSearchCallStatusIncomplete BetaResponseToolSearchCallStatus = "incomplete"
Type ToolSearchCall

The type of the item. Always tool_search_call.

Agent BetaResponseToolSearchCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

CreatedBy stringOptional

The identifier of the actor that created the item.

type BetaResponseToolSearchOutputItem struct{…}
ID string

The unique ID of the tool search output item.

CallID string

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

Execution BetaResponseToolSearchOutputItemExecution

Whether tool search was executed by the server or by the client.

One of the following:
const BetaResponseToolSearchOutputItemExecutionServer BetaResponseToolSearchOutputItemExecution = "server"
const BetaResponseToolSearchOutputItemExecutionClient BetaResponseToolSearchOutputItemExecution = "client"
Status BetaResponseToolSearchOutputItemStatus

The status of the tool search output item that was recorded.

One of the following:
const BetaResponseToolSearchOutputItemStatusInProgress BetaResponseToolSearchOutputItemStatus = "in_progress"
const BetaResponseToolSearchOutputItemStatusCompleted BetaResponseToolSearchOutputItemStatus = "completed"
const BetaResponseToolSearchOutputItemStatusIncomplete BetaResponseToolSearchOutputItemStatus = "incomplete"

The loaded tool definitions returned by tool search.

One of the following:
type BetaFunctionTool 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 strict parameter validation is enforced for this function tool.

Type Function

The type of the function tool. Always function.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaFunctionToolAllowedCallerDirect BetaFunctionToolAllowedCaller = "direct"
const BetaFunctionToolAllowedCallerProgrammatic BetaFunctionToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this function is deferred and loaded via tool search.

Description stringOptional

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

OutputSchema map[string, any]Optional

A JSON schema object describing the JSON value encoded in string outputs for this function.

type BetaFileSearchTool 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 BetaFileSearchToolFiltersUnionOptional

A filter to apply.

One of the following:
type BetaFileSearchToolFiltersComparisonFilter 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 string

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
One of the following:
const BetaFileSearchToolFiltersComparisonFilterTypeEq BetaFileSearchToolFiltersComparisonFilterType = "eq"
const BetaFileSearchToolFiltersComparisonFilterTypeNe BetaFileSearchToolFiltersComparisonFilterType = "ne"
const BetaFileSearchToolFiltersComparisonFilterTypeGt BetaFileSearchToolFiltersComparisonFilterType = "gt"
const BetaFileSearchToolFiltersComparisonFilterTypeGte BetaFileSearchToolFiltersComparisonFilterType = "gte"
const BetaFileSearchToolFiltersComparisonFilterTypeLt BetaFileSearchToolFiltersComparisonFilterType = "lt"
const BetaFileSearchToolFiltersComparisonFilterTypeLte BetaFileSearchToolFiltersComparisonFilterType = "lte"
const BetaFileSearchToolFiltersComparisonFilterTypeIn BetaFileSearchToolFiltersComparisonFilterType = "in"
const BetaFileSearchToolFiltersComparisonFilterTypeNin BetaFileSearchToolFiltersComparisonFilterType = "nin"
Value BetaFileSearchToolFiltersComparisonFilterValueUnion

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

One of the following:
string
float64
bool
type BetaFileSearchToolFiltersComparisonFilterValueArray []BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion
One of the following:
string
float64
type BetaFileSearchToolFiltersCompoundFilter struct{…}

Combine multiple filters using and or or.

Filters []BetaFileSearchToolFiltersCompoundFilterFilter

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

One of the following:
type BetaFileSearchToolFiltersCompoundFilterFilter 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 string

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
One of the following:
const BetaFileSearchToolFiltersCompoundFilterFilterTypeEq BetaFileSearchToolFiltersCompoundFilterFilterType = "eq"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeNe BetaFileSearchToolFiltersCompoundFilterFilterType = "ne"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeGt BetaFileSearchToolFiltersCompoundFilterFilterType = "gt"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeGte BetaFileSearchToolFiltersCompoundFilterFilterType = "gte"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeLt BetaFileSearchToolFiltersCompoundFilterFilterType = "lt"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeLte BetaFileSearchToolFiltersCompoundFilterFilterType = "lte"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeIn BetaFileSearchToolFiltersCompoundFilterFilterType = "in"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeNin BetaFileSearchToolFiltersCompoundFilterFilterType = "nin"
Value BetaFileSearchToolFiltersCompoundFilterFilterValueUnion

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

One of the following:
string
float64
bool
type BetaFileSearchToolFiltersCompoundFilterFilterValueArray []BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion
One of the following:
string
float64
Type string

Type of operation: and or or.

One of the following:
const BetaFileSearchToolFiltersCompoundFilterTypeAnd BetaFileSearchToolFiltersCompoundFilterType = "and"
const BetaFileSearchToolFiltersCompoundFilterTypeOr BetaFileSearchToolFiltersCompoundFilterType = "or"
MaxNumResults int64Optional

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

RankingOptions BetaFileSearchToolRankingOptionsOptional

Ranking options for search.

Ranker stringOptional

The ranker to use for the file search.

One of the following:
const BetaFileSearchToolRankingOptionsRankerAuto BetaFileSearchToolRankingOptionsRanker = "auto"
const BetaFileSearchToolRankingOptionsRankerDefault2024_11_15 BetaFileSearchToolRankingOptionsRanker = "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 BetaComputerTool struct{…}

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

Type Computer

The type of the computer tool. Always computer.

type BetaComputerUsePreviewTool 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 BetaComputerUsePreviewToolEnvironment

The type of computer environment to control.

One of the following:
const BetaComputerUsePreviewToolEnvironmentWindows BetaComputerUsePreviewToolEnvironment = "windows"
const BetaComputerUsePreviewToolEnvironmentMac BetaComputerUsePreviewToolEnvironment = "mac"
const BetaComputerUsePreviewToolEnvironmentLinux BetaComputerUsePreviewToolEnvironment = "linux"
const BetaComputerUsePreviewToolEnvironmentUbuntu BetaComputerUsePreviewToolEnvironment = "ubuntu"
const BetaComputerUsePreviewToolEnvironmentBrowser BetaComputerUsePreviewToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type BetaWebSearchTool struct{…}

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

Type BetaWebSearchToolType

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

One of the following:
const BetaWebSearchToolTypeWebSearch BetaWebSearchToolType = "web_search"
const BetaWebSearchToolTypeWebSearch2025_08_26 BetaWebSearchToolType = "web_search_2025_08_26"
Filters BetaWebSearchToolFiltersOptional

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 BetaWebSearchToolSearchContextSizeOptional

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.

One of the following:
const BetaWebSearchToolSearchContextSizeLow BetaWebSearchToolSearchContextSize = "low"
const BetaWebSearchToolSearchContextSizeMedium BetaWebSearchToolSearchContextSize = "medium"
const BetaWebSearchToolSearchContextSizeHigh BetaWebSearchToolSearchContextSize = "high"
UserLocation BetaWebSearchToolUserLocationOptional

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaToolMcpAllowedCallerDirect BetaToolMcpAllowedCaller = "direct"
const BetaToolMcpAllowedCallerProgrammatic BetaToolMcpAllowedCaller = "programmatic"
AllowedTools BetaToolMcpAllowedToolsUnionOptional

List of allowed tool names or a filter object.

One of the following:
type BetaToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type BetaToolMcpAllowedToolsMcpToolFilter 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, connector_id, or tunnel_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
One of the following:
const BetaToolMcpConnectorIDConnectorDropbox BetaToolMcpConnectorID = "connector_dropbox"
const BetaToolMcpConnectorIDConnectorGmail BetaToolMcpConnectorID = "connector_gmail"
const BetaToolMcpConnectorIDConnectorGooglecalendar BetaToolMcpConnectorID = "connector_googlecalendar"
const BetaToolMcpConnectorIDConnectorGoogledrive BetaToolMcpConnectorID = "connector_googledrive"
const BetaToolMcpConnectorIDConnectorMicrosoftteams BetaToolMcpConnectorID = "connector_microsoftteams"
const BetaToolMcpConnectorIDConnectorOutlookcalendar BetaToolMcpConnectorID = "connector_outlookcalendar"
const BetaToolMcpConnectorIDConnectorOutlookemail BetaToolMcpConnectorID = "connector_outlookemail"
const BetaToolMcpConnectorIDConnectorSharepoint BetaToolMcpConnectorID = "connector_sharepoint"
DeferLoading boolOptional

Whether this MCP tool is deferred and discovered via tool search.

Headers map[string, string]Optional

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

RequireApproval BetaToolMcpRequireApprovalUnionOptional

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

One of the following:
type BetaToolMcpRequireApprovalMcpToolApprovalFilter 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 BetaToolMcpRequireApprovalMcpToolApprovalFilterAlwaysOptional

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 BetaToolMcpRequireApprovalMcpToolApprovalFilterNeverOptional

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

One of the following:
const BetaToolMcpRequireApprovalMcpToolApprovalSettingAlways BetaToolMcpRequireApprovalMcpToolApprovalSetting = "always"
const BetaToolMcpRequireApprovalMcpToolApprovalSettingNever BetaToolMcpRequireApprovalMcpToolApprovalSetting = "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, connector_id, or tunnel_id must be provided.

formaturi
TunnelID stringOptional

The Secure MCP Tunnel ID to use instead of a direct server URL. One of server_url, connector_id, or tunnel_id must be provided.

type BetaToolCodeInterpreter struct{…}

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

Container BetaToolCodeInterpreterContainerUnion

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.

One of the following:
string
type BetaToolCodeInterpreterContainerCodeInterpreterToolAuto 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.

One of the following:
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
NetworkPolicy BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionOptional

Network access policy for the container.

One of the following:
type BetaContainerNetworkPolicyDisabled struct{…}
Type Disabled

Disable outbound network access. Always disabled.

type BetaContainerNetworkPolicyAllowlist struct{…}
AllowedDomains []string

A list of allowed domains when type is allowlist.

Type Allowlist

Allow outbound network access only to specified domains. Always allowlist.

Optional domain-scoped secrets for allowlisted domains.

Domain string

The domain associated with the secret.

minLength1
Name string

The name of the secret to inject for the domain.

minLength1
Value string

The secret value to inject for the domain.

maxLength10485760
minLength1
Type CodeInterpreter

The type of the code interpreter tool. Always code_interpreter.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaToolCodeInterpreterAllowedCallerDirect BetaToolCodeInterpreterAllowedCaller = "direct"
const BetaToolCodeInterpreterAllowedCallerProgrammatic BetaToolCodeInterpreterAllowedCaller = "programmatic"
type BetaToolProgrammaticToolCalling struct{…}
Type ProgrammaticToolCalling

The type of the tool. Always programmatic_tool_calling.

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

One of the following:
const BetaToolImageGenerationActionGenerate BetaToolImageGenerationAction = "generate"
const BetaToolImageGenerationActionEdit BetaToolImageGenerationAction = "edit"
const BetaToolImageGenerationActionAuto BetaToolImageGenerationAction = "auto"
Background stringOptional

Allows to set transparency for the background of the generated image(s). This parameter is only supported for GPT image models that support transparent backgrounds. Must be one of transparent, opaque, or auto (default value). When auto is used, the model will automatically determine the best background for the image.

gpt-image-2 and gpt-image-2-2026-04-21 do not support transparent backgrounds. Requests with background set to transparent will return an error for these models; use opaque or auto instead.

If transparent, the output format needs to support transparency, so it should be set to either png (default value) or webp.

One of the following:
const BetaToolImageGenerationBackgroundTransparent BetaToolImageGenerationBackground = "transparent"
const BetaToolImageGenerationBackgroundOpaque BetaToolImageGenerationBackground = "opaque"
const BetaToolImageGenerationBackgroundAuto BetaToolImageGenerationBackground = "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.

One of the following:
const BetaToolImageGenerationInputFidelityHigh BetaToolImageGenerationInputFidelity = "high"
const BetaToolImageGenerationInputFidelityLow BetaToolImageGenerationInputFidelity = "low"
InputImageMask BetaToolImageGenerationInputImageMaskOptional

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.

One of the following:
string
string
One of the following:
const BetaToolImageGenerationModelGPTImage1 BetaToolImageGenerationModel = "gpt-image-1"
const BetaToolImageGenerationModelGPTImage1Mini BetaToolImageGenerationModel = "gpt-image-1-mini"
const BetaToolImageGenerationModelGPTImage2 BetaToolImageGenerationModel = "gpt-image-2"
const BetaToolImageGenerationModelGPTImage2_2026_04_21 BetaToolImageGenerationModel = "gpt-image-2-2026-04-21"
const BetaToolImageGenerationModelGPTImage1_5 BetaToolImageGenerationModel = "gpt-image-1.5"
const BetaToolImageGenerationModelChatgptImageLatest BetaToolImageGenerationModel = "chatgpt-image-latest"
Moderation stringOptional

Moderation level for the generated image. Default: auto.

One of the following:
const BetaToolImageGenerationModerationAuto BetaToolImageGenerationModeration = "auto"
const BetaToolImageGenerationModerationLow BetaToolImageGenerationModeration = "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.

One of the following:
const BetaToolImageGenerationOutputFormatPNG BetaToolImageGenerationOutputFormat = "png"
const BetaToolImageGenerationOutputFormatWebP BetaToolImageGenerationOutputFormat = "webp"
const BetaToolImageGenerationOutputFormatJPEG BetaToolImageGenerationOutputFormat = "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.

One of the following:
const BetaToolImageGenerationQualityLow BetaToolImageGenerationQuality = "low"
const BetaToolImageGenerationQualityMedium BetaToolImageGenerationQuality = "medium"
const BetaToolImageGenerationQualityHigh BetaToolImageGenerationQuality = "high"
const BetaToolImageGenerationQualityAuto BetaToolImageGenerationQuality = "auto"
Size stringOptional

The size of the generated images. For gpt-image-2 and gpt-image-2-2026-04-21, arbitrary resolutions are supported as WIDTHxHEIGHT strings, for example 1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above 2560x1440 are experimental, and the maximum supported resolution is 3840x2160. The requested size must also satisfy the model’s current pixel and edge limits. The standard sizes 1024x1024, 1536x1024, and 1024x1536 are supported by the GPT image models; auto is supported for models that allow automatic sizing. For dall-e-2, use one of 256x256, 512x512, or 1024x1024. For dall-e-3, use one of 1024x1024, 1792x1024, or 1024x1792.

One of the following:
string
string
One of the following:
const BetaToolImageGenerationSize1024x1024 BetaToolImageGenerationSize = "1024x1024"
const BetaToolImageGenerationSize1024x1536 BetaToolImageGenerationSize = "1024x1536"
const BetaToolImageGenerationSize1536x1024 BetaToolImageGenerationSize = "1536x1024"
const BetaToolImageGenerationSizeAuto BetaToolImageGenerationSize = "auto"
type BetaToolLocalShell 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 BetaFunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaFunctionShellToolAllowedCallerDirect BetaFunctionShellToolAllowedCaller = "direct"
const BetaFunctionShellToolAllowedCallerProgrammatic BetaFunctionShellToolAllowedCaller = "programmatic"
Environment BetaFunctionShellToolEnvironmentUnionOptional
One of the following:
type BetaContainerAuto struct{…}
Type ContainerAuto

Automatically creates a container for this request

FileIDs []stringOptional

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

MemoryLimit BetaContainerAutoMemoryLimitOptional

The memory limit for the container.

One of the following:
const BetaContainerAutoMemoryLimit1g BetaContainerAutoMemoryLimit = "1g"
const BetaContainerAutoMemoryLimit4g BetaContainerAutoMemoryLimit = "4g"
const BetaContainerAutoMemoryLimit16g BetaContainerAutoMemoryLimit = "16g"
const BetaContainerAutoMemoryLimit64g BetaContainerAutoMemoryLimit = "64g"
NetworkPolicy BetaContainerAutoNetworkPolicyUnionOptional

Network access policy for the container.

One of the following:
type BetaContainerNetworkPolicyDisabled struct{…}
Type Disabled

Disable outbound network access. Always disabled.

type BetaContainerNetworkPolicyAllowlist struct{…}
AllowedDomains []string

A list of allowed domains when type is allowlist.

Type Allowlist

Allow outbound network access only to specified domains. Always allowlist.

Optional domain-scoped secrets for allowlisted domains.

Domain string

The domain associated with the secret.

minLength1
Name string

The name of the secret to inject for the domain.

minLength1
Value string

The secret value to inject for the domain.

maxLength10485760
minLength1
Skills []BetaContainerAutoSkillUnionOptional

An optional list of skills referenced by id or inline data.

One of the following:
type BetaSkillReference struct{…}
SkillID string

The ID of the referenced skill.

maxLength64
minLength1
Type SkillReference

References a skill created with the /v1/skills endpoint.

Version stringOptional

Optional skill version. Use a positive integer or ‘latest’. Omit for default.

type BetaInlineSkill struct{…}
Description string

The description of the skill.

Name string

The name of the skill.

Inline skill payload

Data string

Base64-encoded skill zip bundle.

maxLength70254592
minLength1
MediaType ApplicationZip

The media type of the inline skill payload. Must be application/zip.

Type Base64

The type of the inline skill source. Must be base64.

Type Inline

Defines an inline skill for this request.

type BetaLocalEnvironment struct{…}
Type Local

Use a local computer environment.

Skills []BetaLocalSkillOptional

An optional list of skills.

Description string

The description of the skill.

Name string

The name of the skill.

Path string

The path to the directory containing the skill.

type BetaContainerReference struct{…}
ContainerID string

The ID of the referenced container.

Type ContainerReference

References a container created with the /v1/containers endpoint

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaCustomToolAllowedCallerDirect BetaCustomToolAllowedCaller = "direct"
const BetaCustomToolAllowedCallerProgrammatic BetaCustomToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this tool should be deferred and discovered via tool search.

Description stringOptional

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

Format BetaCustomToolFormatUnionOptional

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

One of the following:
type BetaCustomToolFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

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

One of the following:
const BetaCustomToolFormatGrammarSyntaxLark BetaCustomToolFormatGrammarSyntax = "lark"
const BetaCustomToolFormatGrammarSyntaxRegex BetaCustomToolFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

type BetaNamespaceTool struct{…}

Groups function/custom tools under a shared namespace.

Description string

A description of the namespace shown to the model.

minLength1
Name string

The namespace name used in tool calls (for example, crm).

minLength1
Tools []BetaNamespaceToolToolUnion

The function/custom tools available inside this namespace.

One of the following:
type BetaNamespaceToolToolFunction struct{…}
Name string
maxLength128
minLength1
Type Function
AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaNamespaceToolToolFunctionAllowedCallerDirect BetaNamespaceToolToolFunctionAllowedCaller = "direct"
const BetaNamespaceToolToolFunctionAllowedCallerProgrammatic BetaNamespaceToolToolFunctionAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this function should be deferred and discovered via tool search.

Description stringOptional
OutputSchema map[string, any]Optional

A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

Parameters anyOptional
Strict boolOptional

Whether to enforce strict parameter validation. If omitted, Responses attempts to use strict validation when the schema is compatible, and falls back to non-strict validation otherwise.

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaCustomToolAllowedCallerDirect BetaCustomToolAllowedCaller = "direct"
const BetaCustomToolAllowedCallerProgrammatic BetaCustomToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this tool should be deferred and discovered via tool search.

Description stringOptional

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

Format BetaCustomToolFormatUnionOptional

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

One of the following:
type BetaCustomToolFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

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

One of the following:
const BetaCustomToolFormatGrammarSyntaxLark BetaCustomToolFormatGrammarSyntax = "lark"
const BetaCustomToolFormatGrammarSyntaxRegex BetaCustomToolFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

Type Namespace

The type of the tool. Always namespace.

type BetaToolSearchTool struct{…}

Hosted or BYOT tool search configuration for deferred tools.

Type ToolSearch

The type of the tool. Always tool_search.

Description stringOptional

Description shown to the model for a client-executed tool search tool.

Execution BetaToolSearchToolExecutionOptional

Whether tool search is executed by the server or by the client.

One of the following:
const BetaToolSearchToolExecutionServer BetaToolSearchToolExecution = "server"
const BetaToolSearchToolExecutionClient BetaToolSearchToolExecution = "client"
Parameters anyOptional

Parameter schema for a client-executed tool search tool.

type BetaWebSearchPreviewTool struct{…}

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

Type BetaWebSearchPreviewToolType

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

One of the following:
const BetaWebSearchPreviewToolTypeWebSearchPreview BetaWebSearchPreviewToolType = "web_search_preview"
const BetaWebSearchPreviewToolTypeWebSearchPreview2025_03_11 BetaWebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContentTypes []stringOptional
One of the following:
const BetaWebSearchPreviewToolSearchContentTypeText BetaWebSearchPreviewToolSearchContentType = "text"
const BetaWebSearchPreviewToolSearchContentTypeImage BetaWebSearchPreviewToolSearchContentType = "image"
SearchContextSize BetaWebSearchPreviewToolSearchContextSizeOptional

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.

One of the following:
const BetaWebSearchPreviewToolSearchContextSizeLow BetaWebSearchPreviewToolSearchContextSize = "low"
const BetaWebSearchPreviewToolSearchContextSizeMedium BetaWebSearchPreviewToolSearchContextSize = "medium"
const BetaWebSearchPreviewToolSearchContextSizeHigh BetaWebSearchPreviewToolSearchContextSize = "high"
UserLocation BetaWebSearchPreviewToolUserLocationOptional

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 BetaApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaApplyPatchToolAllowedCallerDirect BetaApplyPatchToolAllowedCaller = "direct"
const BetaApplyPatchToolAllowedCallerProgrammatic BetaApplyPatchToolAllowedCaller = "programmatic"
Type ToolSearchOutput

The type of the item. Always tool_search_output.

Agent BetaResponseToolSearchOutputItemAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

CreatedBy stringOptional

The identifier of the actor that created the item.

type BetaResponseOutputItemAdditionalTools struct{…}
ID string

The unique ID of the additional tools item.

Role string

The role that provided the additional tools.

One of the following:
const BetaResponseOutputItemAdditionalToolsRoleUnknown BetaResponseOutputItemAdditionalToolsRole = "unknown"
const BetaResponseOutputItemAdditionalToolsRoleUser BetaResponseOutputItemAdditionalToolsRole = "user"
const BetaResponseOutputItemAdditionalToolsRoleAssistant BetaResponseOutputItemAdditionalToolsRole = "assistant"
const BetaResponseOutputItemAdditionalToolsRoleSystem BetaResponseOutputItemAdditionalToolsRole = "system"
const BetaResponseOutputItemAdditionalToolsRoleCritic BetaResponseOutputItemAdditionalToolsRole = "critic"
const BetaResponseOutputItemAdditionalToolsRoleDiscriminator BetaResponseOutputItemAdditionalToolsRole = "discriminator"
const BetaResponseOutputItemAdditionalToolsRoleDeveloper BetaResponseOutputItemAdditionalToolsRole = "developer"
const BetaResponseOutputItemAdditionalToolsRoleTool BetaResponseOutputItemAdditionalToolsRole = "tool"

The additional tool definitions made available at this item.

One of the following:
type BetaFunctionTool 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 strict parameter validation is enforced for this function tool.

Type Function

The type of the function tool. Always function.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaFunctionToolAllowedCallerDirect BetaFunctionToolAllowedCaller = "direct"
const BetaFunctionToolAllowedCallerProgrammatic BetaFunctionToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this function is deferred and loaded via tool search.

Description stringOptional

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

OutputSchema map[string, any]Optional

A JSON schema object describing the JSON value encoded in string outputs for this function.

type BetaFileSearchTool 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 BetaFileSearchToolFiltersUnionOptional

A filter to apply.

One of the following:
type BetaFileSearchToolFiltersComparisonFilter 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 string

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
One of the following:
const BetaFileSearchToolFiltersComparisonFilterTypeEq BetaFileSearchToolFiltersComparisonFilterType = "eq"
const BetaFileSearchToolFiltersComparisonFilterTypeNe BetaFileSearchToolFiltersComparisonFilterType = "ne"
const BetaFileSearchToolFiltersComparisonFilterTypeGt BetaFileSearchToolFiltersComparisonFilterType = "gt"
const BetaFileSearchToolFiltersComparisonFilterTypeGte BetaFileSearchToolFiltersComparisonFilterType = "gte"
const BetaFileSearchToolFiltersComparisonFilterTypeLt BetaFileSearchToolFiltersComparisonFilterType = "lt"
const BetaFileSearchToolFiltersComparisonFilterTypeLte BetaFileSearchToolFiltersComparisonFilterType = "lte"
const BetaFileSearchToolFiltersComparisonFilterTypeIn BetaFileSearchToolFiltersComparisonFilterType = "in"
const BetaFileSearchToolFiltersComparisonFilterTypeNin BetaFileSearchToolFiltersComparisonFilterType = "nin"
Value BetaFileSearchToolFiltersComparisonFilterValueUnion

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

One of the following:
string
float64
bool
type BetaFileSearchToolFiltersComparisonFilterValueArray []BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion
One of the following:
string
float64
type BetaFileSearchToolFiltersCompoundFilter struct{…}

Combine multiple filters using and or or.

Filters []BetaFileSearchToolFiltersCompoundFilterFilter

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

One of the following:
type BetaFileSearchToolFiltersCompoundFilterFilter 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 string

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
One of the following:
const BetaFileSearchToolFiltersCompoundFilterFilterTypeEq BetaFileSearchToolFiltersCompoundFilterFilterType = "eq"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeNe BetaFileSearchToolFiltersCompoundFilterFilterType = "ne"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeGt BetaFileSearchToolFiltersCompoundFilterFilterType = "gt"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeGte BetaFileSearchToolFiltersCompoundFilterFilterType = "gte"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeLt BetaFileSearchToolFiltersCompoundFilterFilterType = "lt"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeLte BetaFileSearchToolFiltersCompoundFilterFilterType = "lte"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeIn BetaFileSearchToolFiltersCompoundFilterFilterType = "in"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeNin BetaFileSearchToolFiltersCompoundFilterFilterType = "nin"
Value BetaFileSearchToolFiltersCompoundFilterFilterValueUnion

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

One of the following:
string
float64
bool
type BetaFileSearchToolFiltersCompoundFilterFilterValueArray []BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion
One of the following:
string
float64
Type string

Type of operation: and or or.

One of the following:
const BetaFileSearchToolFiltersCompoundFilterTypeAnd BetaFileSearchToolFiltersCompoundFilterType = "and"
const BetaFileSearchToolFiltersCompoundFilterTypeOr BetaFileSearchToolFiltersCompoundFilterType = "or"
MaxNumResults int64Optional

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

RankingOptions BetaFileSearchToolRankingOptionsOptional

Ranking options for search.

Ranker stringOptional

The ranker to use for the file search.

One of the following:
const BetaFileSearchToolRankingOptionsRankerAuto BetaFileSearchToolRankingOptionsRanker = "auto"
const BetaFileSearchToolRankingOptionsRankerDefault2024_11_15 BetaFileSearchToolRankingOptionsRanker = "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 BetaComputerTool struct{…}

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

Type Computer

The type of the computer tool. Always computer.

type BetaComputerUsePreviewTool 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 BetaComputerUsePreviewToolEnvironment

The type of computer environment to control.

One of the following:
const BetaComputerUsePreviewToolEnvironmentWindows BetaComputerUsePreviewToolEnvironment = "windows"
const BetaComputerUsePreviewToolEnvironmentMac BetaComputerUsePreviewToolEnvironment = "mac"
const BetaComputerUsePreviewToolEnvironmentLinux BetaComputerUsePreviewToolEnvironment = "linux"
const BetaComputerUsePreviewToolEnvironmentUbuntu BetaComputerUsePreviewToolEnvironment = "ubuntu"
const BetaComputerUsePreviewToolEnvironmentBrowser BetaComputerUsePreviewToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type BetaWebSearchTool struct{…}

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

Type BetaWebSearchToolType

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

One of the following:
const BetaWebSearchToolTypeWebSearch BetaWebSearchToolType = "web_search"
const BetaWebSearchToolTypeWebSearch2025_08_26 BetaWebSearchToolType = "web_search_2025_08_26"
Filters BetaWebSearchToolFiltersOptional

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 BetaWebSearchToolSearchContextSizeOptional

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.

One of the following:
const BetaWebSearchToolSearchContextSizeLow BetaWebSearchToolSearchContextSize = "low"
const BetaWebSearchToolSearchContextSizeMedium BetaWebSearchToolSearchContextSize = "medium"
const BetaWebSearchToolSearchContextSizeHigh BetaWebSearchToolSearchContextSize = "high"
UserLocation BetaWebSearchToolUserLocationOptional

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaToolMcpAllowedCallerDirect BetaToolMcpAllowedCaller = "direct"
const BetaToolMcpAllowedCallerProgrammatic BetaToolMcpAllowedCaller = "programmatic"
AllowedTools BetaToolMcpAllowedToolsUnionOptional

List of allowed tool names or a filter object.

One of the following:
type BetaToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type BetaToolMcpAllowedToolsMcpToolFilter 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, connector_id, or tunnel_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
One of the following:
const BetaToolMcpConnectorIDConnectorDropbox BetaToolMcpConnectorID = "connector_dropbox"
const BetaToolMcpConnectorIDConnectorGmail BetaToolMcpConnectorID = "connector_gmail"
const BetaToolMcpConnectorIDConnectorGooglecalendar BetaToolMcpConnectorID = "connector_googlecalendar"
const BetaToolMcpConnectorIDConnectorGoogledrive BetaToolMcpConnectorID = "connector_googledrive"
const BetaToolMcpConnectorIDConnectorMicrosoftteams BetaToolMcpConnectorID = "connector_microsoftteams"
const BetaToolMcpConnectorIDConnectorOutlookcalendar BetaToolMcpConnectorID = "connector_outlookcalendar"
const BetaToolMcpConnectorIDConnectorOutlookemail BetaToolMcpConnectorID = "connector_outlookemail"
const BetaToolMcpConnectorIDConnectorSharepoint BetaToolMcpConnectorID = "connector_sharepoint"
DeferLoading boolOptional

Whether this MCP tool is deferred and discovered via tool search.

Headers map[string, string]Optional

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

RequireApproval BetaToolMcpRequireApprovalUnionOptional

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

One of the following:
type BetaToolMcpRequireApprovalMcpToolApprovalFilter 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 BetaToolMcpRequireApprovalMcpToolApprovalFilterAlwaysOptional

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 BetaToolMcpRequireApprovalMcpToolApprovalFilterNeverOptional

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

One of the following:
const BetaToolMcpRequireApprovalMcpToolApprovalSettingAlways BetaToolMcpRequireApprovalMcpToolApprovalSetting = "always"
const BetaToolMcpRequireApprovalMcpToolApprovalSettingNever BetaToolMcpRequireApprovalMcpToolApprovalSetting = "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, connector_id, or tunnel_id must be provided.

formaturi
TunnelID stringOptional

The Secure MCP Tunnel ID to use instead of a direct server URL. One of server_url, connector_id, or tunnel_id must be provided.

type BetaToolCodeInterpreter struct{…}

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

Container BetaToolCodeInterpreterContainerUnion

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.

One of the following:
string
type BetaToolCodeInterpreterContainerCodeInterpreterToolAuto 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.

One of the following:
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
NetworkPolicy BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionOptional

Network access policy for the container.

One of the following:
type BetaContainerNetworkPolicyDisabled struct{…}
Type Disabled

Disable outbound network access. Always disabled.

type BetaContainerNetworkPolicyAllowlist struct{…}
AllowedDomains []string

A list of allowed domains when type is allowlist.

Type Allowlist

Allow outbound network access only to specified domains. Always allowlist.

Optional domain-scoped secrets for allowlisted domains.

Domain string

The domain associated with the secret.

minLength1
Name string

The name of the secret to inject for the domain.

minLength1
Value string

The secret value to inject for the domain.

maxLength10485760
minLength1
Type CodeInterpreter

The type of the code interpreter tool. Always code_interpreter.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaToolCodeInterpreterAllowedCallerDirect BetaToolCodeInterpreterAllowedCaller = "direct"
const BetaToolCodeInterpreterAllowedCallerProgrammatic BetaToolCodeInterpreterAllowedCaller = "programmatic"
type BetaToolProgrammaticToolCalling struct{…}
Type ProgrammaticToolCalling

The type of the tool. Always programmatic_tool_calling.

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

One of the following:
const BetaToolImageGenerationActionGenerate BetaToolImageGenerationAction = "generate"
const BetaToolImageGenerationActionEdit BetaToolImageGenerationAction = "edit"
const BetaToolImageGenerationActionAuto BetaToolImageGenerationAction = "auto"
Background stringOptional

Allows to set transparency for the background of the generated image(s). This parameter is only supported for GPT image models that support transparent backgrounds. Must be one of transparent, opaque, or auto (default value). When auto is used, the model will automatically determine the best background for the image.

gpt-image-2 and gpt-image-2-2026-04-21 do not support transparent backgrounds. Requests with background set to transparent will return an error for these models; use opaque or auto instead.

If transparent, the output format needs to support transparency, so it should be set to either png (default value) or webp.

One of the following:
const BetaToolImageGenerationBackgroundTransparent BetaToolImageGenerationBackground = "transparent"
const BetaToolImageGenerationBackgroundOpaque BetaToolImageGenerationBackground = "opaque"
const BetaToolImageGenerationBackgroundAuto BetaToolImageGenerationBackground = "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.

One of the following:
const BetaToolImageGenerationInputFidelityHigh BetaToolImageGenerationInputFidelity = "high"
const BetaToolImageGenerationInputFidelityLow BetaToolImageGenerationInputFidelity = "low"
InputImageMask BetaToolImageGenerationInputImageMaskOptional

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.

One of the following:
string
string
One of the following:
const BetaToolImageGenerationModelGPTImage1 BetaToolImageGenerationModel = "gpt-image-1"
const BetaToolImageGenerationModelGPTImage1Mini BetaToolImageGenerationModel = "gpt-image-1-mini"
const BetaToolImageGenerationModelGPTImage2 BetaToolImageGenerationModel = "gpt-image-2"
const BetaToolImageGenerationModelGPTImage2_2026_04_21 BetaToolImageGenerationModel = "gpt-image-2-2026-04-21"
const BetaToolImageGenerationModelGPTImage1_5 BetaToolImageGenerationModel = "gpt-image-1.5"
const BetaToolImageGenerationModelChatgptImageLatest BetaToolImageGenerationModel = "chatgpt-image-latest"
Moderation stringOptional

Moderation level for the generated image. Default: auto.

One of the following:
const BetaToolImageGenerationModerationAuto BetaToolImageGenerationModeration = "auto"
const BetaToolImageGenerationModerationLow BetaToolImageGenerationModeration = "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.

One of the following:
const BetaToolImageGenerationOutputFormatPNG BetaToolImageGenerationOutputFormat = "png"
const BetaToolImageGenerationOutputFormatWebP BetaToolImageGenerationOutputFormat = "webp"
const BetaToolImageGenerationOutputFormatJPEG BetaToolImageGenerationOutputFormat = "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.

One of the following:
const BetaToolImageGenerationQualityLow BetaToolImageGenerationQuality = "low"
const BetaToolImageGenerationQualityMedium BetaToolImageGenerationQuality = "medium"
const BetaToolImageGenerationQualityHigh BetaToolImageGenerationQuality = "high"
const BetaToolImageGenerationQualityAuto BetaToolImageGenerationQuality = "auto"
Size stringOptional

The size of the generated images. For gpt-image-2 and gpt-image-2-2026-04-21, arbitrary resolutions are supported as WIDTHxHEIGHT strings, for example 1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above 2560x1440 are experimental, and the maximum supported resolution is 3840x2160. The requested size must also satisfy the model’s current pixel and edge limits. The standard sizes 1024x1024, 1536x1024, and 1024x1536 are supported by the GPT image models; auto is supported for models that allow automatic sizing. For dall-e-2, use one of 256x256, 512x512, or 1024x1024. For dall-e-3, use one of 1024x1024, 1792x1024, or 1024x1792.

One of the following:
string
string
One of the following:
const BetaToolImageGenerationSize1024x1024 BetaToolImageGenerationSize = "1024x1024"
const BetaToolImageGenerationSize1024x1536 BetaToolImageGenerationSize = "1024x1536"
const BetaToolImageGenerationSize1536x1024 BetaToolImageGenerationSize = "1536x1024"
const BetaToolImageGenerationSizeAuto BetaToolImageGenerationSize = "auto"
type BetaToolLocalShell 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 BetaFunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaFunctionShellToolAllowedCallerDirect BetaFunctionShellToolAllowedCaller = "direct"
const BetaFunctionShellToolAllowedCallerProgrammatic BetaFunctionShellToolAllowedCaller = "programmatic"
Environment BetaFunctionShellToolEnvironmentUnionOptional
One of the following:
type BetaContainerAuto struct{…}
Type ContainerAuto

Automatically creates a container for this request

FileIDs []stringOptional

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

MemoryLimit BetaContainerAutoMemoryLimitOptional

The memory limit for the container.

One of the following:
const BetaContainerAutoMemoryLimit1g BetaContainerAutoMemoryLimit = "1g"
const BetaContainerAutoMemoryLimit4g BetaContainerAutoMemoryLimit = "4g"
const BetaContainerAutoMemoryLimit16g BetaContainerAutoMemoryLimit = "16g"
const BetaContainerAutoMemoryLimit64g BetaContainerAutoMemoryLimit = "64g"
NetworkPolicy BetaContainerAutoNetworkPolicyUnionOptional

Network access policy for the container.

One of the following:
type BetaContainerNetworkPolicyDisabled struct{…}
Type Disabled

Disable outbound network access. Always disabled.

type BetaContainerNetworkPolicyAllowlist struct{…}
AllowedDomains []string

A list of allowed domains when type is allowlist.

Type Allowlist

Allow outbound network access only to specified domains. Always allowlist.

Optional domain-scoped secrets for allowlisted domains.

Domain string

The domain associated with the secret.

minLength1
Name string

The name of the secret to inject for the domain.

minLength1
Value string

The secret value to inject for the domain.

maxLength10485760
minLength1
Skills []BetaContainerAutoSkillUnionOptional

An optional list of skills referenced by id or inline data.

One of the following:
type BetaSkillReference struct{…}
SkillID string

The ID of the referenced skill.

maxLength64
minLength1
Type SkillReference

References a skill created with the /v1/skills endpoint.

Version stringOptional

Optional skill version. Use a positive integer or ‘latest’. Omit for default.

type BetaInlineSkill struct{…}
Description string

The description of the skill.

Name string

The name of the skill.

Inline skill payload

Data string

Base64-encoded skill zip bundle.

maxLength70254592
minLength1
MediaType ApplicationZip

The media type of the inline skill payload. Must be application/zip.

Type Base64

The type of the inline skill source. Must be base64.

Type Inline

Defines an inline skill for this request.

type BetaLocalEnvironment struct{…}
Type Local

Use a local computer environment.

Skills []BetaLocalSkillOptional

An optional list of skills.

Description string

The description of the skill.

Name string

The name of the skill.

Path string

The path to the directory containing the skill.

type BetaContainerReference struct{…}
ContainerID string

The ID of the referenced container.

Type ContainerReference

References a container created with the /v1/containers endpoint

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaCustomToolAllowedCallerDirect BetaCustomToolAllowedCaller = "direct"
const BetaCustomToolAllowedCallerProgrammatic BetaCustomToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this tool should be deferred and discovered via tool search.

Description stringOptional

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

Format BetaCustomToolFormatUnionOptional

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

One of the following:
type BetaCustomToolFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

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

One of the following:
const BetaCustomToolFormatGrammarSyntaxLark BetaCustomToolFormatGrammarSyntax = "lark"
const BetaCustomToolFormatGrammarSyntaxRegex BetaCustomToolFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

type BetaNamespaceTool struct{…}

Groups function/custom tools under a shared namespace.

Description string

A description of the namespace shown to the model.

minLength1
Name string

The namespace name used in tool calls (for example, crm).

minLength1
Tools []BetaNamespaceToolToolUnion

The function/custom tools available inside this namespace.

One of the following:
type BetaNamespaceToolToolFunction struct{…}
Name string
maxLength128
minLength1
Type Function
AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaNamespaceToolToolFunctionAllowedCallerDirect BetaNamespaceToolToolFunctionAllowedCaller = "direct"
const BetaNamespaceToolToolFunctionAllowedCallerProgrammatic BetaNamespaceToolToolFunctionAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this function should be deferred and discovered via tool search.

Description stringOptional
OutputSchema map[string, any]Optional

A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

Parameters anyOptional
Strict boolOptional

Whether to enforce strict parameter validation. If omitted, Responses attempts to use strict validation when the schema is compatible, and falls back to non-strict validation otherwise.

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaCustomToolAllowedCallerDirect BetaCustomToolAllowedCaller = "direct"
const BetaCustomToolAllowedCallerProgrammatic BetaCustomToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this tool should be deferred and discovered via tool search.

Description stringOptional

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

Format BetaCustomToolFormatUnionOptional

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

One of the following:
type BetaCustomToolFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

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

One of the following:
const BetaCustomToolFormatGrammarSyntaxLark BetaCustomToolFormatGrammarSyntax = "lark"
const BetaCustomToolFormatGrammarSyntaxRegex BetaCustomToolFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

Type Namespace

The type of the tool. Always namespace.

type BetaToolSearchTool struct{…}

Hosted or BYOT tool search configuration for deferred tools.

Type ToolSearch

The type of the tool. Always tool_search.

Description stringOptional

Description shown to the model for a client-executed tool search tool.

Execution BetaToolSearchToolExecutionOptional

Whether tool search is executed by the server or by the client.

One of the following:
const BetaToolSearchToolExecutionServer BetaToolSearchToolExecution = "server"
const BetaToolSearchToolExecutionClient BetaToolSearchToolExecution = "client"
Parameters anyOptional

Parameter schema for a client-executed tool search tool.

type BetaWebSearchPreviewTool struct{…}

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

Type BetaWebSearchPreviewToolType

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

One of the following:
const BetaWebSearchPreviewToolTypeWebSearchPreview BetaWebSearchPreviewToolType = "web_search_preview"
const BetaWebSearchPreviewToolTypeWebSearchPreview2025_03_11 BetaWebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContentTypes []stringOptional
One of the following:
const BetaWebSearchPreviewToolSearchContentTypeText BetaWebSearchPreviewToolSearchContentType = "text"
const BetaWebSearchPreviewToolSearchContentTypeImage BetaWebSearchPreviewToolSearchContentType = "image"
SearchContextSize BetaWebSearchPreviewToolSearchContextSizeOptional

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.

One of the following:
const BetaWebSearchPreviewToolSearchContextSizeLow BetaWebSearchPreviewToolSearchContextSize = "low"
const BetaWebSearchPreviewToolSearchContextSizeMedium BetaWebSearchPreviewToolSearchContextSize = "medium"
const BetaWebSearchPreviewToolSearchContextSizeHigh BetaWebSearchPreviewToolSearchContextSize = "high"
UserLocation BetaWebSearchPreviewToolUserLocationOptional

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 BetaApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaApplyPatchToolAllowedCallerDirect BetaApplyPatchToolAllowedCaller = "direct"
const BetaApplyPatchToolAllowedCallerProgrammatic BetaApplyPatchToolAllowedCaller = "programmatic"
Type AdditionalTools

The type of the item. Always additional_tools.

Agent BetaResponseOutputItemAdditionalToolsAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

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

Agent BetaResponseCompactionItemAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

CreatedBy stringOptional

The identifier of the actor that created the item.

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

One of the following:
const BetaResponseOutputItemImageGenerationCallStatusInProgress BetaResponseOutputItemImageGenerationCallStatus = "in_progress"
const BetaResponseOutputItemImageGenerationCallStatusCompleted BetaResponseOutputItemImageGenerationCallStatus = "completed"
const BetaResponseOutputItemImageGenerationCallStatusGenerating BetaResponseOutputItemImageGenerationCallStatus = "generating"
const BetaResponseOutputItemImageGenerationCallStatusFailed BetaResponseOutputItemImageGenerationCallStatus = "failed"
Type ImageGenerationCall

The type of the image generation call. Always image_generation_call.

Agent BetaResponseOutputItemImageGenerationCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseCodeInterpreterToolCall 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 []BetaResponseCodeInterpreterToolCallOutputUnion

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

One of the following:
type BetaResponseCodeInterpreterToolCallOutputLogs 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 BetaResponseCodeInterpreterToolCallOutputImage 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.

formaturi
Status BetaResponseCodeInterpreterToolCallStatus

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

One of the following:
const BetaResponseCodeInterpreterToolCallStatusInProgress BetaResponseCodeInterpreterToolCallStatus = "in_progress"
const BetaResponseCodeInterpreterToolCallStatusCompleted BetaResponseCodeInterpreterToolCallStatus = "completed"
const BetaResponseCodeInterpreterToolCallStatusIncomplete BetaResponseCodeInterpreterToolCallStatus = "incomplete"
const BetaResponseCodeInterpreterToolCallStatusInterpreting BetaResponseCodeInterpreterToolCallStatus = "interpreting"
const BetaResponseCodeInterpreterToolCallStatusFailed BetaResponseCodeInterpreterToolCallStatus = "failed"
Type CodeInterpreterCall

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

Agent BetaResponseCodeInterpreterToolCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseOutputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action BetaResponseOutputItemLocalShellCallAction

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.

One of the following:
const BetaResponseOutputItemLocalShellCallStatusInProgress BetaResponseOutputItemLocalShellCallStatus = "in_progress"
const BetaResponseOutputItemLocalShellCallStatusCompleted BetaResponseOutputItemLocalShellCallStatus = "completed"
const BetaResponseOutputItemLocalShellCallStatusIncomplete BetaResponseOutputItemLocalShellCallStatus = "incomplete"
Type LocalShellCall

The type of the local shell call. Always local_shell_call.

Agent BetaResponseOutputItemLocalShellCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

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

Agent BetaResponseOutputItemLocalShellCallOutputAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Status stringOptional

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

One of the following:
const BetaResponseOutputItemLocalShellCallOutputStatusInProgress BetaResponseOutputItemLocalShellCallOutputStatus = "in_progress"
const BetaResponseOutputItemLocalShellCallOutputStatusCompleted BetaResponseOutputItemLocalShellCallOutputStatus = "completed"
const BetaResponseOutputItemLocalShellCallOutputStatusIncomplete BetaResponseOutputItemLocalShellCallOutputStatus = "incomplete"
type BetaResponseFunctionShellToolCall 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 BetaResponseFunctionShellToolCallAction

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.

Environment BetaResponseFunctionShellToolCallEnvironmentUnion

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

One of the following:
type BetaResponseLocalEnvironment struct{…}

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

Type Local

The environment type. Always local.

type BetaResponseContainerReference struct{…}

Represents a container created with /v1/containers.

ContainerID string
Type ContainerReference

The environment type. Always container_reference.

Status BetaResponseFunctionShellToolCallStatus

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

One of the following:
const BetaResponseFunctionShellToolCallStatusInProgress BetaResponseFunctionShellToolCallStatus = "in_progress"
const BetaResponseFunctionShellToolCallStatusCompleted BetaResponseFunctionShellToolCallStatus = "completed"
const BetaResponseFunctionShellToolCallStatusIncomplete BetaResponseFunctionShellToolCallStatus = "incomplete"
Type ShellCall

The type of the item. Always shell_call.

Agent BetaResponseFunctionShellToolCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseFunctionShellToolCallCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseFunctionShellToolCallCallerDirect struct{…}
Type Direct
type BetaResponseFunctionShellToolCallCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

Type Program
CreatedBy stringOptional

The ID of the entity that created this tool call.

type BetaResponseFunctionShellToolCallOutput 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 []BetaResponseFunctionShellToolCallOutputOutput

An array of shell call output contents

Outcome BetaResponseFunctionShellToolCallOutputOutputOutcomeUnion

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

One of the following:
type BetaResponseFunctionShellToolCallOutputOutputOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type BetaResponseFunctionShellToolCallOutputOutputOutcomeExit 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 BetaResponseFunctionShellToolCallOutputStatus

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

One of the following:
const BetaResponseFunctionShellToolCallOutputStatusInProgress BetaResponseFunctionShellToolCallOutputStatus = "in_progress"
const BetaResponseFunctionShellToolCallOutputStatusCompleted BetaResponseFunctionShellToolCallOutputStatus = "completed"
const BetaResponseFunctionShellToolCallOutputStatusIncomplete BetaResponseFunctionShellToolCallOutputStatus = "incomplete"
Type ShellCallOutput

The type of the shell call output. Always shell_call_output.

Agent BetaResponseFunctionShellToolCallOutputAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseFunctionShellToolCallOutputCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseFunctionShellToolCallOutputCallerDirect struct{…}
Type Direct
type BetaResponseFunctionShellToolCallOutputCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

Type Program
CreatedBy stringOptional

The identifier of the actor that created the item.

type BetaResponseApplyPatchToolCall 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 BetaResponseApplyPatchToolCallOperationUnion

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

One of the following:
type BetaResponseApplyPatchToolCallOperationCreateFile 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 BetaResponseApplyPatchToolCallOperationDeleteFile 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 BetaResponseApplyPatchToolCallOperationUpdateFile 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 BetaResponseApplyPatchToolCallStatus

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

One of the following:
const BetaResponseApplyPatchToolCallStatusInProgress BetaResponseApplyPatchToolCallStatus = "in_progress"
const BetaResponseApplyPatchToolCallStatusCompleted BetaResponseApplyPatchToolCallStatus = "completed"
Type ApplyPatchCall

The type of the item. Always apply_patch_call.

Agent BetaResponseApplyPatchToolCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseApplyPatchToolCallCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseApplyPatchToolCallCallerDirect struct{…}
Type Direct
type BetaResponseApplyPatchToolCallCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

Type Program
CreatedBy stringOptional

The ID of the entity that created this tool call.

type BetaResponseApplyPatchToolCallOutput 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 BetaResponseApplyPatchToolCallOutputStatus

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

One of the following:
const BetaResponseApplyPatchToolCallOutputStatusCompleted BetaResponseApplyPatchToolCallOutputStatus = "completed"
const BetaResponseApplyPatchToolCallOutputStatusFailed BetaResponseApplyPatchToolCallOutputStatus = "failed"
Type ApplyPatchCallOutput

The type of the item. Always apply_patch_call_output.

Agent BetaResponseApplyPatchToolCallOutputAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseApplyPatchToolCallOutputCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseApplyPatchToolCallOutputCallerDirect struct{…}
Type Direct
type BetaResponseApplyPatchToolCallOutputCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

Type Program
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 BetaResponseOutputItemMcpCall 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.

Agent BetaResponseOutputItemMcpCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

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.

One of the following:
const BetaResponseOutputItemMcpCallStatusInProgress BetaResponseOutputItemMcpCallStatus = "in_progress"
const BetaResponseOutputItemMcpCallStatusCompleted BetaResponseOutputItemMcpCallStatus = "completed"
const BetaResponseOutputItemMcpCallStatusIncomplete BetaResponseOutputItemMcpCallStatus = "incomplete"
const BetaResponseOutputItemMcpCallStatusCalling BetaResponseOutputItemMcpCallStatus = "calling"
const BetaResponseOutputItemMcpCallStatusFailed BetaResponseOutputItemMcpCallStatus = "failed"
type BetaResponseOutputItemMcpListTools 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 []BetaResponseOutputItemMcpListToolsTool

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.

Agent BetaResponseOutputItemMcpListToolsAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Error stringOptional

Error message if the server could not list tools.

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

Agent BetaResponseOutputItemMcpApprovalRequestAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

type BetaResponseOutputItemMcpApprovalResponse struct{…}

A response to an MCP approval request.

ID string

The unique ID of the approval response

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.

Agent BetaResponseOutputItemMcpApprovalResponseAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Reason stringOptional

Optional reason for the decision.

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

Agent BetaResponseCustomToolCallAgentOptional

The agent that produced this item.

AgentName string

The canonical name of the agent that produced this item.

Caller BetaResponseCustomToolCallCallerUnionOptional

The execution context that produced this tool call.

One of the following:
type BetaResponseCustomToolCallCallerDirect struct{…}
Type Direct
type BetaResponseCustomToolCallCallerProgram struct{…}
CallerID string

The call ID of the program item that produced this tool call.

Type Program
Namespace stringOptional

The namespace of the custom tool being called.

type BetaResponseCustomToolCallOutputItem struct{…}

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

ID string

The unique ID of the custom tool call output item.

Status string

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

One of the following:
const BetaResponseCustomToolCallOutputItemStatusInProgress BetaResponseCustomToolCallOutputItemStatus = "in_progress"
const BetaResponseCustomToolCallOutputItemStatusCompleted BetaResponseCustomToolCallOutputItemStatus = "completed"
const BetaResponseCustomToolCallOutputItemStatusIncomplete BetaResponseCustomToolCallOutputItemStatus = "incomplete"
CreatedBy stringOptional

The identifier of the actor that created the item.

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 BetaResponseToolChoiceUnion

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.

One of the following:
type BetaToolChoiceOptions 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.

One of the following:
const BetaToolChoiceOptionsNone BetaToolChoiceOptions = "none"
const BetaToolChoiceOptionsAuto BetaToolChoiceOptions = "auto"
const BetaToolChoiceOptionsRequired BetaToolChoiceOptions = "required"
type BetaToolChoiceAllowed struct{…}

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

Mode BetaToolChoiceAllowedMode

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.

One of the following:
const BetaToolChoiceAllowedModeAuto BetaToolChoiceAllowedMode = "auto"
const BetaToolChoiceAllowedModeRequired BetaToolChoiceAllowedMode = "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 BetaToolChoiceTypes struct{…}

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

Type BetaToolChoiceTypesType

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
  • computer_use_preview
  • computer_use
  • code_interpreter
  • image_generation
One of the following:
const BetaToolChoiceTypesTypeFileSearch BetaToolChoiceTypesType = "file_search"
const BetaToolChoiceTypesTypeWebSearchPreview BetaToolChoiceTypesType = "web_search_preview"
const BetaToolChoiceTypesTypeComputer BetaToolChoiceTypesType = "computer"
const BetaToolChoiceTypesTypeComputerUsePreview BetaToolChoiceTypesType = "computer_use_preview"
const BetaToolChoiceTypesTypeComputerUse BetaToolChoiceTypesType = "computer_use"
const BetaToolChoiceTypesTypeWebSearchPreview2025_03_11 BetaToolChoiceTypesType = "web_search_preview_2025_03_11"
const BetaToolChoiceTypesTypeImageGeneration BetaToolChoiceTypesType = "image_generation"
const BetaToolChoiceTypesTypeCodeInterpreter BetaToolChoiceTypesType = "code_interpreter"
type BetaToolChoiceFunction 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 BetaToolChoiceMcp 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 BetaToolChoiceCustom 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 BetaResponseToolChoiceBetaSpecificProgrammaticToolCallingParam struct{…}
Type ProgrammaticToolCalling

The tool to call. Always programmatic_tool_calling.

type BetaToolChoiceApplyPatch 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 BetaToolChoiceShell struct{…}

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

Type Shell

The tool to call. Always shell.

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.
One of the following:
type BetaFunctionTool 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 strict parameter validation is enforced for this function tool.

Type Function

The type of the function tool. Always function.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaFunctionToolAllowedCallerDirect BetaFunctionToolAllowedCaller = "direct"
const BetaFunctionToolAllowedCallerProgrammatic BetaFunctionToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this function is deferred and loaded via tool search.

Description stringOptional

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

OutputSchema map[string, any]Optional

A JSON schema object describing the JSON value encoded in string outputs for this function.

type BetaFileSearchTool 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 BetaFileSearchToolFiltersUnionOptional

A filter to apply.

One of the following:
type BetaFileSearchToolFiltersComparisonFilter 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 string

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
One of the following:
const BetaFileSearchToolFiltersComparisonFilterTypeEq BetaFileSearchToolFiltersComparisonFilterType = "eq"
const BetaFileSearchToolFiltersComparisonFilterTypeNe BetaFileSearchToolFiltersComparisonFilterType = "ne"
const BetaFileSearchToolFiltersComparisonFilterTypeGt BetaFileSearchToolFiltersComparisonFilterType = "gt"
const BetaFileSearchToolFiltersComparisonFilterTypeGte BetaFileSearchToolFiltersComparisonFilterType = "gte"
const BetaFileSearchToolFiltersComparisonFilterTypeLt BetaFileSearchToolFiltersComparisonFilterType = "lt"
const BetaFileSearchToolFiltersComparisonFilterTypeLte BetaFileSearchToolFiltersComparisonFilterType = "lte"
const BetaFileSearchToolFiltersComparisonFilterTypeIn BetaFileSearchToolFiltersComparisonFilterType = "in"
const BetaFileSearchToolFiltersComparisonFilterTypeNin BetaFileSearchToolFiltersComparisonFilterType = "nin"
Value BetaFileSearchToolFiltersComparisonFilterValueUnion

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

One of the following:
string
float64
bool
type BetaFileSearchToolFiltersComparisonFilterValueArray []BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion
One of the following:
string
float64
type BetaFileSearchToolFiltersCompoundFilter struct{…}

Combine multiple filters using and or or.

Filters []BetaFileSearchToolFiltersCompoundFilterFilter

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

One of the following:
type BetaFileSearchToolFiltersCompoundFilterFilter 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 string

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
One of the following:
const BetaFileSearchToolFiltersCompoundFilterFilterTypeEq BetaFileSearchToolFiltersCompoundFilterFilterType = "eq"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeNe BetaFileSearchToolFiltersCompoundFilterFilterType = "ne"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeGt BetaFileSearchToolFiltersCompoundFilterFilterType = "gt"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeGte BetaFileSearchToolFiltersCompoundFilterFilterType = "gte"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeLt BetaFileSearchToolFiltersCompoundFilterFilterType = "lt"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeLte BetaFileSearchToolFiltersCompoundFilterFilterType = "lte"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeIn BetaFileSearchToolFiltersCompoundFilterFilterType = "in"
const BetaFileSearchToolFiltersCompoundFilterFilterTypeNin BetaFileSearchToolFiltersCompoundFilterFilterType = "nin"
Value BetaFileSearchToolFiltersCompoundFilterFilterValueUnion

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

One of the following:
string
float64
bool
type BetaFileSearchToolFiltersCompoundFilterFilterValueArray []BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion
One of the following:
string
float64
Type string

Type of operation: and or or.

One of the following:
const BetaFileSearchToolFiltersCompoundFilterTypeAnd BetaFileSearchToolFiltersCompoundFilterType = "and"
const BetaFileSearchToolFiltersCompoundFilterTypeOr BetaFileSearchToolFiltersCompoundFilterType = "or"
MaxNumResults int64Optional

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

RankingOptions BetaFileSearchToolRankingOptionsOptional

Ranking options for search.

Ranker stringOptional

The ranker to use for the file search.

One of the following:
const BetaFileSearchToolRankingOptionsRankerAuto BetaFileSearchToolRankingOptionsRanker = "auto"
const BetaFileSearchToolRankingOptionsRankerDefault2024_11_15 BetaFileSearchToolRankingOptionsRanker = "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 BetaComputerTool struct{…}

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

Type Computer

The type of the computer tool. Always computer.

type BetaComputerUsePreviewTool 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 BetaComputerUsePreviewToolEnvironment

The type of computer environment to control.

One of the following:
const BetaComputerUsePreviewToolEnvironmentWindows BetaComputerUsePreviewToolEnvironment = "windows"
const BetaComputerUsePreviewToolEnvironmentMac BetaComputerUsePreviewToolEnvironment = "mac"
const BetaComputerUsePreviewToolEnvironmentLinux BetaComputerUsePreviewToolEnvironment = "linux"
const BetaComputerUsePreviewToolEnvironmentUbuntu BetaComputerUsePreviewToolEnvironment = "ubuntu"
const BetaComputerUsePreviewToolEnvironmentBrowser BetaComputerUsePreviewToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type BetaWebSearchTool struct{…}

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

Type BetaWebSearchToolType

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

One of the following:
const BetaWebSearchToolTypeWebSearch BetaWebSearchToolType = "web_search"
const BetaWebSearchToolTypeWebSearch2025_08_26 BetaWebSearchToolType = "web_search_2025_08_26"
Filters BetaWebSearchToolFiltersOptional

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 BetaWebSearchToolSearchContextSizeOptional

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.

One of the following:
const BetaWebSearchToolSearchContextSizeLow BetaWebSearchToolSearchContextSize = "low"
const BetaWebSearchToolSearchContextSizeMedium BetaWebSearchToolSearchContextSize = "medium"
const BetaWebSearchToolSearchContextSizeHigh BetaWebSearchToolSearchContextSize = "high"
UserLocation BetaWebSearchToolUserLocationOptional

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaToolMcpAllowedCallerDirect BetaToolMcpAllowedCaller = "direct"
const BetaToolMcpAllowedCallerProgrammatic BetaToolMcpAllowedCaller = "programmatic"
AllowedTools BetaToolMcpAllowedToolsUnionOptional

List of allowed tool names or a filter object.

One of the following:
type BetaToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type BetaToolMcpAllowedToolsMcpToolFilter 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, connector_id, or tunnel_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
One of the following:
const BetaToolMcpConnectorIDConnectorDropbox BetaToolMcpConnectorID = "connector_dropbox"
const BetaToolMcpConnectorIDConnectorGmail BetaToolMcpConnectorID = "connector_gmail"
const BetaToolMcpConnectorIDConnectorGooglecalendar BetaToolMcpConnectorID = "connector_googlecalendar"
const BetaToolMcpConnectorIDConnectorGoogledrive BetaToolMcpConnectorID = "connector_googledrive"
const BetaToolMcpConnectorIDConnectorMicrosoftteams BetaToolMcpConnectorID = "connector_microsoftteams"
const BetaToolMcpConnectorIDConnectorOutlookcalendar BetaToolMcpConnectorID = "connector_outlookcalendar"
const BetaToolMcpConnectorIDConnectorOutlookemail BetaToolMcpConnectorID = "connector_outlookemail"
const BetaToolMcpConnectorIDConnectorSharepoint BetaToolMcpConnectorID = "connector_sharepoint"
DeferLoading boolOptional

Whether this MCP tool is deferred and discovered via tool search.

Headers map[string, string]Optional

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

RequireApproval BetaToolMcpRequireApprovalUnionOptional

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

One of the following:
type BetaToolMcpRequireApprovalMcpToolApprovalFilter 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 BetaToolMcpRequireApprovalMcpToolApprovalFilterAlwaysOptional

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 BetaToolMcpRequireApprovalMcpToolApprovalFilterNeverOptional

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

One of the following:
const BetaToolMcpRequireApprovalMcpToolApprovalSettingAlways BetaToolMcpRequireApprovalMcpToolApprovalSetting = "always"
const BetaToolMcpRequireApprovalMcpToolApprovalSettingNever BetaToolMcpRequireApprovalMcpToolApprovalSetting = "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, connector_id, or tunnel_id must be provided.

formaturi
TunnelID stringOptional

The Secure MCP Tunnel ID to use instead of a direct server URL. One of server_url, connector_id, or tunnel_id must be provided.

type BetaToolCodeInterpreter struct{…}

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

Container BetaToolCodeInterpreterContainerUnion

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.

One of the following:
string
type BetaToolCodeInterpreterContainerCodeInterpreterToolAuto 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.

One of the following:
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g BetaToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
NetworkPolicy BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionOptional

Network access policy for the container.

One of the following:
type BetaContainerNetworkPolicyDisabled struct{…}
Type Disabled

Disable outbound network access. Always disabled.

type BetaContainerNetworkPolicyAllowlist struct{…}
AllowedDomains []string

A list of allowed domains when type is allowlist.

Type Allowlist

Allow outbound network access only to specified domains. Always allowlist.

Optional domain-scoped secrets for allowlisted domains.

Domain string

The domain associated with the secret.

minLength1
Name string

The name of the secret to inject for the domain.

minLength1
Value string

The secret value to inject for the domain.

maxLength10485760
minLength1
Type CodeInterpreter

The type of the code interpreter tool. Always code_interpreter.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaToolCodeInterpreterAllowedCallerDirect BetaToolCodeInterpreterAllowedCaller = "direct"
const BetaToolCodeInterpreterAllowedCallerProgrammatic BetaToolCodeInterpreterAllowedCaller = "programmatic"
type BetaToolProgrammaticToolCalling struct{…}
Type ProgrammaticToolCalling

The type of the tool. Always programmatic_tool_calling.

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

One of the following:
const BetaToolImageGenerationActionGenerate BetaToolImageGenerationAction = "generate"
const BetaToolImageGenerationActionEdit BetaToolImageGenerationAction = "edit"
const BetaToolImageGenerationActionAuto BetaToolImageGenerationAction = "auto"
Background stringOptional

Allows to set transparency for the background of the generated image(s). This parameter is only supported for GPT image models that support transparent backgrounds. Must be one of transparent, opaque, or auto (default value). When auto is used, the model will automatically determine the best background for the image.

gpt-image-2 and gpt-image-2-2026-04-21 do not support transparent backgrounds. Requests with background set to transparent will return an error for these models; use opaque or auto instead.

If transparent, the output format needs to support transparency, so it should be set to either png (default value) or webp.

One of the following:
const BetaToolImageGenerationBackgroundTransparent BetaToolImageGenerationBackground = "transparent"
const BetaToolImageGenerationBackgroundOpaque BetaToolImageGenerationBackground = "opaque"
const BetaToolImageGenerationBackgroundAuto BetaToolImageGenerationBackground = "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.

One of the following:
const BetaToolImageGenerationInputFidelityHigh BetaToolImageGenerationInputFidelity = "high"
const BetaToolImageGenerationInputFidelityLow BetaToolImageGenerationInputFidelity = "low"
InputImageMask BetaToolImageGenerationInputImageMaskOptional

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.

One of the following:
string
string
One of the following:
const BetaToolImageGenerationModelGPTImage1 BetaToolImageGenerationModel = "gpt-image-1"
const BetaToolImageGenerationModelGPTImage1Mini BetaToolImageGenerationModel = "gpt-image-1-mini"
const BetaToolImageGenerationModelGPTImage2 BetaToolImageGenerationModel = "gpt-image-2"
const BetaToolImageGenerationModelGPTImage2_2026_04_21 BetaToolImageGenerationModel = "gpt-image-2-2026-04-21"
const BetaToolImageGenerationModelGPTImage1_5 BetaToolImageGenerationModel = "gpt-image-1.5"
const BetaToolImageGenerationModelChatgptImageLatest BetaToolImageGenerationModel = "chatgpt-image-latest"
Moderation stringOptional

Moderation level for the generated image. Default: auto.

One of the following:
const BetaToolImageGenerationModerationAuto BetaToolImageGenerationModeration = "auto"
const BetaToolImageGenerationModerationLow BetaToolImageGenerationModeration = "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.

One of the following:
const BetaToolImageGenerationOutputFormatPNG BetaToolImageGenerationOutputFormat = "png"
const BetaToolImageGenerationOutputFormatWebP BetaToolImageGenerationOutputFormat = "webp"
const BetaToolImageGenerationOutputFormatJPEG BetaToolImageGenerationOutputFormat = "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.

One of the following:
const BetaToolImageGenerationQualityLow BetaToolImageGenerationQuality = "low"
const BetaToolImageGenerationQualityMedium BetaToolImageGenerationQuality = "medium"
const BetaToolImageGenerationQualityHigh BetaToolImageGenerationQuality = "high"
const BetaToolImageGenerationQualityAuto BetaToolImageGenerationQuality = "auto"
Size stringOptional

The size of the generated images. For gpt-image-2 and gpt-image-2-2026-04-21, arbitrary resolutions are supported as WIDTHxHEIGHT strings, for example 1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above 2560x1440 are experimental, and the maximum supported resolution is 3840x2160. The requested size must also satisfy the model’s current pixel and edge limits. The standard sizes 1024x1024, 1536x1024, and 1024x1536 are supported by the GPT image models; auto is supported for models that allow automatic sizing. For dall-e-2, use one of 256x256, 512x512, or 1024x1024. For dall-e-3, use one of 1024x1024, 1792x1024, or 1024x1792.

One of the following:
string
string
One of the following:
const BetaToolImageGenerationSize1024x1024 BetaToolImageGenerationSize = "1024x1024"
const BetaToolImageGenerationSize1024x1536 BetaToolImageGenerationSize = "1024x1536"
const BetaToolImageGenerationSize1536x1024 BetaToolImageGenerationSize = "1536x1024"
const BetaToolImageGenerationSizeAuto BetaToolImageGenerationSize = "auto"
type BetaToolLocalShell 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 BetaFunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaFunctionShellToolAllowedCallerDirect BetaFunctionShellToolAllowedCaller = "direct"
const BetaFunctionShellToolAllowedCallerProgrammatic BetaFunctionShellToolAllowedCaller = "programmatic"
Environment BetaFunctionShellToolEnvironmentUnionOptional
One of the following:
type BetaContainerAuto struct{…}
Type ContainerAuto

Automatically creates a container for this request

FileIDs []stringOptional

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

MemoryLimit BetaContainerAutoMemoryLimitOptional

The memory limit for the container.

One of the following:
const BetaContainerAutoMemoryLimit1g BetaContainerAutoMemoryLimit = "1g"
const BetaContainerAutoMemoryLimit4g BetaContainerAutoMemoryLimit = "4g"
const BetaContainerAutoMemoryLimit16g BetaContainerAutoMemoryLimit = "16g"
const BetaContainerAutoMemoryLimit64g BetaContainerAutoMemoryLimit = "64g"
NetworkPolicy BetaContainerAutoNetworkPolicyUnionOptional

Network access policy for the container.

One of the following:
type BetaContainerNetworkPolicyDisabled struct{…}
Type Disabled

Disable outbound network access. Always disabled.

type BetaContainerNetworkPolicyAllowlist struct{…}
AllowedDomains []string

A list of allowed domains when type is allowlist.

Type Allowlist

Allow outbound network access only to specified domains. Always allowlist.

Optional domain-scoped secrets for allowlisted domains.

Domain string

The domain associated with the secret.

minLength1
Name string

The name of the secret to inject for the domain.

minLength1
Value string

The secret value to inject for the domain.

maxLength10485760
minLength1
Skills []BetaContainerAutoSkillUnionOptional

An optional list of skills referenced by id or inline data.

One of the following:
type BetaSkillReference struct{…}
SkillID string

The ID of the referenced skill.

maxLength64
minLength1
Type SkillReference

References a skill created with the /v1/skills endpoint.

Version stringOptional

Optional skill version. Use a positive integer or ‘latest’. Omit for default.

type BetaInlineSkill struct{…}
Description string

The description of the skill.

Name string

The name of the skill.

Inline skill payload

Data string

Base64-encoded skill zip bundle.

maxLength70254592
minLength1
MediaType ApplicationZip

The media type of the inline skill payload. Must be application/zip.

Type Base64

The type of the inline skill source. Must be base64.

Type Inline

Defines an inline skill for this request.

type BetaLocalEnvironment struct{…}
Type Local

Use a local computer environment.

Skills []BetaLocalSkillOptional

An optional list of skills.

Description string

The description of the skill.

Name string

The name of the skill.

Path string

The path to the directory containing the skill.

type BetaContainerReference struct{…}
ContainerID string

The ID of the referenced container.

Type ContainerReference

References a container created with the /v1/containers endpoint

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaCustomToolAllowedCallerDirect BetaCustomToolAllowedCaller = "direct"
const BetaCustomToolAllowedCallerProgrammatic BetaCustomToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this tool should be deferred and discovered via tool search.

Description stringOptional

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

Format BetaCustomToolFormatUnionOptional

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

One of the following:
type BetaCustomToolFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

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

One of the following:
const BetaCustomToolFormatGrammarSyntaxLark BetaCustomToolFormatGrammarSyntax = "lark"
const BetaCustomToolFormatGrammarSyntaxRegex BetaCustomToolFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

type BetaNamespaceTool struct{…}

Groups function/custom tools under a shared namespace.

Description string

A description of the namespace shown to the model.

minLength1
Name string

The namespace name used in tool calls (for example, crm).

minLength1
Tools []BetaNamespaceToolToolUnion

The function/custom tools available inside this namespace.

One of the following:
type BetaNamespaceToolToolFunction struct{…}
Name string
maxLength128
minLength1
Type Function
AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaNamespaceToolToolFunctionAllowedCallerDirect BetaNamespaceToolToolFunctionAllowedCaller = "direct"
const BetaNamespaceToolToolFunctionAllowedCallerProgrammatic BetaNamespaceToolToolFunctionAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this function should be deferred and discovered via tool search.

Description stringOptional
OutputSchema map[string, any]Optional

A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

Parameters anyOptional
Strict boolOptional

Whether to enforce strict parameter validation. If omitted, Responses attempts to use strict validation when the schema is compatible, and falls back to non-strict validation otherwise.

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

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaCustomToolAllowedCallerDirect BetaCustomToolAllowedCaller = "direct"
const BetaCustomToolAllowedCallerProgrammatic BetaCustomToolAllowedCaller = "programmatic"
DeferLoading boolOptional

Whether this tool should be deferred and discovered via tool search.

Description stringOptional

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

Format BetaCustomToolFormatUnionOptional

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

One of the following:
type BetaCustomToolFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

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

One of the following:
const BetaCustomToolFormatGrammarSyntaxLark BetaCustomToolFormatGrammarSyntax = "lark"
const BetaCustomToolFormatGrammarSyntaxRegex BetaCustomToolFormatGrammarSyntax = "regex"
Type Grammar

Grammar format. Always grammar.

Type Namespace

The type of the tool. Always namespace.

type BetaToolSearchTool struct{…}

Hosted or BYOT tool search configuration for deferred tools.

Type ToolSearch

The type of the tool. Always tool_search.

Description stringOptional

Description shown to the model for a client-executed tool search tool.

Execution BetaToolSearchToolExecutionOptional

Whether tool search is executed by the server or by the client.

One of the following:
const BetaToolSearchToolExecutionServer BetaToolSearchToolExecution = "server"
const BetaToolSearchToolExecutionClient BetaToolSearchToolExecution = "client"
Parameters anyOptional

Parameter schema for a client-executed tool search tool.

type BetaWebSearchPreviewTool struct{…}

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

Type BetaWebSearchPreviewToolType

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

One of the following:
const BetaWebSearchPreviewToolTypeWebSearchPreview BetaWebSearchPreviewToolType = "web_search_preview"
const BetaWebSearchPreviewToolTypeWebSearchPreview2025_03_11 BetaWebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContentTypes []stringOptional
One of the following:
const BetaWebSearchPreviewToolSearchContentTypeText BetaWebSearchPreviewToolSearchContentType = "text"
const BetaWebSearchPreviewToolSearchContentTypeImage BetaWebSearchPreviewToolSearchContentType = "image"
SearchContextSize BetaWebSearchPreviewToolSearchContextSizeOptional

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.

One of the following:
const BetaWebSearchPreviewToolSearchContextSizeLow BetaWebSearchPreviewToolSearchContextSize = "low"
const BetaWebSearchPreviewToolSearchContextSizeMedium BetaWebSearchPreviewToolSearchContextSize = "medium"
const BetaWebSearchPreviewToolSearchContextSizeHigh BetaWebSearchPreviewToolSearchContextSize = "high"
UserLocation BetaWebSearchPreviewToolUserLocationOptional

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 BetaApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

AllowedCallers []stringOptional

The tool invocation context(s).

One of the following:
const BetaApplyPatchToolAllowedCallerDirect BetaApplyPatchToolAllowedCaller = "direct"
const BetaApplyPatchToolAllowedCallerProgrammatic BetaApplyPatchToolAllowedCaller = "programmatic"
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.

formatunixtime
Conversation BetaResponseConversationOptional

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.

Moderation BetaResponseModerationOptional

Moderation results for the response input and output, if moderated completions were requested.

Input BetaResponseModerationInputUnion

Moderation for the response input.

One of the following:
type BetaResponseModerationInputModerationResult struct{…}

A moderation result produced for the response input or output.

Categories map[string, bool]

A dictionary of moderation categories to booleans, True if the input is flagged under this category.

CategoryAppliedInputTypes map[string, []string]

Which modalities of input are reflected by the score for each category.

One of the following:
const BetaResponseModerationInputModerationResultCategoryAppliedInputTypeText BetaResponseModerationInputModerationResultCategoryAppliedInputType = "text"
const BetaResponseModerationInputModerationResultCategoryAppliedInputTypeImage BetaResponseModerationInputModerationResultCategoryAppliedInputType = "image"
CategoryScores map[string, float64]

A dictionary of moderation categories to scores.

Flagged bool

A boolean indicating whether the content was flagged by any category.

Model string

The moderation model that produced this result.

Type ModerationResult

The object type, which was always moderation_result for successful moderation results.

type BetaResponseModerationInputError struct{…}

An error produced while attempting moderation for the response input or output.

Code string

The error code.

Message string

The error message.

Type Error

The object type, which was always error for moderation failures.

Output BetaResponseModerationOutputUnion

Moderation for the response output.

One of the following:
type BetaResponseModerationOutputModerationResult struct{…}

A moderation result produced for the response input or output.

Categories map[string, bool]

A dictionary of moderation categories to booleans, True if the input is flagged under this category.

CategoryAppliedInputTypes map[string, []string]

Which modalities of input are reflected by the score for each category.

One of the following:
const BetaResponseModerationOutputModerationResultCategoryAppliedInputTypeText BetaResponseModerationOutputModerationResultCategoryAppliedInputType = "text"
const BetaResponseModerationOutputModerationResultCategoryAppliedInputTypeImage BetaResponseModerationOutputModerationResultCategoryAppliedInputType = "image"
CategoryScores map[string, float64]

A dictionary of moderation categories to scores.

Flagged bool

A boolean indicating whether the content was flagged by any category.

Model string

The moderation model that produced this result.

Type ModerationResult

The object type, which was always moderation_result for successful moderation results.

type BetaResponseModerationOutputError struct{…}

An error produced while attempting moderation for the response input or output.

Code string

The error code.

Message string

The error message.

Type Error

The object type, which was always error for moderation failures.

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 BetaResponsePromptOptional

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

ID string

The unique identifier of the prompt template to use.

Variables map[string, BetaResponsePromptVariableUnion]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.

One of the following:
string
type BetaResponseInputText 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.

PromptCacheBreakpoint BetaResponseInputTextPromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputImage struct{…}

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

Detail BetaResponseInputImageDetail

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

One of the following:
const BetaResponseInputImageDetailLow BetaResponseInputImageDetail = "low"
const BetaResponseInputImageDetailHigh BetaResponseInputImageDetail = "high"
const BetaResponseInputImageDetailAuto BetaResponseInputImageDetail = "auto"
const BetaResponseInputImageDetailOriginal BetaResponseInputImageDetail = "original"
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.

formaturi
PromptCacheBreakpoint BetaResponseInputImagePromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

type BetaResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

Detail BetaResponseInputFileDetailOptional

The detail level of the file to be sent to the model. Use auto to let the system select the detail level; for GPT-5.6 and later models, auto uses high-quality rendering, which may increase input token usage. Use low for lower-cost rendering, or high to render the file at higher quality. Defaults to auto.

One of the following:
const BetaResponseInputFileDetailAuto BetaResponseInputFileDetail = "auto"
const BetaResponseInputFileDetailLow BetaResponseInputFileDetail = "low"
const BetaResponseInputFileDetailHigh BetaResponseInputFileDetail = "high"
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.

formaturi
Filename stringOptional

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

PromptCacheBreakpoint BetaResponseInputFilePromptCacheBreakpointOptional

Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request’s prompt_cache_options.ttl; the boundary is not rounded to a token block.

Mode Explicit

The breakpoint mode. Always explicit.

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.

PromptCacheOptions BetaResponsePromptCacheOptionsOptional

The prompt-caching options that were applied to the response. Supported for gpt-5.6 and later models.

Mode string

Whether implicit prompt-cache breakpoints were enabled.

One of the following:
const BetaResponsePromptCacheOptionsModeImplicit BetaResponsePromptCacheOptionsMode = "implicit"
const BetaResponsePromptCacheOptionsModeExplicit BetaResponsePromptCacheOptionsMode = "explicit"
Ttl string

The minimum lifetime applied to each cache breakpoint.

DeprecatedPromptCacheRetention BetaResponsePromptCacheRetentionOptional

Deprecated. Use prompt_cache_options.ttl instead.

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. This field expresses a maximum retention policy, while prompt_cache_options.ttl expresses a minimum cache lifetime. The two fields are independent and do not interact. For gpt-5.5, gpt-5.5-pro, and future models, only 24h is supported.

For older models that support both in_memory and 24h, the default depends on your organization’s data retention policy:

  • Organizations without ZDR enabled default to 24h.
  • Organizations with ZDR enabled default to in_memory when prompt_cache_retention is not specified.
One of the following:
const BetaResponsePromptCacheRetentionInMemory BetaResponsePromptCacheRetention = "in_memory"
const BetaResponsePromptCacheRetention24h BetaResponsePromptCacheRetention = "24h"
Reasoning BetaResponseReasoningOptional

gpt-5 and o-series models only

Configuration options for reasoning models.

Context stringOptional

Controls which reasoning items are rendered back to the model on later turns. If omitted or set to auto, the model determines the context mode. The gpt-5.6 model family defaults to all_turns; earlier models default to current_turn.

When returned on a response, this is the effective reasoning context mode used for the response.

One of the following:
const BetaResponseReasoningContextAuto BetaResponseReasoningContext = "auto"
const BetaResponseReasoningContextCurrentTurn BetaResponseReasoningContext = "current_turn"
const BetaResponseReasoningContextAllTurns BetaResponseReasoningContext = "all_turns"
Effort stringOptional

Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, xhigh, and max. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. Not all reasoning models support every value. See the reasoning guide for model-specific support.

One of the following:
const BetaResponseReasoningEffortNone BetaResponseReasoningEffort = "none"
const BetaResponseReasoningEffortMinimal BetaResponseReasoningEffort = "minimal"
const BetaResponseReasoningEffortLow BetaResponseReasoningEffort = "low"
const BetaResponseReasoningEffortMedium BetaResponseReasoningEffort = "medium"
const BetaResponseReasoningEffortHigh BetaResponseReasoningEffort = "high"
const BetaResponseReasoningEffortXhigh BetaResponseReasoningEffort = "xhigh"
const BetaResponseReasoningEffortMax BetaResponseReasoningEffort = "max"
DeprecatedGenerateSummary stringOptional

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.

One of the following:
const BetaResponseReasoningGenerateSummaryAuto BetaResponseReasoningGenerateSummary = "auto"
const BetaResponseReasoningGenerateSummaryConcise BetaResponseReasoningGenerateSummary = "concise"
const BetaResponseReasoningGenerateSummaryDetailed BetaResponseReasoningGenerateSummary = "detailed"
Mode stringOptional

Controls the reasoning execution mode for the request.

When returned on a response, this is the effective execution mode.

One of the following:
string
string
One of the following:
const BetaResponseReasoningModeStandard BetaResponseReasoningMode = "standard"
const BetaResponseReasoningModePro BetaResponseReasoningMode = "pro"
Summary stringOptional

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.

One of the following:
const BetaResponseReasoningSummaryAuto BetaResponseReasoningSummary = "auto"
const BetaResponseReasoningSummaryConcise BetaResponseReasoningSummary = "concise"
const BetaResponseReasoningSummaryDetailed BetaResponseReasoningSummary = "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, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. Learn more.

maxLength64
ServiceTier BetaResponseServiceTierOptional

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.

One of the following:
const BetaResponseServiceTierAuto BetaResponseServiceTier = "auto"
const BetaResponseServiceTierDefault BetaResponseServiceTier = "default"
const BetaResponseServiceTierFlex BetaResponseServiceTier = "flex"
const BetaResponseServiceTierScale BetaResponseServiceTier = "scale"
const BetaResponseServiceTierPriority BetaResponseServiceTier = "priority"
Status BetaResponseStatusOptional

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

One of the following:
const BetaResponseStatusCompleted BetaResponseStatus = "completed"
const BetaResponseStatusFailed BetaResponseStatus = "failed"
const BetaResponseStatusInProgress BetaResponseStatus = "in_progress"
const BetaResponseStatusCancelled BetaResponseStatus = "cancelled"
const BetaResponseStatusQueued BetaResponseStatus = "queued"
const BetaResponseStatusIncomplete BetaResponseStatus = "incomplete"

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.

One of the following:
type BetaResponseFormatTextConfigText struct{…}

Default response format. Used to generate text responses.

Type Text

The type of response format being defined. Always text.

type BetaResponseFormatTextJSONSchemaConfig 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 BetaResponseFormatTextConfigJSONObject 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 BetaResponseTextConfigVerbosityOptional

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. The default is medium.

One of the following:
const BetaResponseTextConfigVerbosityLow BetaResponseTextConfigVerbosity = "low"
const BetaResponseTextConfigVerbosityMedium BetaResponseTextConfigVerbosity = "medium"
const BetaResponseTextConfigVerbosityHigh BetaResponseTextConfigVerbosity = "high"
TopLogprobs int64Optional

An integer between 0 and 20 specifying the maximum number of most likely tokens to return at each token position, each with an associated log probability. In some cases, the number of returned tokens may be fewer than requested.

minimum0
maximum20
Truncation BetaResponseTruncationOptional

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.
One of the following:
const BetaResponseTruncationAuto BetaResponseTruncation = "auto"
const BetaResponseTruncationDisabled BetaResponseTruncation = "disabled"
Usage BetaResponseUsageOptional

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 BetaResponseUsageInputTokensDetails

A detailed breakdown of the input tokens.

CacheWriteTokens int64

The number of input tokens that were written to the cache.

CachedTokens int64

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

OutputTokens int64

The number of output tokens.

OutputTokensDetails BetaResponseUsageOutputTokensDetails

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.

Cancel a response

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  betaResponse, err := client.Beta.Responses.Cancel(
    context.TODO(),
    "resp_677efb5139a88190b512bc3fef8e535d",
    openai.BetaResponseCancelParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", betaResponse.ID)
}
{
  "id": "resp_67cb71b351908190a308f3859487620d06981a8637e6bc44",
  "object": "response",
  "created_at": 1741386163,
  "status": "cancelled",
  "background": true,
  "completed_at": null,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-4o-2024-08-06",
  "output": [
    {
      "type": "message",
      "id": "msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44",
      "status": "in_progress",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Silent circuits hum,  \nThoughts emerge in data streams—  \nDigital dawn breaks.",
          "annotations": []
        }
      ]
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": null,
  "user": null,
  "metadata": {}
}
Returns Examples
{
  "id": "resp_67cb71b351908190a308f3859487620d06981a8637e6bc44",
  "object": "response",
  "created_at": 1741386163,
  "status": "cancelled",
  "background": true,
  "completed_at": null,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-4o-2024-08-06",
  "output": [
    {
      "type": "message",
      "id": "msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44",
      "status": "in_progress",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Silent circuits hum,  \nThoughts emerge in data streams—  \nDigital dawn breaks.",
          "annotations": []
        }
      ]
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": null,
  "user": null,
  "metadata": {}
}