Skip to content
Primary navigation

Compact a response

client.Responses.Compact(ctx, body) (*CompactedResponse, error)
POST/responses/compact

Compact a conversation. Returns a compacted response object.

Learn when and how to compact long-running conversations in the conversation state guide. For ZDR-compatible compaction details, see Compaction (advanced).

ParametersExpand Collapse
body ResponseCompactParams
Model param.Field[ResponseCompactParamsModel]

Model ID used to generate the response, like gpt-5 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.

type ResponseCompactParamsModel string

Model ID used to generate the response, like gpt-5 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 ResponseCompactParamsModelGPT5_4 ResponseCompactParamsModel = "gpt-5.4"
const ResponseCompactParamsModelGPT5_4Mini ResponseCompactParamsModel = "gpt-5.4-mini"
const ResponseCompactParamsModelGPT5_4Nano ResponseCompactParamsModel = "gpt-5.4-nano"
const ResponseCompactParamsModelGPT5_4Mini2026_03_17 ResponseCompactParamsModel = "gpt-5.4-mini-2026-03-17"
const ResponseCompactParamsModelGPT5_4Nano2026_03_17 ResponseCompactParamsModel = "gpt-5.4-nano-2026-03-17"
const ResponseCompactParamsModelGPT5_3ChatLatest ResponseCompactParamsModel = "gpt-5.3-chat-latest"
const ResponseCompactParamsModelGPT5_2 ResponseCompactParamsModel = "gpt-5.2"
const ResponseCompactParamsModelGPT5_2_2025_12_11 ResponseCompactParamsModel = "gpt-5.2-2025-12-11"
const ResponseCompactParamsModelGPT5_2ChatLatest ResponseCompactParamsModel = "gpt-5.2-chat-latest"
const ResponseCompactParamsModelGPT5_2Pro ResponseCompactParamsModel = "gpt-5.2-pro"
const ResponseCompactParamsModelGPT5_2Pro2025_12_11 ResponseCompactParamsModel = "gpt-5.2-pro-2025-12-11"
const ResponseCompactParamsModelGPT5_1 ResponseCompactParamsModel = "gpt-5.1"
const ResponseCompactParamsModelGPT5_1_2025_11_13 ResponseCompactParamsModel = "gpt-5.1-2025-11-13"
const ResponseCompactParamsModelGPT5_1Codex ResponseCompactParamsModel = "gpt-5.1-codex"
const ResponseCompactParamsModelGPT5_1Mini ResponseCompactParamsModel = "gpt-5.1-mini"
const ResponseCompactParamsModelGPT5_1ChatLatest ResponseCompactParamsModel = "gpt-5.1-chat-latest"
const ResponseCompactParamsModelGPT5 ResponseCompactParamsModel = "gpt-5"
const ResponseCompactParamsModelGPT5Mini ResponseCompactParamsModel = "gpt-5-mini"
const ResponseCompactParamsModelGPT5Nano ResponseCompactParamsModel = "gpt-5-nano"
const ResponseCompactParamsModelGPT5_2025_08_07 ResponseCompactParamsModel = "gpt-5-2025-08-07"
const ResponseCompactParamsModelGPT5Mini2025_08_07 ResponseCompactParamsModel = "gpt-5-mini-2025-08-07"
const ResponseCompactParamsModelGPT5Nano2025_08_07 ResponseCompactParamsModel = "gpt-5-nano-2025-08-07"
const ResponseCompactParamsModelGPT5ChatLatest ResponseCompactParamsModel = "gpt-5-chat-latest"
const ResponseCompactParamsModelGPT4_1 ResponseCompactParamsModel = "gpt-4.1"
const ResponseCompactParamsModelGPT4_1Mini ResponseCompactParamsModel = "gpt-4.1-mini"
const ResponseCompactParamsModelGPT4_1Nano ResponseCompactParamsModel = "gpt-4.1-nano"
const ResponseCompactParamsModelGPT4_1_2025_04_14 ResponseCompactParamsModel = "gpt-4.1-2025-04-14"
const ResponseCompactParamsModelGPT4_1Mini2025_04_14 ResponseCompactParamsModel = "gpt-4.1-mini-2025-04-14"
const ResponseCompactParamsModelGPT4_1Nano2025_04_14 ResponseCompactParamsModel = "gpt-4.1-nano-2025-04-14"
const ResponseCompactParamsModelO4Mini ResponseCompactParamsModel = "o4-mini"
const ResponseCompactParamsModelO4Mini2025_04_16 ResponseCompactParamsModel = "o4-mini-2025-04-16"
const ResponseCompactParamsModelO3 ResponseCompactParamsModel = "o3"
const ResponseCompactParamsModelO3_2025_04_16 ResponseCompactParamsModel = "o3-2025-04-16"
const ResponseCompactParamsModelO3Mini ResponseCompactParamsModel = "o3-mini"
const ResponseCompactParamsModelO3Mini2025_01_31 ResponseCompactParamsModel = "o3-mini-2025-01-31"
const ResponseCompactParamsModelO1 ResponseCompactParamsModel = "o1"
const ResponseCompactParamsModelO1_2024_12_17 ResponseCompactParamsModel = "o1-2024-12-17"
const ResponseCompactParamsModelO1Preview ResponseCompactParamsModel = "o1-preview"
const ResponseCompactParamsModelO1Preview2024_09_12 ResponseCompactParamsModel = "o1-preview-2024-09-12"
const ResponseCompactParamsModelO1Mini ResponseCompactParamsModel = "o1-mini"
const ResponseCompactParamsModelO1Mini2024_09_12 ResponseCompactParamsModel = "o1-mini-2024-09-12"
const ResponseCompactParamsModelGPT4o ResponseCompactParamsModel = "gpt-4o"
const ResponseCompactParamsModelGPT4o2024_11_20 ResponseCompactParamsModel = "gpt-4o-2024-11-20"
const ResponseCompactParamsModelGPT4o2024_08_06 ResponseCompactParamsModel = "gpt-4o-2024-08-06"
const ResponseCompactParamsModelGPT4o2024_05_13 ResponseCompactParamsModel = "gpt-4o-2024-05-13"
const ResponseCompactParamsModelGPT4oAudioPreview ResponseCompactParamsModel = "gpt-4o-audio-preview"
const ResponseCompactParamsModelGPT4oAudioPreview2024_10_01 ResponseCompactParamsModel = "gpt-4o-audio-preview-2024-10-01"
const ResponseCompactParamsModelGPT4oAudioPreview2024_12_17 ResponseCompactParamsModel = "gpt-4o-audio-preview-2024-12-17"
const ResponseCompactParamsModelGPT4oAudioPreview2025_06_03 ResponseCompactParamsModel = "gpt-4o-audio-preview-2025-06-03"
const ResponseCompactParamsModelGPT4oMiniAudioPreview ResponseCompactParamsModel = "gpt-4o-mini-audio-preview"
const ResponseCompactParamsModelGPT4oMiniAudioPreview2024_12_17 ResponseCompactParamsModel = "gpt-4o-mini-audio-preview-2024-12-17"
const ResponseCompactParamsModelGPT4oSearchPreview ResponseCompactParamsModel = "gpt-4o-search-preview"
const ResponseCompactParamsModelGPT4oMiniSearchPreview ResponseCompactParamsModel = "gpt-4o-mini-search-preview"
const ResponseCompactParamsModelGPT4oSearchPreview2025_03_11 ResponseCompactParamsModel = "gpt-4o-search-preview-2025-03-11"
const ResponseCompactParamsModelGPT4oMiniSearchPreview2025_03_11 ResponseCompactParamsModel = "gpt-4o-mini-search-preview-2025-03-11"
const ResponseCompactParamsModelChatgpt4oLatest ResponseCompactParamsModel = "chatgpt-4o-latest"
const ResponseCompactParamsModelCodexMiniLatest ResponseCompactParamsModel = "codex-mini-latest"
const ResponseCompactParamsModelGPT4oMini ResponseCompactParamsModel = "gpt-4o-mini"
const ResponseCompactParamsModelGPT4oMini2024_07_18 ResponseCompactParamsModel = "gpt-4o-mini-2024-07-18"
const ResponseCompactParamsModelGPT4Turbo ResponseCompactParamsModel = "gpt-4-turbo"
const ResponseCompactParamsModelGPT4Turbo2024_04_09 ResponseCompactParamsModel = "gpt-4-turbo-2024-04-09"
const ResponseCompactParamsModelGPT4_0125Preview ResponseCompactParamsModel = "gpt-4-0125-preview"
const ResponseCompactParamsModelGPT4TurboPreview ResponseCompactParamsModel = "gpt-4-turbo-preview"
const ResponseCompactParamsModelGPT4_1106Preview ResponseCompactParamsModel = "gpt-4-1106-preview"
const ResponseCompactParamsModelGPT4VisionPreview ResponseCompactParamsModel = "gpt-4-vision-preview"
const ResponseCompactParamsModelGPT4 ResponseCompactParamsModel = "gpt-4"
const ResponseCompactParamsModelGPT4_0314 ResponseCompactParamsModel = "gpt-4-0314"
const ResponseCompactParamsModelGPT4_0613 ResponseCompactParamsModel = "gpt-4-0613"
const ResponseCompactParamsModelGPT4_32k ResponseCompactParamsModel = "gpt-4-32k"
const ResponseCompactParamsModelGPT4_32k0314 ResponseCompactParamsModel = "gpt-4-32k-0314"
const ResponseCompactParamsModelGPT4_32k0613 ResponseCompactParamsModel = "gpt-4-32k-0613"
const ResponseCompactParamsModelGPT3_5Turbo ResponseCompactParamsModel = "gpt-3.5-turbo"
const ResponseCompactParamsModelGPT3_5Turbo16k ResponseCompactParamsModel = "gpt-3.5-turbo-16k"
const ResponseCompactParamsModelGPT3_5Turbo0301 ResponseCompactParamsModel = "gpt-3.5-turbo-0301"
const ResponseCompactParamsModelGPT3_5Turbo0613 ResponseCompactParamsModel = "gpt-3.5-turbo-0613"
const ResponseCompactParamsModelGPT3_5Turbo1106 ResponseCompactParamsModel = "gpt-3.5-turbo-1106"
const ResponseCompactParamsModelGPT3_5Turbo0125 ResponseCompactParamsModel = "gpt-3.5-turbo-0125"
const ResponseCompactParamsModelGPT3_5Turbo16k0613 ResponseCompactParamsModel = "gpt-3.5-turbo-16k-0613"
const ResponseCompactParamsModelO1Pro ResponseCompactParamsModel = "o1-pro"
const ResponseCompactParamsModelO1Pro2025_03_19 ResponseCompactParamsModel = "o1-pro-2025-03-19"
const ResponseCompactParamsModelO3Pro ResponseCompactParamsModel = "o3-pro"
const ResponseCompactParamsModelO3Pro2025_06_10 ResponseCompactParamsModel = "o3-pro-2025-06-10"
const ResponseCompactParamsModelO3DeepResearch ResponseCompactParamsModel = "o3-deep-research"
const ResponseCompactParamsModelO3DeepResearch2025_06_26 ResponseCompactParamsModel = "o3-deep-research-2025-06-26"
const ResponseCompactParamsModelO4MiniDeepResearch ResponseCompactParamsModel = "o4-mini-deep-research"
const ResponseCompactParamsModelO4MiniDeepResearch2025_06_26 ResponseCompactParamsModel = "o4-mini-deep-research-2025-06-26"
const ResponseCompactParamsModelComputerUsePreview ResponseCompactParamsModel = "computer-use-preview"
const ResponseCompactParamsModelComputerUsePreview2025_03_11 ResponseCompactParamsModel = "computer-use-preview-2025-03-11"
const ResponseCompactParamsModelGPT5Codex ResponseCompactParamsModel = "gpt-5-codex"
const ResponseCompactParamsModelGPT5Pro ResponseCompactParamsModel = "gpt-5-pro"
const ResponseCompactParamsModelGPT5Pro2025_10_06 ResponseCompactParamsModel = "gpt-5-pro-2025-10-06"
const ResponseCompactParamsModelGPT5_1CodexMax ResponseCompactParamsModel = "gpt-5.1-codex-max"
string
Input param.Field[ResponseCompactParamsInputUnion]optional

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

string
type ResponseCompactParamsInputArray []ResponseInputItemUnion

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

One of the following:
type EasyInputMessage struct{…}

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the developer or system role take precedence over instructions given with the user role. Messages with the assistant role are presumed to have been generated by the model in previous interactions.

Content EasyInputMessageContentUnion

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

One of the following:
string
type ResponseInputMessageContentList []ResponseInputContentUnion

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

One of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

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

One of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
const ResponseInputImageDetailOriginal ResponseInputImageDetail = "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.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

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

FileID stringoptional

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

FileURL stringoptional

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

Filename stringoptional

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

Role EasyInputMessageRole

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

One of the following:
const EasyInputMessageRoleUser EasyInputMessageRole = "user"
const EasyInputMessageRoleAssistant EasyInputMessageRole = "assistant"
const EasyInputMessageRoleSystem EasyInputMessageRole = "system"
const EasyInputMessageRoleDeveloper EasyInputMessageRole = "developer"
Phase EasyInputMessagePhaseoptional

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 EasyInputMessagePhaseCommentary EasyInputMessagePhase = "commentary"
const EasyInputMessagePhaseFinalAnswer EasyInputMessagePhase = "final_answer"
Type EasyInputMessageTypeoptional

The type of the message input. Always message.

type ResponseInputItemMessage struct{…}

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the developer or system role take precedence over instructions given with the user role.

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

One of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

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

One of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
const ResponseInputImageDetailOriginal ResponseInputImageDetail = "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.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

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

FileID stringoptional

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

FileURL stringoptional

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

Filename stringoptional

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

Role string

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

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

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

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

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

type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

One of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

One of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

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

EndIndex int64

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

StartIndex int64

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

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

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

ContainerID string

The ID of the container file.

EndIndex int64

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

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

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

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

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

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

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

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

The type of the output message. Always message.

Phase ResponseOutputMessagePhaseoptional

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 ResponseOutputMessagePhaseCommentary ResponseOutputMessagePhase = "commentary"
const ResponseOutputMessagePhaseFinalAnswer ResponseOutputMessagePhase = "final_answer"
type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

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

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

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

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

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

One of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

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

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

CallID string

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

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

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

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

The type of the computer call. Always computer_call.

Action ResponseComputerToolCallActionUnionoptional

A click action.

One of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

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

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

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

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

Keys []stringoptional

The keys being held while clicking.

type ResponseComputerToolCallActionDoubleClick 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 ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

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

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

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

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

Keys []stringoptional

The keys being held while dragging the mouse.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

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

Type Keypress

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

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

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

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

Keys []stringoptional

The keys being held while moving the mouse.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

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

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

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

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

Keys []stringoptional

The keys being held while scrolling.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

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

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

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

Actions ComputerActionListoptional

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

One of the following:
type ComputerActionClick 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 ComputerActionClickButtonLeft ComputerActionClickButton = "left"
const ComputerActionClickButtonRight ComputerActionClickButton = "right"
const ComputerActionClickButtonWheel ComputerActionClickButton = "wheel"
const ComputerActionClickButtonBack ComputerActionClickButton = "back"
const ComputerActionClickButtonForward ComputerActionClickButton = "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 ComputerActionDoubleClick 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 ComputerActionDrag struct{…}

A drag action.

Path []ComputerActionDragPath

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 ComputerActionKeypress 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 ComputerActionMove 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 ComputerActionScreenshot struct{…}

A screenshot action.

Type Screenshot

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

type ComputerActionScroll 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 ComputerActionType 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 ComputerActionWait struct{…}

A wait action.

Type Wait

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

type ResponseInputItemComputerCallOutput struct{…}

The output of a computer tool call.

CallID string

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

maxLength64
minLength1

A computer screenshot image used with the computer use tool.

Type ComputerScreenshot

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

FileID stringoptional

The identifier of an uploaded file that contains the screenshot.

ImageURL stringoptional

The URL of the screenshot image.

Type ComputerCallOutput

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

ID stringoptional

The ID of the computer tool call output.

AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckoptional

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

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status stringoptional

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

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

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

Arguments string

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

CallID string

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

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Namespace stringoptional

The namespace of the function to run.

Status ResponseFunctionToolCallStatusoptional

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

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

The output of a function tool call.

CallID string

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

maxLength64
minLength1
Output ResponseInputItemFunctionCallOutputOutputUnion

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

One of the following:
string
type ResponseFunctionCallOutputItemList []ResponseFunctionCallOutputItemUnion

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

One of the following:
type ResponseInputTextContent struct{…}

A text input to the model.

Text string

The text input to the model.

maxLength10485760
Type InputText

The type of the input item. Always input_text.

type ResponseInputImageContent struct{…}

An image input to the model. Learn about image inputs

Type InputImage

The type of the input item. Always input_image.

Detail ResponseInputImageContentDetailoptional

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

One of the following:
const ResponseInputImageContentDetailLow ResponseInputImageContentDetail = "low"
const ResponseInputImageContentDetailHigh ResponseInputImageContentDetail = "high"
const ResponseInputImageContentDetailAuto ResponseInputImageContentDetail = "auto"
const ResponseInputImageContentDetailOriginal ResponseInputImageContentDetail = "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
type ResponseInputFileContent struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

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

maxLength33554432
FileID stringoptional

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

FileURL stringoptional

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

Filename stringoptional

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

Type FunctionCallOutput

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

ID stringoptional

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

Status stringoptional

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

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

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 ResponseInputItemToolSearchCallExecutionServer ResponseInputItemToolSearchCallExecution = "server"
const ResponseInputItemToolSearchCallExecutionClient ResponseInputItemToolSearchCallExecution = "client"
Status stringoptional

The status of the tool search call.

One of the following:
const ResponseInputItemToolSearchCallStatusInProgress ResponseInputItemToolSearchCallStatus = "in_progress"
const ResponseInputItemToolSearchCallStatusCompleted ResponseInputItemToolSearchCallStatus = "completed"
const ResponseInputItemToolSearchCallStatusIncomplete ResponseInputItemToolSearchCallStatus = "incomplete"
type ResponseToolSearchOutputItemParamResp struct{…}
Tools []ToolUnion

The loaded tool definitions returned by the tool search output.

One of the following:
type FunctionTool struct{…}

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

Name string

The name of the function to call.

Parameters map[string, any]

A JSON schema object describing the parameters of the function.

Strict bool

Whether to enforce strict parameter validation. Default true.

Type Function

The type of the function tool. Always function.

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.

type FileSearchTool struct{…}

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

Type FileSearch

The type of the file search tool. Always file_search.

VectorStoreIDs []string

The IDs of the vector stores to search.

Filters FileSearchToolFiltersUnionoptional

A filter to apply.

One of the following:
type ComparisonFilter struct{…}

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

Key string

The key to compare against the value.

Type ComparisonFilterType

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

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

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

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

Combine multiple filters using and or or.

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

One of the following:
type ComparisonFilter struct{…}

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

Key string

The key to compare against the value.

Type ComparisonFilterType

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

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

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

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

Type of operation: and or or.

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

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

RankingOptions FileSearchToolRankingOptionsoptional

Ranking options for search.

Ranker stringoptional

The ranker to use for the file search.

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

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

type ComputerTool struct{…}

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

Type Computer

The type of the computer tool. Always computer.

type ComputerUsePreviewTool 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 ComputerUsePreviewToolEnvironment

The type of computer environment to control.

One of the following:
const ComputerUsePreviewToolEnvironmentWindows ComputerUsePreviewToolEnvironment = "windows"
const ComputerUsePreviewToolEnvironmentMac ComputerUsePreviewToolEnvironment = "mac"
const ComputerUsePreviewToolEnvironmentLinux ComputerUsePreviewToolEnvironment = "linux"
const ComputerUsePreviewToolEnvironmentUbuntu ComputerUsePreviewToolEnvironment = "ubuntu"
const ComputerUsePreviewToolEnvironmentBrowser ComputerUsePreviewToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type WebSearchTool struct{…}

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

Type WebSearchToolType

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

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

Filters for the search.

AllowedDomains []stringoptional

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

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

SearchContextSize WebSearchToolSearchContextSizeoptional

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

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

The approximate location of the user.

City stringoptional

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

Country stringoptional

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

Region stringoptional

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

Timezone stringoptional

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

Type stringoptional

The type of location approximation. Always approximate.

type ToolMcp struct{…}

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

ServerLabel string

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

Type Mcp

The type of the MCP tool. Always mcp.

AllowedTools ToolMcpAllowedToolsUnionoptional

List of allowed tool names or a filter object.

One of the following:
type ToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type ToolMcpAllowedToolsMcpToolFilter struct{…}

A filter object to specify which tools are allowed.

ReadOnly booloptional

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

ToolNames []stringoptional

List of allowed tool names.

Authorization stringoptional

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

ConnectorID stringoptional

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

Currently supported connector_id values are:

  • Dropbox: connector_dropbox
  • Gmail: connector_gmail
  • Google Calendar: connector_googlecalendar
  • Google Drive: connector_googledrive
  • Microsoft Teams: connector_microsoftteams
  • Outlook Calendar: connector_outlookcalendar
  • Outlook Email: connector_outlookemail
  • SharePoint: connector_sharepoint
One of the following:
const ToolMcpConnectorIDConnectorDropbox ToolMcpConnectorID = "connector_dropbox"
const ToolMcpConnectorIDConnectorGmail ToolMcpConnectorID = "connector_gmail"
const ToolMcpConnectorIDConnectorGooglecalendar ToolMcpConnectorID = "connector_googlecalendar"
const ToolMcpConnectorIDConnectorGoogledrive ToolMcpConnectorID = "connector_googledrive"
const ToolMcpConnectorIDConnectorMicrosoftteams ToolMcpConnectorID = "connector_microsoftteams"
const ToolMcpConnectorIDConnectorOutlookcalendar ToolMcpConnectorID = "connector_outlookcalendar"
const ToolMcpConnectorIDConnectorOutlookemail ToolMcpConnectorID = "connector_outlookemail"
const ToolMcpConnectorIDConnectorSharepoint ToolMcpConnectorID = "connector_sharepoint"
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 ToolMcpRequireApprovalUnionoptional

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

One of the following:
type ToolMcpRequireApprovalMcpToolApprovalFilter struct{…}

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

Always ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysoptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

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

ToolNames []stringoptional

List of allowed tool names.

Never ToolMcpRequireApprovalMcpToolApprovalFilterNeveroptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

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

ToolNames []stringoptional

List of allowed tool names.

type ToolMcpRequireApprovalMcpToolApprovalSetting string

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

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

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

ServerURL stringoptional

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

type ToolCodeInterpreter struct{…}

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

Container ToolCodeInterpreterContainerUnion

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

One of the following:
string
type ToolCodeInterpreterContainerCodeInterpreterContainerAuto struct{…}

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

Type Auto

Always auto.

FileIDs []stringoptional

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

MemoryLimit stringoptional

The memory limit for the code interpreter container.

One of the following:
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
NetworkPolicy ToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionoptional

Network access policy for the container.

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

Disable outbound network access. Always disabled.

type ContainerNetworkPolicyAllowlist struct{…}
AllowedDomains []string

A list of allowed domains when type is allowlist.

Type Allowlist

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

DomainSecrets []ContainerNetworkPolicyDomainSecretoptional

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.

type ToolImageGeneration struct{…}

A tool that generates images using the GPT image models.

Type ImageGeneration

The type of the image generation tool. Always image_generation.

Action stringoptional

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

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

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

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

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

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

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

FileID stringoptional

File ID for the mask image.

ImageURL stringoptional

Base64-encoded mask image.

Model stringoptional

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

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

Moderation level for the generated image. Default: auto.

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

Compression level for the output image. Default: 100.

minimum0
maximum100
OutputFormat stringoptional

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

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

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

minimum0
maximum3
Quality stringoptional

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

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

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

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

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

Type LocalShell

The type of the local shell tool. Always local_shell.

type FunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

Environment FunctionShellToolEnvironmentUnionoptional
One of the following:
type ContainerAuto 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 ContainerAutoMemoryLimitoptional

The memory limit for the container.

One of the following:
const ContainerAutoMemoryLimit1g ContainerAutoMemoryLimit = "1g"
const ContainerAutoMemoryLimit4g ContainerAutoMemoryLimit = "4g"
const ContainerAutoMemoryLimit16g ContainerAutoMemoryLimit = "16g"
const ContainerAutoMemoryLimit64g ContainerAutoMemoryLimit = "64g"
NetworkPolicy ContainerAutoNetworkPolicyUnionoptional

Network access policy for the container.

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

Disable outbound network access. Always disabled.

type ContainerNetworkPolicyAllowlist struct{…}
AllowedDomains []string

A list of allowed domains when type is allowlist.

Type Allowlist

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

DomainSecrets []ContainerNetworkPolicyDomainSecretoptional

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 []ContainerAutoSkillUnionoptional

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

One of the following:
type SkillReference 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 InlineSkill 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 LocalEnvironment struct{…}
Type Local

Use a local computer environment.

Skills []LocalSkilloptional

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 ContainerReference struct{…}
ContainerID string

The ID of the referenced container.

Type ContainerReference

References a container created with the /v1/containers endpoint

type CustomTool struct{…}

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

Name string

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

Type Custom

The type of the custom tool. Always custom.

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.

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

One of the following:
type CustomToolInputFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

type CustomToolInputFormatGrammar struct{…}

A grammar defined by the user.

Definition string

The grammar definition.

Syntax string

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

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

Grammar format. Always grammar.

type NamespaceTool 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 []NamespaceToolToolUnion

The function/custom tools available inside this namespace.

One of the following:
type NamespaceToolToolFunction struct{…}
Name string
maxLength128
minLength1
Type Function
DeferLoading booloptional

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

Description stringoptional
Parameters anyoptional
Strict booloptional
type CustomTool struct{…}

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

Name string

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

Type Custom

The type of the custom tool. Always custom.

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.

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

One of the following:
type CustomToolInputFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

type CustomToolInputFormatGrammar struct{…}

A grammar defined by the user.

Definition string

The grammar definition.

Syntax string

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

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

Grammar format. Always grammar.

Type Namespace

The type of the tool. Always namespace.

type ToolSearchTool 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 ToolSearchToolExecutionoptional

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

One of the following:
const ToolSearchToolExecutionServer ToolSearchToolExecution = "server"
const ToolSearchToolExecutionClient ToolSearchToolExecution = "client"
Parameters anyoptional

Parameter schema for a client-executed tool search tool.

type WebSearchPreviewTool struct{…}

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

Type WebSearchPreviewToolType

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

One of the following:
const WebSearchPreviewToolTypeWebSearchPreview WebSearchPreviewToolType = "web_search_preview"
const WebSearchPreviewToolTypeWebSearchPreview2025_03_11 WebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContentTypes []stringoptional
One of the following:
const WebSearchPreviewToolSearchContentTypeText WebSearchPreviewToolSearchContentType = "text"
const WebSearchPreviewToolSearchContentTypeImage WebSearchPreviewToolSearchContentType = "image"
SearchContextSize WebSearchPreviewToolSearchContextSizeoptional

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

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

The user's location.

Type Approximate

The type of location approximation. Always approximate.

City stringoptional

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

Country stringoptional

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

Region stringoptional

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

Timezone stringoptional

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

type ApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

Type ToolSearchOutput

The item type. Always tool_search_output.

ID stringoptional

The unique ID of this tool search output.

CallID stringoptional

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

maxLength64
minLength1
Execution ResponseToolSearchOutputItemParamExecutionoptional

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

One of the following:
const ResponseToolSearchOutputItemParamExecutionServer ResponseToolSearchOutputItemParamExecution = "server"
const ResponseToolSearchOutputItemParamExecutionClient ResponseToolSearchOutputItemParamExecution = "client"
Status ResponseToolSearchOutputItemParamStatusoptional

The status of the tool search output.

One of the following:
const ResponseToolSearchOutputItemParamStatusInProgress ResponseToolSearchOutputItemParamStatus = "in_progress"
const ResponseToolSearchOutputItemParamStatusCompleted ResponseToolSearchOutputItemParamStatus = "completed"
const ResponseToolSearchOutputItemParamStatusIncomplete ResponseToolSearchOutputItemParamStatus = "incomplete"
type ResponseReasoningItem struct{…}

A description of the chain of thought used by a reasoning model while generating a response. Be sure to include these items in your input to the Responses API for subsequent turns of a conversation if you are manually managing context.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

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

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

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

Status ResponseReasoningItemStatusoptional

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

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

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

EncryptedContent string

The encrypted content of the compaction summary.

maxLength10485760
Type Compaction

The type of the item. Always compaction.

ID stringoptional

The ID of the compaction item.

type ResponseInputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

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

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

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

One of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

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

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

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

type ResponseInputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseInputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

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

Status string

The status of the local shell call.

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

The type of the local shell call. Always local_shell_call.

type ResponseInputItemLocalShellCallOutput struct{…}

The output of a local shell tool call.

ID string

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

Output string

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

Type LocalShellCallOutput

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

Status stringoptional

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

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

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

Action ResponseInputItemShellCallAction

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

Commands []string

Ordered shell commands for the execution environment to run.

MaxOutputLength int64optional

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

TimeoutMs int64optional

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

CallID string

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

maxLength64
minLength1
Type ShellCall

The type of the item. Always shell_call.

ID stringoptional

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

Environment ResponseInputItemShellCallEnvironmentUnionoptional

The environment to execute the shell commands in.

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

Use a local computer environment.

Skills []LocalSkilloptional

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 ContainerReference 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 ResponseInputItemShellCallStatusInProgress ResponseInputItemShellCallStatus = "in_progress"
const ResponseInputItemShellCallStatusCompleted ResponseInputItemShellCallStatus = "completed"
const ResponseInputItemShellCallStatusIncomplete ResponseInputItemShellCallStatus = "incomplete"
type ResponseInputItemShellCallOutput struct{…}

The streamed output items emitted by a shell tool call.

CallID string

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

maxLength64
minLength1

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

Outcome ResponseFunctionShellCallOutputContentOutcomeUnion

The exit or timeout outcome associated with this shell call.

One of the following:
type ResponseFunctionShellCallOutputContentOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellCallOutputContentOutcomeExit struct{…}

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

ExitCode int64

The exit code returned by the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

Captured stderr output for the shell call.

maxLength10485760
Stdout string

Captured stdout output for the shell call.

maxLength10485760
Type ShellCallOutput

The type of the item. Always shell_call_output.

ID stringoptional

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

MaxOutputLength int64optional

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

Status stringoptional

The status of the shell call output.

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

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

CallID string

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

maxLength64
minLength1
Operation ResponseInputItemApplyPatchCallOperationUnion

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

One of the following:
type ResponseInputItemApplyPatchCallOperationCreateFile struct{…}

Instruction for creating a new file via the apply_patch tool.

Diff string

Unified diff content to apply when creating the file.

maxLength10485760
Path string

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

minLength1
Type CreateFile

The operation type. Always create_file.

type ResponseInputItemApplyPatchCallOperationDeleteFile struct{…}

Instruction for deleting an existing file via the apply_patch tool.

Path string

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

minLength1
Type DeleteFile

The operation type. Always delete_file.

type ResponseInputItemApplyPatchCallOperationUpdateFile struct{…}

Instruction for updating an existing file via the apply_patch tool.

Diff string

Unified diff content to apply to the existing file.

maxLength10485760
Path string

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

minLength1
Type UpdateFile

The operation type. Always update_file.

Status string

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

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

The type of the item. Always apply_patch_call.

ID stringoptional

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

type ResponseInputItemApplyPatchCallOutput struct{…}

The streamed output emitted by an apply patch tool call.

CallID string

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

maxLength64
minLength1
Status string

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

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

The type of the item. Always apply_patch_call_output.

ID stringoptional

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

Output stringoptional

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

maxLength10485760
type ResponseInputItemMcpListTools struct{…}

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseInputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseInputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

type ResponseInputItemMcpApprovalResponse struct{…}

A response to an MCP approval request.

ApprovalRequestID string

The ID of the approval request being answered.

Approve bool

Whether the request was approved.

Type McpApprovalResponse

The type of the item. Always mcp_approval_response.

ID stringoptional

The unique ID of the approval response

Reason stringoptional

Optional reason for the decision.

type ResponseInputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

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

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

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

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

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

CallID string

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

Output ResponseCustomToolCallOutputOutputUnion

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

One of the following:
string
type ResponseCustomToolCallOutputOutputOutputContentList []ResponseCustomToolCallOutputOutputOutputContentListItemUnion

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

One of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

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

One of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
const ResponseInputImageDetailOriginal ResponseInputImageDetail = "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.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

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

FileID stringoptional

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

FileURL stringoptional

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

Filename stringoptional

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

Type CustomToolCallOutput

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

ID stringoptional

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

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

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

Input string

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

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

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

Namespace stringoptional

The namespace of the custom tool being called.

type ResponseInputItemItemReference struct{…}

An internal identifier for an item to reference.

ID string

The ID of the item to reference.

Type stringoptional

The type of item to reference. Always item_reference.

Instructions param.Field[string]optional

A system (or developer) message inserted into the model's context. When used 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.

PreviousResponseID param.Field[string]optional

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

PromptCacheKey param.Field[string]optional

A key to use when reading from or writing to the prompt cache.

maxLength64
ReturnsExpand Collapse
type CompactedResponse struct{…}
ID string

The unique identifier for the compacted response.

CreatedAt int64

Unix timestamp (in seconds) when the compacted conversation was created.

Object ResponseCompaction

The object type. Always response.compaction.

The compacted list of output items. This is a list of all user messages, followed by a single compaction item.

One of the following:
type ResponseOutputMessage struct{…}

An output message from the model.

ID string

The unique ID of the output message.

Content []ResponseOutputMessageContentUnion

The content of the output message.

One of the following:
type ResponseOutputText struct{…}

A text output from the model.

Annotations []ResponseOutputTextAnnotationUnion

The annotations of the text output.

One of the following:
type ResponseOutputTextAnnotationFileCitation struct{…}

A citation to a file.

FileID string

The ID of the file.

Filename string

The filename of the file cited.

Index int64

The index of the file in the list of files.

Type FileCitation

The type of the file citation. Always file_citation.

type ResponseOutputTextAnnotationURLCitation struct{…}

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

EndIndex int64

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

StartIndex int64

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

Title string

The title of the web resource.

Type URLCitation

The type of the URL citation. Always url_citation.

URL string

The URL of the web resource.

type ResponseOutputTextAnnotationContainerFileCitation struct{…}

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

ContainerID string

The ID of the container file.

EndIndex int64

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

FileID string

The ID of the file.

Filename string

The filename of the container file cited.

StartIndex int64

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

Type ContainerFileCitation

The type of the container file citation. Always container_file_citation.

type ResponseOutputTextAnnotationFilePath struct{…}

A path to a file.

FileID string

The ID of the file.

Index int64

The index of the file in the list of files.

Type FilePath

The type of the file path. Always file_path.

Text string

The text output from the model.

Type OutputText

The type of the output text. Always output_text.

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

A refusal from the model.

Refusal string

The refusal explanation from the model.

Type Refusal

The type of the refusal. Always refusal.

Role Assistant

The role of the output message. Always assistant.

Status ResponseOutputMessageStatus

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

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

The type of the output message. Always message.

Phase ResponseOutputMessagePhaseoptional

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 ResponseOutputMessagePhaseCommentary ResponseOutputMessagePhase = "commentary"
const ResponseOutputMessagePhaseFinalAnswer ResponseOutputMessagePhase = "final_answer"
type ResponseFileSearchToolCall struct{…}

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

ID string

The unique ID of the file search tool call.

Queries []string

The queries used to search for files.

Status ResponseFileSearchToolCallStatus

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

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

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

Results []ResponseFileSearchToolCallResultoptional

The results of the file search tool call.

Attributes map[string, ResponseFileSearchToolCallResultAttributeUnion]optional

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

One of the following:
string
float64
bool
FileID stringoptional

The unique ID of the file.

Filename stringoptional

The name of the file.

Score float64optional

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

formatfloat
Text stringoptional

The text that was retrieved from the file.

type ResponseFunctionToolCall struct{…}

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

Arguments string

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

CallID string

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

Name string

The name of the function to run.

Type FunctionCall

The type of the function tool call. Always function_call.

ID stringoptional

The unique ID of the function tool call.

Namespace stringoptional

The namespace of the function to run.

Status ResponseFunctionToolCallStatusoptional

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

One of the following:
const ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
const ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
const ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
type ResponseFunctionToolCallOutputItem 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 ResponseFunctionToolCallOutputItemOutputUnion

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 ResponseFunctionToolCallOutputItemOutputOutputContentList []ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion

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

One of the following:
type ResponseInputText struct{…}

A text input to the model.

Text string

The text input to the model.

Type InputText

The type of the input item. Always input_text.

type ResponseInputImage struct{…}

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

Detail ResponseInputImageDetail

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

One of the following:
const ResponseInputImageDetailLow ResponseInputImageDetail = "low"
const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
const ResponseInputImageDetailOriginal ResponseInputImageDetail = "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.

type ResponseInputFile struct{…}

A file input to the model.

Type InputFile

The type of the input item. Always input_file.

FileData stringoptional

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

FileID stringoptional

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

FileURL stringoptional

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

Filename stringoptional

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

Status ResponseFunctionToolCallOutputItemStatus

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

One of the following:
const ResponseFunctionToolCallOutputItemStatusInProgress ResponseFunctionToolCallOutputItemStatus = "in_progress"
const ResponseFunctionToolCallOutputItemStatusCompleted ResponseFunctionToolCallOutputItemStatus = "completed"
const ResponseFunctionToolCallOutputItemStatusIncomplete ResponseFunctionToolCallOutputItemStatus = "incomplete"
Type FunctionCallOutput

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

CreatedBy stringoptional

The identifier of the actor that created the item.

One of the following:
One of the following:
type ResponseComputerToolCall struct{…}

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

ID string

The unique ID of the computer call.

CallID string

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

PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck

The pending safety checks for the computer call.

ID string

The ID of the pending safety check.

Code stringoptional

The type of the pending safety check.

Message stringoptional

Details about the pending safety check.

Status ResponseComputerToolCallStatus

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

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

The type of the computer call. Always computer_call.

Action ResponseComputerToolCallActionUnionoptional

A click action.

One of the following:
type ResponseComputerToolCallActionClick struct{…}

A click action.

Button string

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

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

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

X int64

The x-coordinate where the click occurred.

Y int64

The y-coordinate where the click occurred.

Keys []stringoptional

The keys being held while clicking.

type ResponseComputerToolCallActionDoubleClick 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 ResponseComputerToolCallActionDrag struct{…}

A drag action.

Path []ResponseComputerToolCallActionDragPath

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

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

The x-coordinate.

Y int64

The y-coordinate.

Type Drag

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

Keys []stringoptional

The keys being held while dragging the mouse.

type ResponseComputerToolCallActionKeypress struct{…}

A collection of keypresses the model would like to perform.

Keys []string

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

Type Keypress

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

type ResponseComputerToolCallActionMove struct{…}

A mouse move action.

Type Move

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

X int64

The x-coordinate to move to.

Y int64

The y-coordinate to move to.

Keys []stringoptional

The keys being held while moving the mouse.

type ResponseComputerToolCallActionScreenshot struct{…}

A screenshot action.

Type Screenshot

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

type ResponseComputerToolCallActionScroll struct{…}

A scroll action.

ScrollX int64

The horizontal scroll distance.

ScrollY int64

The vertical scroll distance.

Type Scroll

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

X int64

The x-coordinate where the scroll occurred.

Y int64

The y-coordinate where the scroll occurred.

Keys []stringoptional

The keys being held while scrolling.

type ResponseComputerToolCallActionType struct{…}

An action to type in text.

Text string

The text to type.

Type Type

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

type ResponseComputerToolCallActionWait struct{…}

A wait action.

Type Wait

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

Actions ComputerActionListoptional

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

One of the following:
type ComputerActionClick 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 ComputerActionClickButtonLeft ComputerActionClickButton = "left"
const ComputerActionClickButtonRight ComputerActionClickButton = "right"
const ComputerActionClickButtonWheel ComputerActionClickButton = "wheel"
const ComputerActionClickButtonBack ComputerActionClickButton = "back"
const ComputerActionClickButtonForward ComputerActionClickButton = "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 ComputerActionDoubleClick 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 ComputerActionDrag struct{…}

A drag action.

Path []ComputerActionDragPath

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 ComputerActionKeypress 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 ComputerActionMove 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 ComputerActionScreenshot struct{…}

A screenshot action.

Type Screenshot

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

type ComputerActionScroll 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 ComputerActionType 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 ComputerActionWait struct{…}

A wait action.

Type Wait

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

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

Status ResponseComputerToolCallOutputItemStatus

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 ResponseComputerToolCallOutputItemStatusCompleted ResponseComputerToolCallOutputItemStatus = "completed"
const ResponseComputerToolCallOutputItemStatusIncomplete ResponseComputerToolCallOutputItemStatus = "incomplete"
const ResponseComputerToolCallOutputItemStatusFailed ResponseComputerToolCallOutputItemStatus = "failed"
const ResponseComputerToolCallOutputItemStatusInProgress ResponseComputerToolCallOutputItemStatus = "in_progress"
Type ComputerCallOutput

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

AcknowledgedSafetyChecks []ResponseComputerToolCallOutputItemAcknowledgedSafetyCheckoptional

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.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseReasoningItem struct{…}

A description of the chain of thought used by a reasoning model while generating a response. Be sure to include these items in your input to the Responses API for subsequent turns of a conversation if you are manually managing context.

ID string

The unique identifier of the reasoning content.

Summary []ResponseReasoningItemSummary

Reasoning summary content.

Text string

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

Type SummaryText

The type of the object. Always summary_text.

Type Reasoning

The type of the object. Always reasoning.

Content []ResponseReasoningItemContentoptional

Reasoning text content.

Text string

The reasoning text from the model.

Type ReasoningText

The type of the reasoning text. Always reasoning_text.

EncryptedContent stringoptional

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

Status ResponseReasoningItemStatusoptional

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

One of the following:
const ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
const ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed"
const ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
type ResponseToolSearchCall 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 ResponseToolSearchCallExecution

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

One of the following:
const ResponseToolSearchCallExecutionServer ResponseToolSearchCallExecution = "server"
const ResponseToolSearchCallExecutionClient ResponseToolSearchCallExecution = "client"
Status ResponseToolSearchCallStatus

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

One of the following:
const ResponseToolSearchCallStatusInProgress ResponseToolSearchCallStatus = "in_progress"
const ResponseToolSearchCallStatusCompleted ResponseToolSearchCallStatus = "completed"
const ResponseToolSearchCallStatusIncomplete ResponseToolSearchCallStatus = "incomplete"
Type ToolSearchCall

The type of the item. Always tool_search_call.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseToolSearchOutputItem 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 ResponseToolSearchOutputItemExecution

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

One of the following:
const ResponseToolSearchOutputItemExecutionServer ResponseToolSearchOutputItemExecution = "server"
const ResponseToolSearchOutputItemExecutionClient ResponseToolSearchOutputItemExecution = "client"
Status ResponseToolSearchOutputItemStatus

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

One of the following:
const ResponseToolSearchOutputItemStatusInProgress ResponseToolSearchOutputItemStatus = "in_progress"
const ResponseToolSearchOutputItemStatusCompleted ResponseToolSearchOutputItemStatus = "completed"
const ResponseToolSearchOutputItemStatusIncomplete ResponseToolSearchOutputItemStatus = "incomplete"
Tools []ToolUnion

The loaded tool definitions returned by tool search.

One of the following:
type FunctionTool struct{…}

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

Name string

The name of the function to call.

Parameters map[string, any]

A JSON schema object describing the parameters of the function.

Strict bool

Whether to enforce strict parameter validation. Default true.

Type Function

The type of the function tool. Always function.

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.

type FileSearchTool struct{…}

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

Type FileSearch

The type of the file search tool. Always file_search.

VectorStoreIDs []string

The IDs of the vector stores to search.

Filters FileSearchToolFiltersUnionoptional

A filter to apply.

One of the following:
type ComparisonFilter struct{…}

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

Key string

The key to compare against the value.

Type ComparisonFilterType

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

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

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

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

Combine multiple filters using and or or.

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

One of the following:
type ComparisonFilter struct{…}

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

Key string

The key to compare against the value.

Type ComparisonFilterType

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

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

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

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

Type of operation: and or or.

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

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

RankingOptions FileSearchToolRankingOptionsoptional

Ranking options for search.

Ranker stringoptional

The ranker to use for the file search.

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

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

type ComputerTool struct{…}

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

Type Computer

The type of the computer tool. Always computer.

type ComputerUsePreviewTool 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 ComputerUsePreviewToolEnvironment

The type of computer environment to control.

One of the following:
const ComputerUsePreviewToolEnvironmentWindows ComputerUsePreviewToolEnvironment = "windows"
const ComputerUsePreviewToolEnvironmentMac ComputerUsePreviewToolEnvironment = "mac"
const ComputerUsePreviewToolEnvironmentLinux ComputerUsePreviewToolEnvironment = "linux"
const ComputerUsePreviewToolEnvironmentUbuntu ComputerUsePreviewToolEnvironment = "ubuntu"
const ComputerUsePreviewToolEnvironmentBrowser ComputerUsePreviewToolEnvironment = "browser"
Type ComputerUsePreview

The type of the computer use tool. Always computer_use_preview.

type WebSearchTool struct{…}

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

Type WebSearchToolType

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

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

Filters for the search.

AllowedDomains []stringoptional

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

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

SearchContextSize WebSearchToolSearchContextSizeoptional

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

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

The approximate location of the user.

City stringoptional

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

Country stringoptional

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

Region stringoptional

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

Timezone stringoptional

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

Type stringoptional

The type of location approximation. Always approximate.

type ToolMcp struct{…}

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

ServerLabel string

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

Type Mcp

The type of the MCP tool. Always mcp.

AllowedTools ToolMcpAllowedToolsUnionoptional

List of allowed tool names or a filter object.

One of the following:
type ToolMcpAllowedToolsMcpAllowedTools []string

A string array of allowed tool names

type ToolMcpAllowedToolsMcpToolFilter struct{…}

A filter object to specify which tools are allowed.

ReadOnly booloptional

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

ToolNames []stringoptional

List of allowed tool names.

Authorization stringoptional

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

ConnectorID stringoptional

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

Currently supported connector_id values are:

  • Dropbox: connector_dropbox
  • Gmail: connector_gmail
  • Google Calendar: connector_googlecalendar
  • Google Drive: connector_googledrive
  • Microsoft Teams: connector_microsoftteams
  • Outlook Calendar: connector_outlookcalendar
  • Outlook Email: connector_outlookemail
  • SharePoint: connector_sharepoint
One of the following:
const ToolMcpConnectorIDConnectorDropbox ToolMcpConnectorID = "connector_dropbox"
const ToolMcpConnectorIDConnectorGmail ToolMcpConnectorID = "connector_gmail"
const ToolMcpConnectorIDConnectorGooglecalendar ToolMcpConnectorID = "connector_googlecalendar"
const ToolMcpConnectorIDConnectorGoogledrive ToolMcpConnectorID = "connector_googledrive"
const ToolMcpConnectorIDConnectorMicrosoftteams ToolMcpConnectorID = "connector_microsoftteams"
const ToolMcpConnectorIDConnectorOutlookcalendar ToolMcpConnectorID = "connector_outlookcalendar"
const ToolMcpConnectorIDConnectorOutlookemail ToolMcpConnectorID = "connector_outlookemail"
const ToolMcpConnectorIDConnectorSharepoint ToolMcpConnectorID = "connector_sharepoint"
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 ToolMcpRequireApprovalUnionoptional

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

One of the following:
type ToolMcpRequireApprovalMcpToolApprovalFilter struct{…}

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

Always ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysoptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

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

ToolNames []stringoptional

List of allowed tool names.

Never ToolMcpRequireApprovalMcpToolApprovalFilterNeveroptional

A filter object to specify which tools are allowed.

ReadOnly booloptional

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

ToolNames []stringoptional

List of allowed tool names.

type ToolMcpRequireApprovalMcpToolApprovalSetting string

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

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

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

ServerURL stringoptional

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

type ToolCodeInterpreter struct{…}

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

Container ToolCodeInterpreterContainerUnion

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

One of the following:
string
type ToolCodeInterpreterContainerCodeInterpreterContainerAuto struct{…}

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

Type Auto

Always auto.

FileIDs []stringoptional

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

MemoryLimit stringoptional

The memory limit for the code interpreter container.

One of the following:
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit1g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "1g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit4g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "4g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit16g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "16g"
const ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit64g ToolCodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit = "64g"
NetworkPolicy ToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionoptional

Network access policy for the container.

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

Disable outbound network access. Always disabled.

type ContainerNetworkPolicyAllowlist struct{…}
AllowedDomains []string

A list of allowed domains when type is allowlist.

Type Allowlist

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

DomainSecrets []ContainerNetworkPolicyDomainSecretoptional

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.

type ToolImageGeneration struct{…}

A tool that generates images using the GPT image models.

Type ImageGeneration

The type of the image generation tool. Always image_generation.

Action stringoptional

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

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

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

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

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

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

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

FileID stringoptional

File ID for the mask image.

ImageURL stringoptional

Base64-encoded mask image.

Model stringoptional

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

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

Moderation level for the generated image. Default: auto.

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

Compression level for the output image. Default: 100.

minimum0
maximum100
OutputFormat stringoptional

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

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

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

minimum0
maximum3
Quality stringoptional

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

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

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

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

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

Type LocalShell

The type of the local shell tool. Always local_shell.

type FunctionShellTool struct{…}

A tool that allows the model to execute shell commands.

Type Shell

The type of the shell tool. Always shell.

Environment FunctionShellToolEnvironmentUnionoptional
One of the following:
type ContainerAuto 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 ContainerAutoMemoryLimitoptional

The memory limit for the container.

One of the following:
const ContainerAutoMemoryLimit1g ContainerAutoMemoryLimit = "1g"
const ContainerAutoMemoryLimit4g ContainerAutoMemoryLimit = "4g"
const ContainerAutoMemoryLimit16g ContainerAutoMemoryLimit = "16g"
const ContainerAutoMemoryLimit64g ContainerAutoMemoryLimit = "64g"
NetworkPolicy ContainerAutoNetworkPolicyUnionoptional

Network access policy for the container.

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

Disable outbound network access. Always disabled.

type ContainerNetworkPolicyAllowlist struct{…}
AllowedDomains []string

A list of allowed domains when type is allowlist.

Type Allowlist

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

DomainSecrets []ContainerNetworkPolicyDomainSecretoptional

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 []ContainerAutoSkillUnionoptional

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

One of the following:
type SkillReference 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 InlineSkill 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 LocalEnvironment struct{…}
Type Local

Use a local computer environment.

Skills []LocalSkilloptional

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 ContainerReference struct{…}
ContainerID string

The ID of the referenced container.

Type ContainerReference

References a container created with the /v1/containers endpoint

type CustomTool struct{…}

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

Name string

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

Type Custom

The type of the custom tool. Always custom.

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.

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

One of the following:
type CustomToolInputFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

type CustomToolInputFormatGrammar struct{…}

A grammar defined by the user.

Definition string

The grammar definition.

Syntax string

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

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

Grammar format. Always grammar.

type NamespaceTool 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 []NamespaceToolToolUnion

The function/custom tools available inside this namespace.

One of the following:
type NamespaceToolToolFunction struct{…}
Name string
maxLength128
minLength1
Type Function
DeferLoading booloptional

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

Description stringoptional
Parameters anyoptional
Strict booloptional
type CustomTool struct{…}

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

Name string

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

Type Custom

The type of the custom tool. Always custom.

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.

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

One of the following:
type CustomToolInputFormatText struct{…}

Unconstrained free-form text.

Type Text

Unconstrained text format. Always text.

type CustomToolInputFormatGrammar struct{…}

A grammar defined by the user.

Definition string

The grammar definition.

Syntax string

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

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

Grammar format. Always grammar.

Type Namespace

The type of the tool. Always namespace.

type ToolSearchTool 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 ToolSearchToolExecutionoptional

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

One of the following:
const ToolSearchToolExecutionServer ToolSearchToolExecution = "server"
const ToolSearchToolExecutionClient ToolSearchToolExecution = "client"
Parameters anyoptional

Parameter schema for a client-executed tool search tool.

type WebSearchPreviewTool struct{…}

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

Type WebSearchPreviewToolType

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

One of the following:
const WebSearchPreviewToolTypeWebSearchPreview WebSearchPreviewToolType = "web_search_preview"
const WebSearchPreviewToolTypeWebSearchPreview2025_03_11 WebSearchPreviewToolType = "web_search_preview_2025_03_11"
SearchContentTypes []stringoptional
One of the following:
const WebSearchPreviewToolSearchContentTypeText WebSearchPreviewToolSearchContentType = "text"
const WebSearchPreviewToolSearchContentTypeImage WebSearchPreviewToolSearchContentType = "image"
SearchContextSize WebSearchPreviewToolSearchContextSizeoptional

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

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

The user's location.

Type Approximate

The type of location approximation. Always approximate.

City stringoptional

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

Country stringoptional

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

Region stringoptional

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

Timezone stringoptional

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

type ApplyPatchTool struct{…}

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

Type ApplyPatch

The type of the tool. Always apply_patch.

Type ToolSearchOutput

The type of the item. Always tool_search_output.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseCompactionItem struct{…}

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

ID string

The unique ID of the compaction item.

EncryptedContent string

The encrypted content that was produced by compaction.

Type Compaction

The type of the item. Always compaction.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseOutputItemImageGenerationCall struct{…}

An image generation request made by the model.

ID string

The unique ID of the image generation call.

Result string

The generated image encoded in base64.

Status string

The status of the image generation call.

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

The type of the image generation call. Always image_generation_call.

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

ID string

The unique ID of the code interpreter tool call.

Code string

The code to run, or null if not available.

ContainerID string

The ID of the container used to run the code.

Outputs []ResponseCodeInterpreterToolCallOutputUnion

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

One of the following:
type ResponseCodeInterpreterToolCallOutputLogs struct{…}

The logs output from the code interpreter.

Logs string

The logs output from the code interpreter.

Type Logs

The type of the output. Always logs.

type ResponseCodeInterpreterToolCallOutputImage struct{…}

The image output from the code interpreter.

Type Image

The type of the output. Always image.

URL string

The URL of the image output from the code interpreter.

Status ResponseCodeInterpreterToolCallStatus

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

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

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

type ResponseOutputItemLocalShellCall struct{…}

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

ID string

The unique ID of the local shell call.

Action ResponseOutputItemLocalShellCallAction

Execute a shell command on the server.

Command []string

The command to run.

Env map[string, string]

Environment variables to set for the command.

Type Exec

The type of the local shell action. Always exec.

TimeoutMs int64optional

Optional timeout in milliseconds for the command.

User stringoptional

Optional user to run the command as.

WorkingDirectory stringoptional

Optional working directory to run the command in.

CallID string

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

Status string

The status of the local shell call.

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

The type of the local shell call. Always local_shell_call.

type ResponseOutputItemLocalShellCallOutput struct{…}

The output of a local shell tool call.

ID string

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

Output string

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

Type LocalShellCallOutput

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

Status stringoptional

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

One of the following:
const ResponseOutputItemLocalShellCallOutputStatusInProgress ResponseOutputItemLocalShellCallOutputStatus = "in_progress"
const ResponseOutputItemLocalShellCallOutputStatusCompleted ResponseOutputItemLocalShellCallOutputStatus = "completed"
const ResponseOutputItemLocalShellCallOutputStatusIncomplete ResponseOutputItemLocalShellCallOutputStatus = "incomplete"
type ResponseFunctionShellToolCall struct{…}

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

ID string

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

Action ResponseFunctionShellToolCallAction

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

Commands []string
MaxOutputLength int64

Optional maximum number of characters to return from each command.

TimeoutMs int64

Optional timeout in milliseconds for the commands.

CallID string

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

Environment ResponseFunctionShellToolCallEnvironmentUnion

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

One of the following:
type ResponseLocalEnvironment struct{…}

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

Type Local

The environment type. Always local.

type ResponseContainerReference struct{…}

Represents a container created with /v1/containers.

ContainerID string
Type ContainerReference

The environment type. Always container_reference.

Status ResponseFunctionShellToolCallStatus

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

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

The type of the item. Always shell_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseFunctionShellToolCallOutput struct{…}

The output of a shell tool call that was emitted.

ID string

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

CallID string

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

MaxOutputLength int64

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

Output []ResponseFunctionShellToolCallOutputOutput

An array of shell call output contents

Outcome ResponseFunctionShellToolCallOutputOutputOutcomeUnion

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

One of the following:
type ResponseFunctionShellToolCallOutputOutputOutcomeTimeout struct{…}

Indicates that the shell call exceeded its configured time limit.

Type Timeout

The outcome type. Always timeout.

type ResponseFunctionShellToolCallOutputOutputOutcomeExit struct{…}

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

ExitCode int64

Exit code from the shell process.

Type Exit

The outcome type. Always exit.

Stderr string

The standard error output that was captured.

Stdout string

The standard output that was captured.

CreatedBy stringoptional

The identifier of the actor that created the item.

Status ResponseFunctionShellToolCallOutputStatus

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

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

The type of the shell call output. Always shell_call_output.

CreatedBy stringoptional

The identifier of the actor that created the item.

type ResponseApplyPatchToolCall struct{…}

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

ID string

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

CallID string

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

Operation ResponseApplyPatchToolCallOperationUnion

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

One of the following:
type ResponseApplyPatchToolCallOperationCreateFile struct{…}

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

Diff string

Diff to apply.

Path string

Path of the file to create.

Type CreateFile

Create a new file with the provided diff.

type ResponseApplyPatchToolCallOperationDeleteFile struct{…}

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

Path string

Path of the file to delete.

Type DeleteFile

Delete the specified file.

type ResponseApplyPatchToolCallOperationUpdateFile struct{…}

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

Diff string

Diff to apply.

Path string

Path of the file to update.

Type UpdateFile

Update an existing file with the provided diff.

Status ResponseApplyPatchToolCallStatus

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

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

The type of the item. Always apply_patch_call.

CreatedBy stringoptional

The ID of the entity that created this tool call.

type ResponseApplyPatchToolCallOutput struct{…}

The output emitted by an apply patch tool call.

ID string

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

CallID string

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

Status ResponseApplyPatchToolCallOutputStatus

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

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

The type of the item. Always apply_patch_call_output.

CreatedBy stringoptional

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

Output stringoptional

Optional textual output returned by the apply patch tool.

type ResponseOutputItemMcpCall struct{…}

An invocation of a tool on an MCP server.

ID string

The unique ID of the tool call.

Arguments string

A JSON string of the arguments passed to the tool.

Name string

The name of the tool that was run.

ServerLabel string

The label of the MCP server running the tool.

Type McpCall

The type of the item. Always mcp_call.

ApprovalRequestID stringoptional

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

Error stringoptional

The error from the tool call, if any.

Output stringoptional

The output from the tool call.

Status stringoptional

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

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

A list of tools available on an MCP server.

ID string

The unique ID of the list.

ServerLabel string

The label of the MCP server.

Tools []ResponseOutputItemMcpListToolsTool

The tools available on the server.

InputSchema any

The JSON schema describing the tool's input.

Name string

The name of the tool.

Annotations anyoptional

Additional annotations about the tool.

Description stringoptional

The description of the tool.

Type McpListTools

The type of the item. Always mcp_list_tools.

Error stringoptional

Error message if the server could not list tools.

type ResponseOutputItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

ID string

The unique ID of the approval request.

Arguments string

A JSON string of arguments for the tool.

Name string

The name of the tool to run.

ServerLabel string

The label of the MCP server making the request.

Type McpApprovalRequest

The type of the item. Always mcp_approval_request.

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

Reason stringoptional

Optional reason for the decision.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

CallID string

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

Input string

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

Name string

The name of the custom tool being called.

Type CustomToolCall

The type of the custom tool call. Always custom_tool_call.

ID stringoptional

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

Namespace stringoptional

The namespace of the custom tool being called.

type ResponseCustomToolCallOutputItem 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 ResponseCustomToolCallOutputItemStatusInProgress ResponseCustomToolCallOutputItemStatus = "in_progress"
const ResponseCustomToolCallOutputItemStatusCompleted ResponseCustomToolCallOutputItemStatus = "completed"
const ResponseCustomToolCallOutputItemStatusIncomplete ResponseCustomToolCallOutputItemStatus = "incomplete"
CreatedBy stringoptional

The identifier of the actor that created the item.

Token accounting for the compaction pass, including cached, reasoning, and total tokens.

InputTokens int64

The number of input tokens.

InputTokensDetails ResponseUsageInputTokensDetails

A detailed breakdown of the input tokens.

CachedTokens int64

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

OutputTokens int64

The number of output tokens.

OutputTokensDetails ResponseUsageOutputTokensDetails

A detailed breakdown of the output tokens.

ReasoningTokens int64

The number of reasoning tokens.

TotalTokens int64

The total number of tokens used.

Compact a response

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
  "github.com/openai/openai-go/responses"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  compactedResponse, err := client.Responses.Compact(context.TODO(), responses.ResponseCompactParams{
    Model: responses.ResponseCompactParamsModelGPT5_4,
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", compactedResponse.ID)
}
{
  "id": "resp_001",
  "object": "response.compaction",
  "created_at": 1764967971,
  "output": [
    {
      "id": "msg_000",
      "type": "message",
      "status": "completed",
      "content": [
        {
          "type": "input_text",
          "text": "Create a simple landing page for a dog petting cafe."
        }
      ],
      "role": "user"
    },
    {
      "id": "cmp_001",
      "type": "compaction",
      "encrypted_content": "gAAAAABpM0Yj-...="
    }
  ],
  "usage": {
    "input_tokens": 139,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 438,
    "output_tokens_details": {
      "reasoning_tokens": 64
    },
    "total_tokens": 577
  }
}
Returns Examples
{
  "id": "resp_001",
  "object": "response.compaction",
  "created_at": 1764967971,
  "output": [
    {
      "id": "msg_000",
      "type": "message",
      "status": "completed",
      "content": [
        {
          "type": "input_text",
          "text": "Create a simple landing page for a dog petting cafe."
        }
      ],
      "role": "user"
    },
    {
      "id": "cmp_001",
      "type": "compaction",
      "encrypted_content": "gAAAAABpM0Yj-...="
    }
  ],
  "usage": {
    "input_tokens": 139,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 438,
    "output_tokens_details": {
      "reasoning_tokens": 64
    },
    "total_tokens": 577
  }
}