Skip to content
Primary navigation

Beta

BetaChatKit

ModelsExpand Collapse
ChatKitWorkflow { id, state_variables, tracing, version }

Workflow metadata and state returned for the session.

id: string

Identifier of the workflow backing the session.

state_variables: Record<string, string | boolean | number> | null

State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided.

One of the following:
string
boolean
number
tracing: Tracing { enabled }

Tracing settings applied to the workflow.

enabled: boolean

Indicates whether tracing is enabled.

version: string | null

Specific workflow version used for the session. Defaults to null when using the latest deployment.

BetaChatKitSessions

Cancel chat session
client.beta.chatkit.sessions.cancel(stringsessionID, RequestOptionsoptions?): ChatSession { id, chatkit_configuration, client_secret, 7 more }
POST/chatkit/sessions/{session_id}/cancel
Create ChatKit session
client.beta.chatkit.sessions.create(SessionCreateParams { user, workflow, chatkit_configuration, 2 more } body, RequestOptionsoptions?): ChatSession { id, chatkit_configuration, client_secret, 7 more }
POST/chatkit/sessions

BetaChatKitThreads

List ChatKit thread items
client.beta.chatkit.threads.listItems(stringthreadID, ThreadListItemsParams { after, before, limit, order } query?, RequestOptionsoptions?): ConversationCursorPage<ChatKitThreadUserMessageItem { id, attachments, content, 5 more } | ChatKitThreadAssistantMessageItem { id, content, created_at, 3 more } | ChatKitWidgetItem { id, created_at, object, 3 more } | 3 more>
GET/chatkit/threads/{thread_id}/items
Retrieve ChatKit thread
client.beta.chatkit.threads.retrieve(stringthreadID, RequestOptionsoptions?): ChatKitThread { id, created_at, object, 3 more }
GET/chatkit/threads/{thread_id}
Delete ChatKit thread
client.beta.chatkit.threads.delete(stringthreadID, RequestOptionsoptions?): ThreadDeleteResponse { id, deleted, object }
DELETE/chatkit/threads/{thread_id}
List ChatKit threads
client.beta.chatkit.threads.list(ThreadListParams { after, before, limit, 2 more } query?, RequestOptionsoptions?): ConversationCursorPage<ChatKitThread { id, created_at, object, 3 more } >
GET/chatkit/threads
ModelsExpand Collapse
ChatSession { id, chatkit_configuration, client_secret, 7 more }

Represents a ChatKit session and its resolved configuration.

id: string

Identifier for the ChatKit session.

chatkit_configuration: ChatSessionChatKitConfiguration { automatic_thread_titling, file_upload, history }

Resolved ChatKit feature configuration for the session.

client_secret: string

Ephemeral client secret that authenticates session requests.

expires_at: number

Unix timestamp (in seconds) for when the session expires.

formatunixtime
max_requests_per_1_minute: number

Convenience copy of the per-minute request limit.

object: "chatkit.session"

Type discriminator that is always chatkit.session.

rate_limits: ChatSessionRateLimits { max_requests_per_1_minute }

Resolved rate limit values.

Current lifecycle state of the session.

user: string

User identifier associated with the session.

workflow: ChatKitWorkflow { id, state_variables, tracing, version }

Workflow metadata for the session.

ChatSessionAutomaticThreadTitling { enabled }

Automatic thread title preferences for the session.

enabled: boolean

Whether automatic thread titling is enabled.

ChatSessionChatKitConfiguration { automatic_thread_titling, file_upload, history }

ChatKit configuration for the session.

automatic_thread_titling: ChatSessionAutomaticThreadTitling { enabled }

Automatic thread titling preferences.

file_upload: ChatSessionFileUpload { enabled, max_file_size, max_files }

Upload settings for the session.

history: ChatSessionHistory { enabled, recent_threads }

History retention configuration.

ChatSessionChatKitConfigurationParam { automatic_thread_titling, file_upload, history }

Optional per-session configuration settings for ChatKit behavior.

automatic_thread_titling?: AutomaticThreadTitling { enabled }

Configuration for automatic thread titling. When omitted, automatic thread titling is enabled by default.

enabled?: boolean

Enable automatic thread title generation. Defaults to true.

file_upload?: FileUpload { enabled, max_file_size, max_files }

Configuration for upload enablement and limits. When omitted, uploads are disabled by default (max_files 10, max_file_size 512 MB).

enabled?: boolean

Enable uploads for this session. Defaults to false.

max_file_size?: number

Maximum size in megabytes for each uploaded file. Defaults to 512 MB, which is the maximum allowable size.

maximum512
minimum1
max_files?: number

Maximum number of files that can be uploaded to the session. Defaults to 10.

minimum1
history?: History { enabled, recent_threads }

Configuration for chat history retention. When omitted, history is enabled by default with no limit on recent_threads (null).

enabled?: boolean

Enables chat users to access previous ChatKit threads. Defaults to true.

recent_threads?: number

Number of recent ChatKit threads users have access to. Defaults to unlimited when unset.

minimum1
ChatSessionExpiresAfterParam { anchor, seconds }

Controls when the session expires relative to an anchor timestamp.

anchor: "created_at"

Base timestamp used to calculate expiration. Currently fixed to created_at.

seconds: number

Number of seconds after the anchor when the session expires.

maximum600
minimum1
formatint64
ChatSessionFileUpload { enabled, max_file_size, max_files }

Upload permissions and limits applied to the session.

enabled: boolean

Indicates if uploads are enabled for the session.

max_file_size: number | null

Maximum upload size in megabytes.

max_files: number | null

Maximum number of uploads allowed during the session.

ChatSessionHistory { enabled, recent_threads }

History retention preferences returned for the session.

enabled: boolean

Indicates if chat history is persisted for the session.

recent_threads: number | null

Number of prior threads surfaced in history views. Defaults to null when all history is retained.

ChatSessionRateLimits { max_requests_per_1_minute }

Active per-minute request limit for the session.

max_requests_per_1_minute: number

Maximum allowed requests per one-minute window.

ChatSessionRateLimitsParam { max_requests_per_1_minute }

Controls request rate limits for the session.

max_requests_per_1_minute?: number

Maximum number of requests allowed per minute for the session. Defaults to 10.

minimum1
ChatSessionStatus = "active" | "expired" | "cancelled"
One of the following:
"active"
"expired"
"cancelled"
ChatSessionWorkflowParam { id, state_variables, tracing, version }

Workflow reference and overrides applied to the chat session.

id: string

Identifier for the workflow invoked by the session.

state_variables?: Record<string, string | boolean | number>

State variables forwarded to the workflow. Keys may be up to 64 characters, values must be primitive types, and the map defaults to an empty object.

One of the following:
string
boolean
number
tracing?: Tracing { enabled }

Optional tracing overrides for the workflow invocation. When omitted, tracing is enabled by default.

enabled?: boolean

Whether tracing is enabled during the session. Defaults to true.

version?: string

Specific workflow version to run. Defaults to the latest deployed version.

ChatKitAttachment { id, mime_type, name, 2 more }

Attachment metadata included on thread items.

id: string

Identifier for the attachment.

mime_type: string

MIME type of the attachment.

name: string

Original display name for the attachment.

preview_url: string | null

Preview URL for rendering the attachment inline.

formaturi
type: "image" | "file"

Attachment discriminator.

One of the following:
"image"
"file"
ChatKitResponseOutputText { annotations, text, type }

Assistant response text accompanied by optional annotations.

annotations: Array<File { source, type } | URL { source, type } >

Ordered list of annotations attached to the response text.

One of the following:
File { source, type }

Annotation that references an uploaded file.

source: Source { filename, type }

File attachment referenced by the annotation.

filename: string

Filename referenced by the annotation.

type: "file"

Type discriminator that is always file.

type: "file"

Type discriminator that is always file for this annotation.

URL { source, type }

Annotation that references a URL.

source: Source { type, url }

URL referenced by the annotation.

type: "url"

Type discriminator that is always url.

url: string

URL referenced by the annotation.

formaturi
type: "url"

Type discriminator that is always url for this annotation.

text: string

Assistant generated text.

type: "output_text"

Type discriminator that is always output_text.

ChatKitThread { id, created_at, object, 3 more }

Represents a ChatKit thread and its current status.

id: string

Identifier of the thread.

created_at: number

Unix timestamp (in seconds) for when the thread was created.

formatunixtime
object: "chatkit.thread"

Type discriminator that is always chatkit.thread.

status: Active { type } | Locked { reason, type } | Closed { reason, type }

Current status for the thread. Defaults to active for newly created threads.

One of the following:
Active { type }

Indicates that a thread is active.

type: "active"

Status discriminator that is always active.

Locked { reason, type }

Indicates that a thread is locked and cannot accept new input.

reason: string | null

Reason that the thread was locked. Defaults to null when no reason is recorded.

type: "locked"

Status discriminator that is always locked.

Closed { reason, type }

Indicates that a thread has been closed.

reason: string | null

Reason that the thread was closed. Defaults to null when no reason is recorded.

type: "closed"

Status discriminator that is always closed.

title: string | null

Optional human-readable title for the thread. Defaults to null when no title has been generated.

user: string

Free-form string that identifies your end user who owns the thread.

ChatKitThreadAssistantMessageItem { id, content, created_at, 3 more }

Assistant-authored message within a thread.

id: string

Identifier of the thread item.

content: Array<ChatKitResponseOutputText { annotations, text, type } >

Ordered assistant response segments.

annotations: Array<File { source, type } | URL { source, type } >

Ordered list of annotations attached to the response text.

One of the following:
File { source, type }

Annotation that references an uploaded file.

source: Source { filename, type }

File attachment referenced by the annotation.

filename: string

Filename referenced by the annotation.

type: "file"

Type discriminator that is always file.

type: "file"

Type discriminator that is always file for this annotation.

URL { source, type }

Annotation that references a URL.

source: Source { type, url }

URL referenced by the annotation.

type: "url"

Type discriminator that is always url.

url: string

URL referenced by the annotation.

formaturi
type: "url"

Type discriminator that is always url for this annotation.

text: string

Assistant generated text.

type: "output_text"

Type discriminator that is always output_text.

created_at: number

Unix timestamp (in seconds) for when the item was created.

formatunixtime
object: "chatkit.thread_item"

Type discriminator that is always chatkit.thread_item.

thread_id: string

Identifier of the parent thread.

type: "chatkit.assistant_message"

Type discriminator that is always chatkit.assistant_message.

ChatKitThreadItemList { data, first_id, has_more, 2 more }

A paginated list of thread items rendered for the ChatKit API.

data: Array<ChatKitThreadUserMessageItem { id, attachments, content, 5 more } | ChatKitThreadAssistantMessageItem { id, content, created_at, 3 more } | ChatKitWidgetItem { id, created_at, object, 3 more } | 3 more>

A list of items

One of the following:
ChatKitThreadUserMessageItem { id, attachments, content, 5 more }

User-authored messages within a thread.

id: string

Identifier of the thread item.

attachments: Array<ChatKitAttachment { id, mime_type, name, 2 more } >

Attachments associated with the user message. Defaults to an empty list.

id: string

Identifier for the attachment.

mime_type: string

MIME type of the attachment.

name: string

Original display name for the attachment.

preview_url: string | null

Preview URL for rendering the attachment inline.

formaturi
type: "image" | "file"

Attachment discriminator.

One of the following:
"image"
"file"
content: Array<InputText { text, type } | QuotedText { text, type } >

Ordered content elements supplied by the user.

One of the following:
InputText { text, type }

Text block that a user contributed to the thread.

text: string

Plain-text content supplied by the user.

type: "input_text"

Type discriminator that is always input_text.

QuotedText { text, type }

Quoted snippet that the user referenced in their message.

text: string

Quoted text content.

type: "quoted_text"

Type discriminator that is always quoted_text.

created_at: number

Unix timestamp (in seconds) for when the item was created.

formatunixtime
inference_options: InferenceOptions | null

Inference overrides applied to the message. Defaults to null when unset.

model: string | null

Model name that generated the response. Defaults to null when using the session default.

tool_choice: ToolChoice | null

Preferred tool to invoke. Defaults to null when ChatKit should auto-select.

id: string

Identifier of the requested tool.

object: "chatkit.thread_item"

Type discriminator that is always chatkit.thread_item.

thread_id: string

Identifier of the parent thread.

type: "chatkit.user_message"
ChatKitThreadAssistantMessageItem { id, content, created_at, 3 more }

Assistant-authored message within a thread.

id: string

Identifier of the thread item.

content: Array<ChatKitResponseOutputText { annotations, text, type } >

Ordered assistant response segments.

annotations: Array<File { source, type } | URL { source, type } >

Ordered list of annotations attached to the response text.

One of the following:
File { source, type }

Annotation that references an uploaded file.

source: Source { filename, type }

File attachment referenced by the annotation.

filename: string

Filename referenced by the annotation.

type: "file"

Type discriminator that is always file.

type: "file"

Type discriminator that is always file for this annotation.

URL { source, type }

Annotation that references a URL.

source: Source { type, url }

URL referenced by the annotation.

type: "url"

Type discriminator that is always url.

url: string

URL referenced by the annotation.

formaturi
type: "url"

Type discriminator that is always url for this annotation.

text: string

Assistant generated text.

type: "output_text"

Type discriminator that is always output_text.

created_at: number

Unix timestamp (in seconds) for when the item was created.

formatunixtime
object: "chatkit.thread_item"

Type discriminator that is always chatkit.thread_item.

thread_id: string

Identifier of the parent thread.

type: "chatkit.assistant_message"

Type discriminator that is always chatkit.assistant_message.

ChatKitWidgetItem { id, created_at, object, 3 more }

Thread item that renders a widget payload.

id: string

Identifier of the thread item.

created_at: number

Unix timestamp (in seconds) for when the item was created.

formatunixtime
object: "chatkit.thread_item"

Type discriminator that is always chatkit.thread_item.

thread_id: string

Identifier of the parent thread.

type: "chatkit.widget"

Type discriminator that is always chatkit.widget.

widget: string

Serialized widget payload rendered in the UI.

ChatKitClientToolCall { id, arguments, call_id, 7 more }

Record of a client side tool invocation initiated by the assistant.

id: string

Identifier of the thread item.

arguments: string

JSON-encoded arguments that were sent to the tool.

call_id: string

Identifier for the client tool call.

created_at: number

Unix timestamp (in seconds) for when the item was created.

formatunixtime
name: string

Tool name that was invoked.

object: "chatkit.thread_item"

Type discriminator that is always chatkit.thread_item.

output: string | null

JSON-encoded output captured from the tool. Defaults to null while execution is in progress.

status: "in_progress" | "completed"

Execution status for the tool call.

One of the following:
"in_progress"
"completed"
thread_id: string

Identifier of the parent thread.

type: "chatkit.client_tool_call"

Type discriminator that is always chatkit.client_tool_call.

ChatKitTask { id, created_at, heading, 5 more }

Task emitted by the workflow to show progress and status updates.

id: string

Identifier of the thread item.

created_at: number

Unix timestamp (in seconds) for when the item was created.

formatunixtime
heading: string | null

Optional heading for the task. Defaults to null when not provided.

object: "chatkit.thread_item"

Type discriminator that is always chatkit.thread_item.

summary: string | null

Optional summary that describes the task. Defaults to null when omitted.

task_type: "custom" | "thought"

Subtype for the task.

One of the following:
"custom"
"thought"
thread_id: string

Identifier of the parent thread.

type: "chatkit.task"

Type discriminator that is always chatkit.task.

ChatKitTaskGroup { id, created_at, object, 3 more }

Collection of workflow tasks grouped together in the thread.

id: string

Identifier of the thread item.

created_at: number

Unix timestamp (in seconds) for when the item was created.

formatunixtime
object: "chatkit.thread_item"

Type discriminator that is always chatkit.thread_item.

tasks: Array<Task>

Tasks included in the group.

heading: string | null

Optional heading for the grouped task. Defaults to null when not provided.

summary: string | null

Optional summary that describes the grouped task. Defaults to null when omitted.

type: "custom" | "thought"

Subtype for the grouped task.

One of the following:
"custom"
"thought"
thread_id: string

Identifier of the parent thread.

type: "chatkit.task_group"

Type discriminator that is always chatkit.task_group.

first_id: string | null

The ID of the first item in the list.

has_more: boolean

Whether there are more items available.

last_id: string | null

The ID of the last item in the list.

object: "list"

The type of object returned, must be list.

ChatKitThreadUserMessageItem { id, attachments, content, 5 more }

User-authored messages within a thread.

id: string

Identifier of the thread item.

attachments: Array<ChatKitAttachment { id, mime_type, name, 2 more } >

Attachments associated with the user message. Defaults to an empty list.

id: string

Identifier for the attachment.

mime_type: string

MIME type of the attachment.

name: string

Original display name for the attachment.

preview_url: string | null

Preview URL for rendering the attachment inline.

formaturi
type: "image" | "file"

Attachment discriminator.

One of the following:
"image"
"file"
content: Array<InputText { text, type } | QuotedText { text, type } >

Ordered content elements supplied by the user.

One of the following:
InputText { text, type }

Text block that a user contributed to the thread.

text: string

Plain-text content supplied by the user.

type: "input_text"

Type discriminator that is always input_text.

QuotedText { text, type }

Quoted snippet that the user referenced in their message.

text: string

Quoted text content.

type: "quoted_text"

Type discriminator that is always quoted_text.

created_at: number

Unix timestamp (in seconds) for when the item was created.

formatunixtime
inference_options: InferenceOptions | null

Inference overrides applied to the message. Defaults to null when unset.

model: string | null

Model name that generated the response. Defaults to null when using the session default.

tool_choice: ToolChoice | null

Preferred tool to invoke. Defaults to null when ChatKit should auto-select.

id: string

Identifier of the requested tool.

object: "chatkit.thread_item"

Type discriminator that is always chatkit.thread_item.

thread_id: string

Identifier of the parent thread.

type: "chatkit.user_message"
ChatKitWidgetItem { id, created_at, object, 3 more }

Thread item that renders a widget payload.

id: string

Identifier of the thread item.

created_at: number

Unix timestamp (in seconds) for when the item was created.

formatunixtime
object: "chatkit.thread_item"

Type discriminator that is always chatkit.thread_item.

thread_id: string

Identifier of the parent thread.

type: "chatkit.widget"

Type discriminator that is always chatkit.widget.

widget: string

Serialized widget payload rendered in the UI.

ThreadDeleteResponse { id, deleted, object }

Confirmation payload returned after deleting a thread.

id: string

Identifier of the deleted thread.

deleted: boolean

Indicates that the thread has been deleted.

object: "chatkit.thread.deleted"

Type discriminator that is always chatkit.thread.deleted.

BetaAssistants

Build Assistants that can call models and use tools.

List assistants
Deprecated
client.beta.assistants.list(AssistantListParams { after, before, limit, order } query?, RequestOptionsoptions?): CursorPage<Assistant { id, created_at, description, 10 more } >
GET/assistants
Create assistant
Deprecated
client.beta.assistants.create(AssistantCreateParams { model, description, instructions, 8 more } body, RequestOptionsoptions?): Assistant { id, created_at, description, 10 more }
POST/assistants
Retrieve assistant
Deprecated
client.beta.assistants.retrieve(stringassistantID, RequestOptionsoptions?): Assistant { id, created_at, description, 10 more }
GET/assistants/{assistant_id}
Modify assistant
Deprecated
client.beta.assistants.update(stringassistantID, AssistantUpdateParams { description, instructions, metadata, 8 more } body, RequestOptionsoptions?): Assistant { id, created_at, description, 10 more }
POST/assistants/{assistant_id}
Delete assistant
Deprecated
client.beta.assistants.delete(stringassistantID, RequestOptionsoptions?): AssistantDeleted { id, deleted, object }
DELETE/assistants/{assistant_id}
ModelsExpand Collapse
Assistant { id, created_at, description, 10 more }

Represents an assistant that can call the model and use tools.

id: string

The identifier, which can be referenced in API endpoints.

created_at: number

The Unix timestamp (in seconds) for when the assistant was created.

formatunixtime
description: string | null

The description of the assistant. The maximum length is 512 characters.

maxLength512
instructions: string | null

The system instructions that the assistant uses. The maximum length is 256,000 characters.

maxLength256000
metadata: Metadata | null

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

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

model: string

ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.

name: string | null

The name of the assistant. The maximum length is 256 characters.

maxLength256
object: "assistant"

The object type, which is always assistant.

tools: Array<unknown>

A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types code_interpreter, file_search, or function.

response_format?: AssistantResponseFormatOption | null

Specifies the format that the model must output. Compatible with GPT-4o, GPT-4 Turbo, and all GPT-3.5 Turbo models since gpt-3.5-turbo-1106.

Setting to { "type": "json_schema", "json_schema": {...} } enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.

Setting to { "type": "json_object" } enables JSON mode, which ensures the message the model generates is valid JSON.

Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly “stuck” request. Also note that the message content may be partially cut off if finish_reason="length", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.

temperature?: number | null

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

minimum0
maximum2
tool_resources?: ToolResources | null

A set of resources that are used by the assistant’s tools. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs.

code_interpreter?: CodeInterpreter { file_ids }
file_ids?: Array<string>

A list of file IDs made available to the `code_interpreter“ tool. There can be a maximum of 20 files associated with the tool.

top_p?: number | null

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

We generally recommend altering this or temperature but not both.

minimum0
maximum1
AssistantDeleted { id, deleted, object }
id: string
deleted: boolean
object: "assistant.deleted"
AssistantStreamEvent = ThreadCreated { data, event, enabled } | ThreadRunCreated { data, event } | ThreadRunQueued { data, event } | 21 more

Represents an event emitted when streaming a Run.

Each event in a server-sent events stream has an event and data property:

event: thread.created
data: {"id": "thread_123", "object": "thread", ...}

We emit events whenever a new object is created, transitions to a new state, or is being streamed in parts (deltas). For example, we emit thread.run.created when a new run is created, thread.run.completed when a run completes, and so on. When an Assistant chooses to create a message during a run, we emit a thread.message.created event, a thread.message.in_progress event, many thread.message.delta events, and finally a thread.message.completed event.

We may add additional events over time, so we recommend handling unknown events gracefully in your code. See the Assistants API quickstart to learn how to integrate the Assistants API with streaming.

One of the following:
ThreadCreated { data, event, enabled }

Occurs when a new thread is created.

data: Thread { id, created_at, metadata, 2 more }

Represents a thread that contains messages.

event: "thread.created"
enabled?: boolean

Whether to enable input audio transcription.

ThreadRunCreated { data, event }

Occurs when a new run is created.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.created"
ThreadRunQueued { data, event }

Occurs when a run moves to a queued status.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.queued"
ThreadRunInProgress { data, event }

Occurs when a run moves to an in_progress status.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.in_progress"
ThreadRunRequiresAction { data, event }

Occurs when a run moves to a requires_action status.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.requires_action"
ThreadRunCompleted { data, event }

Occurs when a run is completed.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.completed"
ThreadRunIncomplete { data, event }

Occurs when a run ends with status incomplete.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.incomplete"
ThreadRunFailed { data, event }

Occurs when a run fails.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.failed"
ThreadRunCancelling { data, event }

Occurs when a run moves to a cancelling status.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.cancelling"
ThreadRunCancelled { data, event }

Occurs when a run is cancelled.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.cancelled"
ThreadRunExpired { data, event }

Occurs when a run expires.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.expired"
ThreadRunStepCreated { data, event }

Occurs when a run step is created.

data: RunStep { id, assistant_id, cancelled_at, 13 more }

Represents a step in execution of a run.

event: "thread.run.step.created"
ThreadRunStepInProgress { data, event }

Occurs when a run step moves to an in_progress state.

data: RunStep { id, assistant_id, cancelled_at, 13 more }

Represents a step in execution of a run.

event: "thread.run.step.in_progress"
ThreadRunStepDelta { data, event }

Occurs when parts of a run step are being streamed.

data: RunStepDeltaEvent { id, delta, object }

Represents a run step delta i.e. any changed fields on a run step during streaming.

event: "thread.run.step.delta"
ThreadRunStepCompleted { data, event }

Occurs when a run step is completed.

data: RunStep { id, assistant_id, cancelled_at, 13 more }

Represents a step in execution of a run.

event: "thread.run.step.completed"
ThreadRunStepFailed { data, event }

Occurs when a run step fails.

data: RunStep { id, assistant_id, cancelled_at, 13 more }

Represents a step in execution of a run.

event: "thread.run.step.failed"
ThreadRunStepCancelled { data, event }

Occurs when a run step is cancelled.

data: RunStep { id, assistant_id, cancelled_at, 13 more }

Represents a step in execution of a run.

event: "thread.run.step.cancelled"
ThreadRunStepExpired { data, event }

Occurs when a run step expires.

data: RunStep { id, assistant_id, cancelled_at, 13 more }

Represents a step in execution of a run.

event: "thread.run.step.expired"
ThreadMessageCreated { data, event }

Occurs when a message is created.

data: Message { id, assistant_id, attachments, 11 more }

Represents a message within a thread.

event: "thread.message.created"
ThreadMessageInProgress { data, event }

Occurs when a message moves to an in_progress state.

data: Message { id, assistant_id, attachments, 11 more }

Represents a message within a thread.

event: "thread.message.in_progress"
ThreadMessageDelta { data, event }

Occurs when parts of a Message are being streamed.

data: MessageDeltaEvent { id, delta, object }

Represents a message delta i.e. any changed fields on a message during streaming.

event: "thread.message.delta"
ThreadMessageCompleted { data, event }

Occurs when a message is completed.

data: Message { id, assistant_id, attachments, 11 more }

Represents a message within a thread.

event: "thread.message.completed"
ThreadMessageIncomplete { data, event }

Occurs when a message ends before it is completed.

data: Message { id, assistant_id, attachments, 11 more }

Represents a message within a thread.

event: "thread.message.incomplete"
ErrorEvent { data, event }

Occurs when an error occurs. This can happen due to an internal server error or a timeout.

data: ErrorObject { code, message, param, type }
event: "error"
AssistantTool = unknown
CodeInterpreterTool { type }
type: "code_interpreter"

The type of tool being defined: code_interpreter

FileSearchTool { type, file_search }
type: "file_search"

The type of tool being defined: file_search

One of the following:
FunctionTool { function, type }
function: FunctionDefinition { name, description, parameters, strict }
type: "function"

The type of tool being defined: function

MessageStreamEvent = ThreadMessageCreated { data, event } | ThreadMessageInProgress { data, event } | ThreadMessageDelta { data, event } | 2 more

Occurs when a message is created.

One of the following:
ThreadMessageCreated { data, event }

Occurs when a message is created.

data: Message { id, assistant_id, attachments, 11 more }

Represents a message within a thread.

event: "thread.message.created"
ThreadMessageInProgress { data, event }

Occurs when a message moves to an in_progress state.

data: Message { id, assistant_id, attachments, 11 more }

Represents a message within a thread.

event: "thread.message.in_progress"
ThreadMessageDelta { data, event }

Occurs when parts of a Message are being streamed.

data: MessageDeltaEvent { id, delta, object }

Represents a message delta i.e. any changed fields on a message during streaming.

event: "thread.message.delta"
ThreadMessageCompleted { data, event }

Occurs when a message is completed.

data: Message { id, assistant_id, attachments, 11 more }

Represents a message within a thread.

event: "thread.message.completed"
ThreadMessageIncomplete { data, event }

Occurs when a message ends before it is completed.

data: Message { id, assistant_id, attachments, 11 more }

Represents a message within a thread.

event: "thread.message.incomplete"
RunStepStreamEvent = ThreadRunStepCreated { data, event } | ThreadRunStepInProgress { data, event } | ThreadRunStepDelta { data, event } | 4 more

Occurs when a run step is created.

One of the following:
ThreadRunStepCreated { data, event }

Occurs when a run step is created.

data: RunStep { id, assistant_id, cancelled_at, 13 more }

Represents a step in execution of a run.

event: "thread.run.step.created"
ThreadRunStepInProgress { data, event }

Occurs when a run step moves to an in_progress state.

data: RunStep { id, assistant_id, cancelled_at, 13 more }

Represents a step in execution of a run.

event: "thread.run.step.in_progress"
ThreadRunStepDelta { data, event }

Occurs when parts of a run step are being streamed.

data: RunStepDeltaEvent { id, delta, object }

Represents a run step delta i.e. any changed fields on a run step during streaming.

event: "thread.run.step.delta"
ThreadRunStepCompleted { data, event }

Occurs when a run step is completed.

data: RunStep { id, assistant_id, cancelled_at, 13 more }

Represents a step in execution of a run.

event: "thread.run.step.completed"
ThreadRunStepFailed { data, event }

Occurs when a run step fails.

data: RunStep { id, assistant_id, cancelled_at, 13 more }

Represents a step in execution of a run.

event: "thread.run.step.failed"
ThreadRunStepCancelled { data, event }

Occurs when a run step is cancelled.

data: RunStep { id, assistant_id, cancelled_at, 13 more }

Represents a step in execution of a run.

event: "thread.run.step.cancelled"
ThreadRunStepExpired { data, event }

Occurs when a run step expires.

data: RunStep { id, assistant_id, cancelled_at, 13 more }

Represents a step in execution of a run.

event: "thread.run.step.expired"
RunStreamEvent = ThreadRunCreated { data, event } | ThreadRunQueued { data, event } | ThreadRunInProgress { data, event } | 7 more

Occurs when a new run is created.

One of the following:
ThreadRunCreated { data, event }

Occurs when a new run is created.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.created"
ThreadRunQueued { data, event }

Occurs when a run moves to a queued status.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.queued"
ThreadRunInProgress { data, event }

Occurs when a run moves to an in_progress status.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.in_progress"
ThreadRunRequiresAction { data, event }

Occurs when a run moves to a requires_action status.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.requires_action"
ThreadRunCompleted { data, event }

Occurs when a run is completed.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.completed"
ThreadRunIncomplete { data, event }

Occurs when a run ends with status incomplete.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.incomplete"
ThreadRunFailed { data, event }

Occurs when a run fails.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.failed"
ThreadRunCancelling { data, event }

Occurs when a run moves to a cancelling status.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.cancelling"
ThreadRunCancelled { data, event }

Occurs when a run is cancelled.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.cancelled"
ThreadRunExpired { data, event }

Occurs when a run expires.

data: Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

event: "thread.run.expired"
ThreadStreamEvent { data, event, enabled }

Occurs when a new thread is created.

data: Thread { id, created_at, metadata, 2 more }

Represents a thread that contains messages.

event: "thread.created"
enabled?: boolean

Whether to enable input audio transcription.

BetaThreads

Build Assistants that can call models and use tools.

Create thread
Deprecated
client.beta.threads.create(ThreadCreateParams { messages, metadata, tool_resources } body?, RequestOptionsoptions?): Thread { id, created_at, metadata, 2 more }
POST/threads
Create thread and run
Deprecated
client.beta.threads.createAndRun(ThreadCreateAndRunParamsbody, RequestOptionsoptions?): Run { id, assistant_id, cancelled_at, 24 more } | Stream<AssistantStreamEvent>
POST/threads/runs
Retrieve thread
Deprecated
client.beta.threads.retrieve(stringthreadID, RequestOptionsoptions?): Thread { id, created_at, metadata, 2 more }
GET/threads/{thread_id}
Modify thread
Deprecated
client.beta.threads.update(stringthreadID, ThreadUpdateParams { metadata, tool_resources } body, RequestOptionsoptions?): Thread { id, created_at, metadata, 2 more }
POST/threads/{thread_id}
Delete thread
Deprecated
client.beta.threads.delete(stringthreadID, RequestOptionsoptions?): ThreadDeleted { id, deleted, object }
DELETE/threads/{thread_id}
ModelsExpand Collapse
AssistantResponseFormatOption = "auto" | ResponseFormatText { type } | ResponseFormatJSONObject { type } | ResponseFormatJSONSchema { json_schema, type }

Specifies the format that the model must output. Compatible with GPT-4o, GPT-4 Turbo, and all GPT-3.5 Turbo models since gpt-3.5-turbo-1106.

Setting to { "type": "json_schema", "json_schema": {...} } enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.

Setting to { "type": "json_object" } enables JSON mode, which ensures the message the model generates is valid JSON.

Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly “stuck” request. Also note that the message content may be partially cut off if finish_reason="length", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.

One of the following:
"auto"
"auto"
ResponseFormatText { type }

Default response format. Used to generate text responses.

type: "text"

The type of response format being defined. Always text.

ResponseFormatJSONObject { type }

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

type: "json_object"

The type of response format being defined. Always json_object.

ResponseFormatJSONSchema { json_schema, type }

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

json_schema: JSONSchema { name, description, schema, strict }

Structured Outputs configuration options, including a JSON Schema.

name: string

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

description?: string

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

schema?: Record<string, unknown>

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

strict?: boolean | null

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

type: "json_schema"

The type of response format being defined. Always json_schema.

AssistantToolChoice { type, function }

Specifies a tool the model should use. Use to force the model to call a specific tool.

type: "function" | "code_interpreter" | "file_search"

The type of the tool. If type is function, the function name must be set

One of the following:
"function"
"code_interpreter"
"file_search"
function?: AssistantToolChoiceFunction { name }
AssistantToolChoiceFunction { name }
name: string

The name of the function to call.

AssistantToolChoiceOption = "none" | "auto" | "required" | AssistantToolChoice { type, function }

Controls which (if any) tool is called by the model. none means the model will not call any tools and instead generates a message. auto is the default value and means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools before responding to the user. Specifying a particular tool like {"type": "file_search"} or {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.

One of the following:
"none" | "auto" | "required"
"none"
"auto"
"required"
AssistantToolChoice { type, function }

Specifies a tool the model should use. Use to force the model to call a specific tool.

type: "function" | "code_interpreter" | "file_search"

The type of the tool. If type is function, the function name must be set

One of the following:
"function"
"code_interpreter"
"file_search"
function?: AssistantToolChoiceFunction { name }
Thread { id, created_at, metadata, 2 more }

Represents a thread that contains messages.

id: string

The identifier, which can be referenced in API endpoints.

created_at: number

The Unix timestamp (in seconds) for when the thread was created.

formatunixtime
metadata: Metadata | null

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.

object: "thread"

The object type, which is always thread.

tool_resources: ToolResources | null

A set of resources that are made available to the assistant’s tools in this thread. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs.

code_interpreter?: CodeInterpreter { file_ids }
file_ids?: Array<string>

A list of file IDs made available to the code_interpreter tool. There can be a maximum of 20 files associated with the tool.

ThreadDeleted { id, deleted, object }
id: string
deleted: boolean
object: "thread.deleted"

BetaThreadsRuns

Build Assistants that can call models and use tools.

List runs
Deprecated
client.beta.threads.runs.list(stringthreadID, RunListParams { after, before, limit, order } query?, RequestOptionsoptions?): CursorPage<Run { id, assistant_id, cancelled_at, 24 more } >
GET/threads/{thread_id}/runs
Create run
Deprecated
client.beta.threads.runs.create(stringthreadID, RunCreateParamsparams, RequestOptionsoptions?): Run { id, assistant_id, cancelled_at, 24 more } | Stream<AssistantStreamEvent>
POST/threads/{thread_id}/runs
Retrieve run
Deprecated
client.beta.threads.runs.retrieve(stringrunID, RunRetrieveParams { thread_id } params, RequestOptionsoptions?): Run { id, assistant_id, cancelled_at, 24 more }
GET/threads/{thread_id}/runs/{run_id}
Modify run
Deprecated
client.beta.threads.runs.update(stringrunID, RunUpdateParams { thread_id, metadata } params, RequestOptionsoptions?): Run { id, assistant_id, cancelled_at, 24 more }
POST/threads/{thread_id}/runs/{run_id}
Submit tool outputs to run
Deprecated
client.beta.threads.runs.submitToolOutputs(stringrunID, RunSubmitToolOutputsParamsparams, RequestOptionsoptions?): Run { id, assistant_id, cancelled_at, 24 more } | Stream<AssistantStreamEvent>
POST/threads/{thread_id}/runs/{run_id}/submit_tool_outputs
Cancel a run
Deprecated
client.beta.threads.runs.cancel(stringrunID, RunCancelParams { thread_id } params, RequestOptionsoptions?): Run { id, assistant_id, cancelled_at, 24 more }
POST/threads/{thread_id}/runs/{run_id}/cancel
ModelsExpand Collapse
RequiredActionFunctionToolCall { id, function, type }

Tool call objects

id: string

The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the Submit tool outputs to run endpoint.

function: Function { arguments, name }

The function definition.

arguments: string

The arguments that the model expects you to pass to the function.

name: string

The name of the function.

type: "function"

The type of tool call the output is required for. For now, this is always function.

Run { id, assistant_id, cancelled_at, 24 more }

Represents an execution run on a thread.

id: string

The identifier, which can be referenced in API endpoints.

assistant_id: string

The ID of the assistant used for execution of this run.

cancelled_at: number | null

The Unix timestamp (in seconds) for when the run was cancelled.

formatunixtime
completed_at: number | null

The Unix timestamp (in seconds) for when the run was completed.

formatunixtime
created_at: number

The Unix timestamp (in seconds) for when the run was created.

formatunixtime
expires_at: number | null

The Unix timestamp (in seconds) for when the run will expire.

formatunixtime
failed_at: number | null

The Unix timestamp (in seconds) for when the run failed.

formatunixtime
incomplete_details: IncompleteDetails | null

Details on why the run is incomplete. Will be null if the run is not incomplete.

reason?: "max_completion_tokens" | "max_prompt_tokens"

The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.

One of the following:
"max_completion_tokens"
"max_prompt_tokens"
instructions: string

The instructions that the assistant used for this run.

last_error: LastError | null

The last error associated with this run. Will be null if there are no errors.

code: "server_error" | "rate_limit_exceeded" | "invalid_prompt"

One of server_error, rate_limit_exceeded, or invalid_prompt.

One of the following:
"server_error"
"rate_limit_exceeded"
"invalid_prompt"
message: string

A human-readable description of the error.

max_completion_tokens: number | null

The maximum number of completion tokens specified to have been used over the course of the run.

minimum256
max_prompt_tokens: number | null

The maximum number of prompt tokens specified to have been used over the course of the run.

minimum256
metadata: Metadata | null

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

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

model: string

The model that the assistant used for this run.

object: "thread.run"

The object type, which is always thread.run.

parallel_tool_calls: boolean

Whether to enable parallel function calling during tool use.

required_action: RequiredAction | null

Details on the action required to continue the run. Will be null if no action is required.

submit_tool_outputs: SubmitToolOutputs { tool_calls }

Details on the tool outputs needed for this run to continue.

tool_calls: Array<RequiredActionFunctionToolCall { id, function, type } >

A list of the relevant tool calls.

id: string

The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the Submit tool outputs to run endpoint.

function: Function { arguments, name }

The function definition.

arguments: string

The arguments that the model expects you to pass to the function.

name: string

The name of the function.

type: "function"

The type of tool call the output is required for. For now, this is always function.

type: "submit_tool_outputs"

For now, this is always submit_tool_outputs.

response_format: AssistantResponseFormatOption | null

Specifies the format that the model must output. Compatible with GPT-4o, GPT-4 Turbo, and all GPT-3.5 Turbo models since gpt-3.5-turbo-1106.

Setting to { "type": "json_schema", "json_schema": {...} } enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.

Setting to { "type": "json_object" } enables JSON mode, which ensures the message the model generates is valid JSON.

Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly “stuck” request. Also note that the message content may be partially cut off if finish_reason="length", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.

started_at: number | null

The Unix timestamp (in seconds) for when the run was started.

formatunixtime
status: unknown
thread_id: string

The ID of the thread that was executed on as a part of this run.

tool_choice: AssistantToolChoiceOption | null

Controls which (if any) tool is called by the model. none means the model will not call any tools and instead generates a message. auto is the default value and means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools before responding to the user. Specifying a particular tool like {"type": "file_search"} or {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.

tools: Array<unknown>

The list of tools that the assistant used for this run.

truncation_strategy: TruncationStrategy | null

Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run.

type: "auto" | "last_messages"

The truncation strategy to use for the thread. The default is auto. If set to last_messages, the thread will be truncated to the n most recent messages in the thread. When set to auto, messages in the middle of the thread will be dropped to fit the context length of the model, max_prompt_tokens.

One of the following:
"auto"
"last_messages"
last_messages?: number | null

The number of most recent messages from the thread when constructing the context for the run.

minimum1
usage: Usage | null

Usage statistics related to the run. This value will be null if the run is not in a terminal state (i.e. in_progress, queued, etc.).

completion_tokens: number

Number of completion tokens used over the course of the run.

prompt_tokens: number

Number of prompt tokens used over the course of the run.

total_tokens: number

Total number of tokens used (prompt + completion).

temperature?: number | null

The sampling temperature used for this run. If not set, defaults to 1.

top_p?: number | null

The nucleus sampling value used for this run. If not set, defaults to 1.

RunStatus = unknown

BetaThreadsRunsSteps

Build Assistants that can call models and use tools.

List run steps
Deprecated
client.beta.threads.runs.steps.list(stringrunID, StepListParams { thread_id, after, before, 3 more } params, RequestOptionsoptions?): CursorPage<RunStep { id, assistant_id, cancelled_at, 13 more } >
GET/threads/{thread_id}/runs/{run_id}/steps
Retrieve run step
Deprecated
client.beta.threads.runs.steps.retrieve(stringstepID, StepRetrieveParams { thread_id, run_id, include } params, RequestOptionsoptions?): RunStep { id, assistant_id, cancelled_at, 13 more }
GET/threads/{thread_id}/runs/{run_id}/steps/{step_id}
ModelsExpand Collapse
CodeInterpreterLogs { index, type, logs }

Text output from the Code Interpreter tool call as part of a run step.

index: number

The index of the output in the outputs array.

type: "logs"

Always logs.

logs?: string

The text output from the Code Interpreter tool call.

CodeInterpreterOutputImage { index, type, image }
index: number

The index of the output in the outputs array.

type: "image"

Always image.

image?: Image { file_id }
file_id?: string

The file ID of the image.

CodeInterpreterToolCall { id, code_interpreter, type }

Details of the Code Interpreter tool call the run step was involved in.

id: string

The ID of the tool call.

code_interpreter: CodeInterpreter { input, outputs }

The Code Interpreter tool call definition.

input: string

The input to the Code Interpreter tool call.

outputs: Array<Logs { logs, type } | Image { image, type } >

The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (logs) or images (image). Each of these are represented by a different object type.

One of the following:
Logs { logs, type }

Text output from the Code Interpreter tool call as part of a run step.

logs: string

The text output from the Code Interpreter tool call.

type: "logs"

Always logs.

Image { image, type }
image: Image { file_id }
file_id: string

The file ID of the image.

type: "image"

Always image.

type: "code_interpreter"

The type of tool call. This is always going to be code_interpreter for this type of tool call.

CodeInterpreterToolCallDelta { index, type, id, code_interpreter }

Details of the Code Interpreter tool call the run step was involved in.

index: number

The index of the tool call in the tool calls array.

type: "code_interpreter"

The type of tool call. This is always going to be code_interpreter for this type of tool call.

id?: string

The ID of the tool call.

code_interpreter?: CodeInterpreter { input, outputs }

The Code Interpreter tool call definition.

input?: string

The input to the Code Interpreter tool call.

outputs?: Array<CodeInterpreterLogs { index, type, logs } | CodeInterpreterOutputImage { index, type, image } >

The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (logs) or images (image). Each of these are represented by a different object type.

One of the following:
CodeInterpreterLogs { index, type, logs }

Text output from the Code Interpreter tool call as part of a run step.

index: number

The index of the output in the outputs array.

type: "logs"

Always logs.

logs?: string

The text output from the Code Interpreter tool call.

CodeInterpreterOutputImage { index, type, image }
index: number

The index of the output in the outputs array.

type: "image"

Always image.

image?: Image { file_id }
file_id?: string

The file ID of the image.

FileSearchToolCall { id, file_search, type }
id: string

The ID of the tool call object.

One of the following:
type: "file_search"

The type of tool call. This is always going to be file_search for this type of tool call.

FileSearchToolCallDelta { file_search, index, type, id }
index: number

The index of the tool call in the tool calls array.

type: "file_search"

The type of tool call. This is always going to be file_search for this type of tool call.

id?: string

The ID of the tool call object.

FunctionToolCall { id, function, type }
id: string

The ID of the tool call object.

function: Function { arguments, name, output }

The definition of the function that was called.

arguments: string

The arguments passed to the function.

name: string

The name of the function.

output: string | null

The output of the function. This will be null if the outputs have not been submitted yet.

type: "function"

The type of tool call. This is always going to be function for this type of tool call.

FunctionToolCallDelta { index, type, id, function }
index: number

The index of the tool call in the tool calls array.

type: "function"

The type of tool call. This is always going to be function for this type of tool call.

id?: string

The ID of the tool call object.

function?: Function { arguments, name, output }

The definition of the function that was called.

arguments?: string

The arguments passed to the function.

name?: string

The name of the function.

output?: string | null

The output of the function. This will be null if the outputs have not been submitted yet.

MessageCreationStepDetails { message_creation, type }

Details of the message creation by the run step.

message_creation: MessageCreation { message_id }
message_id: string

The ID of the message that was created by this run step.

type: "message_creation"

Always message_creation.

RunStep { id, assistant_id, cancelled_at, 13 more }

Represents a step in execution of a run.

id: string

The identifier of the run step, which can be referenced in API endpoints.

assistant_id: string

The ID of the assistant associated with the run step.

cancelled_at: number | null

The Unix timestamp (in seconds) for when the run step was cancelled.

formatunixtime
completed_at: number | null

The Unix timestamp (in seconds) for when the run step completed.

formatunixtime
created_at: number

The Unix timestamp (in seconds) for when the run step was created.

formatunixtime
expired_at: number | null

The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.

formatunixtime
failed_at: number | null

The Unix timestamp (in seconds) for when the run step failed.

formatunixtime
last_error: LastError | null

The last error associated with this run step. Will be null if there are no errors.

code: "server_error" | "rate_limit_exceeded"

One of server_error or rate_limit_exceeded.

One of the following:
"server_error"
"rate_limit_exceeded"
message: string

A human-readable description of the error.

metadata: Metadata | null

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.

object: "thread.run.step"

The object type, which is always thread.run.step.

run_id: string

The ID of the run that this run step is a part of.

status: "in_progress" | "cancelled" | "failed" | 2 more

The status of the run step, which can be either in_progress, cancelled, failed, completed, or expired.

One of the following:
"in_progress"
"cancelled"
"failed"
"completed"
"expired"
step_details: MessageCreationStepDetails { message_creation, type } | ToolCallsStepDetails { tool_calls, type }

The details of the run step.

One of the following:
MessageCreationStepDetails { message_creation, type }

Details of the message creation by the run step.

message_creation: MessageCreation { message_id }
message_id: string

The ID of the message that was created by this run step.

type: "message_creation"

Always message_creation.

ToolCallsStepDetails { tool_calls, type }

Details of the tool call.

tool_calls: Array<unknown>

An array of tool calls the run step was involved in. These can be associated with one of three types of tools: code_interpreter, file_search, or function.

type: "tool_calls"

Always tool_calls.

thread_id: string

The ID of the thread that was run.

type: "message_creation" | "tool_calls"

The type of run step, which can be either message_creation or tool_calls.

One of the following:
"message_creation"
"tool_calls"
usage: Usage | null

Usage statistics related to the run step. This value will be null while the run step’s status is in_progress.

completion_tokens: number

Number of completion tokens used over the course of the run step.

prompt_tokens: number

Number of prompt tokens used over the course of the run step.

total_tokens: number

Total number of tokens used (prompt + completion).

RunStepDelta = unknown
RunStepDeltaEvent { id, delta, object }

Represents a run step delta i.e. any changed fields on a run step during streaming.

id: string

The identifier of the run step, which can be referenced in API endpoints.

delta: unknown
object: "thread.run.step.delta"

The object type, which is always thread.run.step.delta.

RunStepDeltaMessageDelta { type, message_creation }

Details of the message creation by the run step.

type: "message_creation"

Always message_creation.

message_creation?: MessageCreation { message_id }
message_id?: string

The ID of the message that was created by this run step.

RunStepInclude = "step_details.tool_calls[*].file_search.results[*].content"
ToolCall = unknown
ToolCallDelta = unknown
ToolCallDeltaObject { type, tool_calls }

Details of the tool call.

type: "tool_calls"

Always tool_calls.

tool_calls?: Array<unknown>

An array of tool calls the run step was involved in. These can be associated with one of three types of tools: code_interpreter, file_search, or function.

ToolCallsStepDetails { tool_calls, type }

Details of the tool call.

tool_calls: Array<unknown>

An array of tool calls the run step was involved in. These can be associated with one of three types of tools: code_interpreter, file_search, or function.

type: "tool_calls"

Always tool_calls.

BetaThreadsMessages

Build Assistants that can call models and use tools.

List messages
Deprecated
client.beta.threads.messages.list(stringthreadID, MessageListParams { after, before, limit, 2 more } query?, RequestOptionsoptions?): CursorPage<Message { id, assistant_id, attachments, 11 more } >
GET/threads/{thread_id}/messages
Create message
Deprecated
client.beta.threads.messages.create(stringthreadID, MessageCreateParams { content, role, attachments, metadata } body, RequestOptionsoptions?): Message { id, assistant_id, attachments, 11 more }
POST/threads/{thread_id}/messages
Modify message
Deprecated
client.beta.threads.messages.update(stringmessageID, MessageUpdateParams { thread_id, metadata } params, RequestOptionsoptions?): Message { id, assistant_id, attachments, 11 more }
POST/threads/{thread_id}/messages/{message_id}
Retrieve message
Deprecated
client.beta.threads.messages.retrieve(stringmessageID, MessageRetrieveParams { thread_id } params, RequestOptionsoptions?): Message { id, assistant_id, attachments, 11 more }
GET/threads/{thread_id}/messages/{message_id}
Delete message
Deprecated
client.beta.threads.messages.delete(stringmessageID, MessageDeleteParams { thread_id } params, RequestOptionsoptions?): MessageDeleted { id, deleted, object }
DELETE/threads/{thread_id}/messages/{message_id}
ModelsExpand Collapse
Annotation = unknown
AnnotationDelta = unknown
FileCitationAnnotation { end_index, file_citation, start_index, 2 more }

A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the “file_search” tool to search files.

end_index: number
minimum0
file_citation: FileCitation { file_id }
file_id: string

The ID of the specific File the citation is from.

start_index: number
minimum0
text: string

The text in the message content that needs to be replaced.

type: "file_citation"

Always file_citation.

FileCitationDeltaAnnotation { index, type, end_index, 3 more }

A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the “file_search” tool to search files.

index: number

The index of the annotation in the text content part.

type: "file_citation"

Always file_citation.

end_index?: number
minimum0
file_citation?: FileCitation { file_id, quote }
file_id?: string

The ID of the specific File the citation is from.

quote?: string

The specific quote in the file.

start_index?: number
minimum0
text?: string

The text in the message content that needs to be replaced.

FilePathAnnotation { end_index, file_path, start_index, 2 more }

A URL for the file that’s generated when the assistant used the code_interpreter tool to generate a file.

end_index: number
minimum0
file_path: FilePath { file_id }
file_id: string

The ID of the file that was generated.

start_index: number
minimum0
text: string

The text in the message content that needs to be replaced.

type: "file_path"

Always file_path.

FilePathDeltaAnnotation { index, type, end_index, 3 more }

A URL for the file that’s generated when the assistant used the code_interpreter tool to generate a file.

index: number

The index of the annotation in the text content part.

type: "file_path"

Always file_path.

end_index?: number
minimum0
file_path?: FilePath { file_id }
file_id?: string

The ID of the file that was generated.

start_index?: number
minimum0
text?: string

The text in the message content that needs to be replaced.

ImageFile { file_id, detail }
file_id: string

The File ID of the image in the message content. Set purpose="vision" when uploading the File if you need to later display the file content.

detail?: "auto" | "low" | "high"

Specifies the detail level of the image if specified by the user. low uses fewer tokens, you can opt in to high resolution using high.

One of the following:
"auto"
"low"
"high"
ImageFileContentBlock { image_file, type }

References an image File in the content of a message.

image_file: ImageFile { file_id, detail }
type: "image_file"

Always image_file.

ImageFileDelta { detail, file_id }
detail?: "auto" | "low" | "high"

Specifies the detail level of the image if specified by the user. low uses fewer tokens, you can opt in to high resolution using high.

One of the following:
"auto"
"low"
"high"
file_id?: string

The File ID of the image in the message content. Set purpose="vision" when uploading the File if you need to later display the file content.

ImageFileDeltaBlock { index, type, image_file }

References an image File in the content of a message.

index: number

The index of the content part in the message.

type: "image_file"

Always image_file.

image_file?: ImageFileDelta { detail, file_id }
ImageURL { url, detail }
url: string

The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.

formaturi
detail?: "auto" | "low" | "high"

Specifies the detail level of the image. low uses fewer tokens, you can opt in to high resolution using high. Default value is auto

One of the following:
"auto"
"low"
"high"
ImageURLContentBlock { image_url, type }

References an image URL in the content of a message.

image_url: ImageURL { url, detail }
type: "image_url"

The type of the content part.

ImageURLDelta { detail, url }
detail?: "auto" | "low" | "high"

Specifies the detail level of the image. low uses fewer tokens, you can opt in to high resolution using high.

One of the following:
"auto"
"low"
"high"
url?: string

The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.

formaturi
ImageURLDeltaBlock { index, type, image_url }

References an image URL in the content of a message.

index: number

The index of the content part in the message.

type: "image_url"

Always image_url.

image_url?: ImageURLDelta { detail, url }
Message { id, assistant_id, attachments, 11 more }

Represents a message within a thread.

id: string

The identifier, which can be referenced in API endpoints.

assistant_id: string | null

If applicable, the ID of the assistant that authored this message.

attachments: Array<Attachment> | null

A list of files attached to the message, and the tools they were added to.

file_id?: string

The ID of the file to attach to the message.

tools?: Array<CodeInterpreterTool { type } | AssistantToolsFileSearchTypeOnly { type } >

The tools to add this file to.

One of the following:
CodeInterpreterTool { type }
type: "code_interpreter"

The type of tool being defined: code_interpreter

AssistantToolsFileSearchTypeOnly { type }
type: "file_search"

The type of tool being defined: file_search

completed_at: number | null

The Unix timestamp (in seconds) for when the message was completed.

formatunixtime
content: Array<unknown>

The content of the message in array of text and/or images.

created_at: number

The Unix timestamp (in seconds) for when the message was created.

formatunixtime
incomplete_at: number | null

The Unix timestamp (in seconds) for when the message was marked as incomplete.

formatunixtime
incomplete_details: IncompleteDetails | null

On an incomplete message, details about why the message is incomplete.

reason: "content_filter" | "max_tokens" | "run_cancelled" | 2 more

The reason the message is incomplete.

One of the following:
"content_filter"
"max_tokens"
"run_cancelled"
"run_expired"
"run_failed"
metadata: Metadata | null

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.

object: "thread.message"

The object type, which is always thread.message.

role: "user" | "assistant"

The entity that produced the message. One of user or assistant.

One of the following:
"user"
"assistant"
run_id: string | null

The ID of the run associated with the creation of this message. Value is null when messages are created manually using the create message or create thread endpoints.

status: "in_progress" | "incomplete" | "completed"

The status of the message, which can be either in_progress, incomplete, or completed.

One of the following:
"in_progress"
"incomplete"
"completed"
thread_id: string

The thread ID that this message belongs to.

MessageContent = unknown
MessageContentDelta = unknown
MessageContentPartParam = ImageFileContentBlock { image_file, type } | ImageURLContentBlock { image_url, type } | TextContentBlockParam { text, type }

References an image File in the content of a message.

One of the following:
ImageFileContentBlock { image_file, type }

References an image File in the content of a message.

image_file: ImageFile { file_id, detail }
type: "image_file"

Always image_file.

ImageURLContentBlock { image_url, type }

References an image URL in the content of a message.

image_url: ImageURL { url, detail }
type: "image_url"

The type of the content part.

TextContentBlockParam { text, type }

The text content that is part of a message.

text: string

Text content to be sent to the model

type: "text"

Always text.

MessageDeleted { id, deleted, object }
id: string
deleted: boolean
object: "thread.message.deleted"
MessageDelta { content, role }

The delta containing the fields that have changed on the Message.

content?: Array<unknown>

The content of the message in array of text and/or images.

role?: "user" | "assistant"

The entity that produced the message. One of user or assistant.

One of the following:
"user"
"assistant"
MessageDeltaEvent { id, delta, object }

Represents a message delta i.e. any changed fields on a message during streaming.

id: string

The identifier of the message, which can be referenced in API endpoints.

delta: MessageDelta { content, role }

The delta containing the fields that have changed on the Message.

object: "thread.message.delta"

The object type, which is always thread.message.delta.

RefusalContentBlock { refusal, type }

The refusal content generated by the assistant.

refusal: string
type: "refusal"

Always refusal.

RefusalDeltaBlock { index, type, refusal }

The refusal content that is part of a message.

index: number

The index of the refusal part in the message.

type: "refusal"

Always refusal.

refusal?: string
Text { annotations, value }
annotations: Array<unknown>
value: string

The data that makes up the text.

TextContentBlock { text, type }

The text content that is part of a message.

text: Text { annotations, value }
type: "text"

Always text.

TextContentBlockParam { text, type }

The text content that is part of a message.

text: string

Text content to be sent to the model

type: "text"

Always text.

TextDelta { annotations, value }
annotations?: Array<unknown>
value?: string

The data that makes up the text.

TextDeltaBlock { index, type, text }

The text content that is part of a message.

index: number

The index of the content part in the message.

type: "text"

Always text.

text?: TextDelta { annotations, value }

BetaResponses

Connect
client.beta.responses.connect(RequestOptionsoptions?): void
Function
Create a model response
client.beta.responses.create(ResponseCreateParamsparams, RequestOptionsoptions?): BetaResponse { id, created_at, error, 31 more } | Stream<BetaResponseStreamEvent>
POST/responses
Get a model response
client.beta.responses.retrieve(stringresponseID, ResponseRetrieveParamsparams?, RequestOptionsoptions?): BetaResponse { id, created_at, error, 31 more } | Stream<BetaResponseStreamEvent>
GET/responses/{response_id}
Delete a model response
client.beta.responses.delete(stringresponseID, ResponseDeleteParams { betas } params?, RequestOptionsoptions?): void
DELETE/responses/{response_id}
Cancel a response
client.beta.responses.cancel(stringresponseID, ResponseCancelParams { betas } params?, RequestOptionsoptions?): BetaResponse { id, created_at, error, 31 more }
POST/responses/{response_id}/cancel
Compact a response
client.beta.responses.compact(ResponseCompactParams { model, input, instructions, 6 more } params, RequestOptionsoptions?): BetaCompactedResponse { id, created_at, object, 2 more }
POST/responses/compact
ModelsExpand Collapse
BetaApplyPatchTool { type, allowed_callers }

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

type: "apply_patch"

The type of the tool. Always apply_patch.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
BetaCompactedResponse { id, created_at, object, 2 more }
id: string

The unique identifier for the compacted response.

created_at: number

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

formatunixtime
object: "response.compaction"

The object type. Always response.compaction.

output: Array<BetaResponseOutputItem>

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

One of the following:
BetaResponseOutputMessage { id, content, role, 4 more }

An output message from the model.

id: string

The unique ID of the output message.

content: Array<BetaResponseOutputText { annotations, text, type, logprobs } | BetaResponseOutputRefusal { refusal, type } >

The content of the output message.

One of the following:
BetaResponseOutputText { annotations, text, type, logprobs }

A text output from the model.

annotations: Array<FileCitation { file_id, filename, index, type } | URLCitation { end_index, start_index, title, 2 more } | ContainerFileCitation { container_id, end_index, file_id, 3 more } | FilePath { file_id, index, type } >

The annotations of the text output.

One of the following:
FileCitation { file_id, filename, index, type }

A citation to a file.

file_id: string

The ID of the file.

filename: string

The filename of the file cited.

index: number

The index of the file in the list of files.

type: "file_citation"

The type of the file citation. Always file_citation.

URLCitation { end_index, start_index, title, 2 more }

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

end_index: number

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

start_index: number

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

title: string

The title of the web resource.

type: "url_citation"

The type of the URL citation. Always url_citation.

url: string

The URL of the web resource.

formaturi
ContainerFileCitation { container_id, end_index, file_id, 3 more }

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

container_id: string

The ID of the container file.

end_index: number

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

file_id: string

The ID of the file.

filename: string

The filename of the container file cited.

start_index: number

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

type: "container_file_citation"

The type of the container file citation. Always container_file_citation.

FilePath { file_id, index, type }

A path to a file.

file_id: string

The ID of the file.

index: number

The index of the file in the list of files.

type: "file_path"

The type of the file path. Always file_path.

text: string

The text output from the model.

type: "output_text"

The type of the output text. Always output_text.

logprobs?: Array<Logprob>
token: string
bytes: Array<number>
logprob: number
top_logprobs: Array<TopLogprob>
token: string
bytes: Array<number>
logprob: number
BetaResponseOutputRefusal { refusal, type }

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: "in_progress" | "completed" | "incomplete"

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:
"in_progress"
"completed"
"incomplete"
type: "message"

The type of the output message. Always message.

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

phase?: "commentary" | null

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.

BetaResponseFileSearchToolCall { id, queries, status, 3 more }

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: Array<string>

The queries used to search for files.

status: "in_progress" | "searching" | "completed" | 2 more

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

One of the following:
"in_progress"
"searching"
"completed"
"incomplete"
"failed"
type: "file_search_call"

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

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

results?: Array<Result> | null

The results of the file search tool call.

attributes?: Record<string, string | number | boolean> | null

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
number
boolean
file_id?: string

The unique ID of the file.

filename?: string

The name of the file.

score?: number

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

formatfloat
text?: string

The text that was retrieved from the file.

BetaResponseFunctionToolCall { arguments, call_id, name, 6 more }

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.

call_id: string

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

name: string

The name of the function to run.

type: "function_call"

The type of the function tool call. Always function_call.

id?: string

The unique ID of the function tool call.

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

caller?: Direct { type } | Program { caller_id, type } | null

The execution context that produced this tool call.

One of the following:
Direct { type }
type: "direct"
Program { caller_id, type }
caller_id: string

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

type: "program"
namespace?: string

The namespace of the function to run.

status?: "in_progress" | "completed" | "incomplete"

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

One of the following:
"in_progress"
"completed"
"incomplete"
BetaResponseFunctionToolCallOutputItem { id, call_id, output, 5 more }
id: string

The unique ID of the function call tool output.

call_id: string

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

output: string | Array<BetaResponseInputText { text, type, prompt_cache_breakpoint } | BetaResponseInputImage { detail, type, file_id, 2 more } | BetaResponseInputFile { type, detail, file_data, 4 more } >

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
Array<BetaResponseInputText { text, type, prompt_cache_breakpoint } | BetaResponseInputImage { detail, type, file_id, 2 more } | BetaResponseInputFile { type, detail, file_data, 4 more } >
BetaResponseInputText { text, type, prompt_cache_breakpoint }

A text input to the model.

text: string

The text input to the model.

type: "input_text"

The type of the input item. Always input_text.

prompt_cache_breakpoint?: PromptCacheBreakpoint { mode }

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

mode: "explicit"

The breakpoint mode. Always explicit.

BetaResponseInputImage { detail, type, file_id, 2 more }

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

detail: "low" | "high" | "auto" | "original"

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:
"low"
"high"
"auto"
"original"
type: "input_image"

The type of the input item. Always input_image.

file_id?: string | null

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

image_url?: string | null

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

formaturi
prompt_cache_breakpoint?: PromptCacheBreakpoint { mode }

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

mode: "explicit"

The breakpoint mode. Always explicit.

BetaResponseInputFile { type, detail, file_data, 4 more }

A file input to the model.

type: "input_file"

The type of the input item. Always input_file.

detail?: "auto" | "low" | "high"

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

One of the following:
"auto"
"low"
"high"
file_data?: string

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

file_id?: string | null

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

file_url?: string

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

formaturi
filename?: string

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

prompt_cache_breakpoint?: PromptCacheBreakpoint { mode }

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

mode: "explicit"

The breakpoint mode. Always explicit.

status: "in_progress" | "completed" | "incomplete"

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

One of the following:
"in_progress"
"completed"
"incomplete"
type: "function_call_output"

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

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

caller?: Direct { type } | Program { caller_id, type } | null

The execution context that produced this tool call.

One of the following:
Direct { type }
type: "direct"

The caller type. Always direct.

Program { caller_id, type }
caller_id: string

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

maxLength64
minLength1
type: "program"

The caller type. Always program.

created_by?: string

The identifier of the actor that created the item.

AgentMessage { id, author, content, 3 more }
id: string

The unique ID of the agent message.

author: string

The sending agent identity.

content: Array<BetaResponseInputText { text, type, prompt_cache_breakpoint } | BetaResponseOutputText { annotations, text, type, logprobs } | Text { text, type } | 7 more>

Encrypted content sent between agents.

One of the following:
BetaResponseInputText { text, type, prompt_cache_breakpoint }

A text input to the model.

text: string

The text input to the model.

type: "input_text"

The type of the input item. Always input_text.

prompt_cache_breakpoint?: PromptCacheBreakpoint { mode }

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

mode: "explicit"

The breakpoint mode. Always explicit.

BetaResponseOutputText { annotations, text, type, logprobs }

A text output from the model.

annotations: Array<FileCitation { file_id, filename, index, type } | URLCitation { end_index, start_index, title, 2 more } | ContainerFileCitation { container_id, end_index, file_id, 3 more } | FilePath { file_id, index, type } >

The annotations of the text output.

One of the following:
FileCitation { file_id, filename, index, type }

A citation to a file.

file_id: string

The ID of the file.

filename: string

The filename of the file cited.

index: number

The index of the file in the list of files.

type: "file_citation"

The type of the file citation. Always file_citation.

URLCitation { end_index, start_index, title, 2 more }

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

end_index: number

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

start_index: number

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

title: string

The title of the web resource.

type: "url_citation"

The type of the URL citation. Always url_citation.

url: string

The URL of the web resource.

formaturi
ContainerFileCitation { container_id, end_index, file_id, 3 more }

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

container_id: string

The ID of the container file.

end_index: number

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

file_id: string

The ID of the file.

filename: string

The filename of the container file cited.

start_index: number

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

type: "container_file_citation"

The type of the container file citation. Always container_file_citation.

FilePath { file_id, index, type }

A path to a file.

file_id: string

The ID of the file.

index: number

The index of the file in the list of files.

type: "file_path"

The type of the file path. Always file_path.

text: string

The text output from the model.

type: "output_text"

The type of the output text. Always output_text.

logprobs?: Array<Logprob>
token: string
bytes: Array<number>
logprob: number
top_logprobs: Array<TopLogprob>
token: string
bytes: Array<number>
logprob: number
Text { text, type }

A text content.

text: string
type: "text"
SummaryText { text, type }

A summary text from the model.

text: string

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

type: "summary_text"

The type of the object. Always summary_text.

ReasoningText { text, type }

Reasoning text from the model.

text: string

The reasoning text from the model.

type: "reasoning_text"

The type of the reasoning text. Always reasoning_text.

BetaResponseOutputRefusal { refusal, type }

A refusal from the model.

refusal: string

The refusal explanation from the model.

type: "refusal"

The type of the refusal. Always refusal.

BetaResponseInputImage { detail, type, file_id, 2 more }

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

detail: "low" | "high" | "auto" | "original"

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:
"low"
"high"
"auto"
"original"
type: "input_image"

The type of the input item. Always input_image.

file_id?: string | null

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

image_url?: string | null

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

formaturi
prompt_cache_breakpoint?: PromptCacheBreakpoint { mode }

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

mode: "explicit"

The breakpoint mode. Always explicit.

ComputerScreenshot { detail, file_id, image_url, 2 more }

A screenshot of a computer.

detail: "low" | "high" | "auto" | "original"

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

One of the following:
"low"
"high"
"auto"
"original"
file_id: string | null

The identifier of an uploaded file that contains the screenshot.

image_url: string | null

The URL of the screenshot image.

formaturi
type: "computer_screenshot"

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

prompt_cache_breakpoint?: PromptCacheBreakpoint { mode }

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

mode: "explicit"

The breakpoint mode. Always explicit.

BetaResponseInputFile { type, detail, file_data, 4 more }

A file input to the model.

type: "input_file"

The type of the input item. Always input_file.

detail?: "auto" | "low" | "high"

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

One of the following:
"auto"
"low"
"high"
file_data?: string

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

file_id?: string | null

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

file_url?: string

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

formaturi
filename?: string

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

prompt_cache_breakpoint?: PromptCacheBreakpoint { mode }

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

mode: "explicit"

The breakpoint mode. Always explicit.

EncryptedContent { encrypted_content, type }

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

encrypted_content: string

Opaque encrypted content.

type: "encrypted_content"

The type of the input item. Always encrypted_content.

recipient: string

The destination agent identity.

type: "agent_message"

The type of the item. Always agent_message.

agent?: Agent { agent_name }

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

MultiAgentCall { id, action, arguments, 3 more }
id: string

The unique ID of the multi-agent call item.

action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more

The multi-agent action to execute.

One of the following:
"spawn_agent"
"interrupt_agent"
"list_agents"
"send_message"
"followup_task"
"wait_agent"
arguments: string

The JSON string of arguments generated for the action.

call_id: string

The unique ID linking this call to its output.

type: "multi_agent_call"

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

agent?: Agent { agent_name }

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

MultiAgentCallOutput { id, action, call_id, 3 more }
id: string

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

action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more

The multi-agent action that produced this result.

One of the following:
"spawn_agent"
"interrupt_agent"
"list_agents"
"send_message"
"followup_task"
"wait_agent"
call_id: string

The unique ID of the multi-agent call.

output: Array<BetaResponseOutputText { annotations, text, type, logprobs } >

Text output returned by the multi-agent action.

annotations: Array<FileCitation { file_id, filename, index, type } | URLCitation { end_index, start_index, title, 2 more } | ContainerFileCitation { container_id, end_index, file_id, 3 more } | FilePath { file_id, index, type } >

The annotations of the text output.

One of the following:
FileCitation { file_id, filename, index, type }

A citation to a file.

file_id: string

The ID of the file.

filename: string

The filename of the file cited.

index: number

The index of the file in the list of files.

type: "file_citation"

The type of the file citation. Always file_citation.

URLCitation { end_index, start_index, title, 2 more }

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

end_index: number

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

start_index: number

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

title: string

The title of the web resource.

type: "url_citation"

The type of the URL citation. Always url_citation.

url: string

The URL of the web resource.

formaturi
ContainerFileCitation { container_id, end_index, file_id, 3 more }

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

container_id: string

The ID of the container file.

end_index: number

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

file_id: string

The ID of the file.

filename: string

The filename of the container file cited.

start_index: number

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

type: "container_file_citation"

The type of the container file citation. Always container_file_citation.

FilePath { file_id, index, type }

A path to a file.

file_id: string

The ID of the file.

index: number

The index of the file in the list of files.

type: "file_path"

The type of the file path. Always file_path.

text: string

The text output from the model.

type: "output_text"

The type of the output text. Always output_text.

logprobs?: Array<Logprob>
token: string
bytes: Array<number>
logprob: number
top_logprobs: Array<TopLogprob>
token: string
bytes: Array<number>
logprob: number
type: "multi_agent_call_output"

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

agent?: Agent { agent_name }

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

One of the following:
One of the following:
BetaResponseComputerToolCall { id, call_id, pending_safety_checks, 5 more }

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.

call_id: string

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

pending_safety_checks: Array<PendingSafetyCheck>

The pending safety checks for the computer call.

id: string

The ID of the pending safety check.

code?: string | null

The type of the pending safety check.

message?: string | null

Details about the pending safety check.

status: "in_progress" | "completed" | "incomplete"

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

One of the following:
"in_progress"
"completed"
"incomplete"
type: "computer_call"

The type of the computer call. Always computer_call.

A click action.

actions?: BetaComputerActionList { , , , 6 more }

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

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

BetaResponseComputerToolCallOutputItem { id, call_id, output, 5 more }
id: string

The unique ID of the computer call tool output.

call_id: string

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

output: BetaResponseComputerToolCallOutputScreenshot { type, file_id, image_url }

A computer screenshot image used with the computer use tool.

status: "completed" | "incomplete" | "failed" | "in_progress"

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:
"completed"
"incomplete"
"failed"
"in_progress"
type: "computer_call_output"

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

acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck>

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

id: string

The ID of the pending safety check.

code?: string | null

The type of the pending safety check.

message?: string | null

Details about the pending safety check.

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

created_by?: string

The identifier of the actor that created the item.

BetaResponseReasoningItem { id, summary, type, 4 more }

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: Array<Summary>

Reasoning summary content.

text: string

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

type: "summary_text"

The type of the object. Always summary_text.

type: "reasoning"

The type of the object. Always reasoning.

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

content?: Array<Content>

Reasoning text content.

text: string

The reasoning text from the model.

type: "reasoning_text"

The type of the reasoning text. Always reasoning_text.

encrypted_content?: string | null

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

status?: "in_progress" | "completed" | "incomplete"

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

One of the following:
"in_progress"
"completed"
"incomplete"
Program { id, call_id, code, 3 more }
id: string

The unique ID of the program item.

call_id: string

The stable call ID of the program item.

code: string

The JavaScript source executed by programmatic tool calling.

fingerprint: string

Opaque program replay fingerprint that must be round-tripped.

type: "program"

The type of the item. Always program.

agent?: Agent { agent_name }

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

ProgramOutput { id, call_id, result, 3 more }
id: string

The unique ID of the program output item.

call_id: string

The call ID of the program item.

result: string

The result produced by the program item.

status: "completed" | "incomplete"

The terminal status of the program output item.

One of the following:
"completed"
"incomplete"
type: "program_output"

The type of the item. Always program_output.

agent?: Agent { agent_name }

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

BetaResponseToolSearchCall { id, arguments, call_id, 5 more }
id: string

The unique ID of the tool search call item.

arguments: unknown

Arguments used for the tool search call.

call_id: string | null

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

execution: "server" | "client"

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

One of the following:
"server"
"client"
status: "in_progress" | "completed" | "incomplete"

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

One of the following:
"in_progress"
"completed"
"incomplete"
type: "tool_search_call"

The type of the item. Always tool_search_call.

agent?: Agent { agent_name }

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

created_by?: string

The identifier of the actor that created the item.

BetaResponseToolSearchOutputItem { id, call_id, execution, 5 more }
id: string

The unique ID of the tool search output item.

call_id: string | null

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

execution: "server" | "client"

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

One of the following:
"server"
"client"
status: "in_progress" | "completed" | "incomplete"

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

One of the following:
"in_progress"
"completed"
"incomplete"
tools: Array<BetaTool>

The loaded tool definitions returned by tool search.

One of the following:
BetaFunctionTool { name, parameters, strict, 5 more }

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: Record<string, unknown> | null

A JSON schema object describing the parameters of the function.

strict: boolean | null

Whether strict parameter validation is enforced for this function tool.

type: "function"

The type of the function tool. Always function.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
defer_loading?: boolean

Whether this function is deferred and loaded via tool search.

description?: string | null

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

output_schema?: Record<string, unknown> | null

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

BetaFileSearchTool { type, vector_store_ids, filters, 2 more }

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

type: "file_search"

The type of the file search tool. Always file_search.

vector_store_ids: Array<string>

The IDs of the vector stores to search.

filters?: ComparisonFilter { key, type, value } | CompoundFilter { filters, type } | null

A filter to apply.

One of the following:
ComparisonFilter { key, type, value }

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: "eq" | "ne" | "gt" | 5 more

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:
"eq"
"ne"
"gt"
"gte"
"lt"
"lte"
"in"
"nin"
value: string | number | boolean | Array<unknown>

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

One of the following:
string
number
boolean
Array<unknown>
CompoundFilter { filters, type }

Combine multiple filters using and or or.

filters: Array<ComparisonFilter { key, type, value } | unknown>

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

One of the following:
ComparisonFilter { key, type, value }

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: "eq" | "ne" | "gt" | 5 more

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:
"eq"
"ne"
"gt"
"gte"
"lt"
"lte"
"in"
"nin"
value: string | number | boolean | Array<unknown>

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

One of the following:
string
number
boolean
Array<unknown>
unknown
type: "and" | "or"

Type of operation: and or or.

One of the following:
"and"
"or"
max_num_results?: number

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

ranking_options?: RankingOptions { hybrid_search, ranker, score_threshold }

Ranking options for search.

ranker?: "auto" | "default-2024-11-15"

The ranker to use for the file search.

One of the following:
"auto"
"default-2024-11-15"
score_threshold?: number

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.

BetaComputerTool { type }

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

type: "computer"

The type of the computer tool. Always computer.

BetaComputerUsePreviewTool { display_height, display_width, environment, type }

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

display_height: number

The height of the computer display.

display_width: number

The width of the computer display.

environment: "windows" | "mac" | "linux" | 2 more

The type of computer environment to control.

One of the following:
"windows"
"mac"
"linux"
"ubuntu"
"browser"
type: "computer_use_preview"

The type of the computer use tool. Always computer_use_preview.

BetaWebSearchTool { type, filters, search_context_size, user_location }

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

type: "web_search" | "web_search_2025_08_26"

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

One of the following:
"web_search"
"web_search_2025_08_26"
filters?: Filters | null

Filters for the search.

allowed_domains?: Array<string> | null

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"]

search_context_size?: "low" | "medium" | "high"

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:
"low"
"medium"
"high"
user_location?: UserLocation | null

The approximate location of the user.

city?: string | null

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

country?: string | null

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

region?: string | null

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

timezone?: string | null

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

type?: "approximate"

The type of location approximation. Always approximate.

Mcp { server_label, type, allowed_callers, 9 more }

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

server_label: string

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

type: "mcp"

The type of the MCP tool. Always mcp.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
allowed_tools?: Array<string> | McpToolFilter { read_only, tool_names } | null

List of allowed tool names or a filter object.

One of the following:
Array<string>
McpToolFilter { read_only, tool_names }

A filter object to specify which tools are allowed.

read_only?: boolean

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.

tool_names?: Array<string>

List of allowed tool names.

authorization?: string

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.

connector_id?: "connector_dropbox" | "connector_gmail" | "connector_googlecalendar" | 5 more

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

Currently supported connector_id values are:

  • Dropbox: connector_dropbox
  • Gmail: connector_gmail
  • Google Calendar: connector_googlecalendar
  • Google Drive: connector_googledrive
  • Microsoft Teams: connector_microsoftteams
  • Outlook Calendar: connector_outlookcalendar
  • Outlook Email: connector_outlookemail
  • SharePoint: connector_sharepoint
One of the following:
"connector_dropbox"
"connector_gmail"
"connector_googlecalendar"
"connector_googledrive"
"connector_microsoftteams"
"connector_outlookcalendar"
"connector_outlookemail"
"connector_sharepoint"
defer_loading?: boolean

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

headers?: Record<string, string> | null

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

require_approval?: McpToolApprovalFilter { always, never } | "always" | "never" | null

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

One of the following:
McpToolApprovalFilter { always, never }

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?: Always { read_only, tool_names }

A filter object to specify which tools are allowed.

read_only?: boolean

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.

tool_names?: Array<string>

List of allowed tool names.

never?: Never { read_only, tool_names }

A filter object to specify which tools are allowed.

read_only?: boolean

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.

tool_names?: Array<string>

List of allowed tool names.

"always" | "never"
"always"
"never"
server_description?: string

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

server_url?: string

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

formaturi
tunnel_id?: string

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

CodeInterpreter { container, type, allowed_callers }

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

container: string | CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }

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
CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }

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

type: "auto"

Always auto.

file_ids?: Array<string>

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

memory_limit?: "1g" | "4g" | "16g" | "64g" | null

The memory limit for the code interpreter container.

One of the following:
"1g"
"4g"
"16g"
"64g"
network_policy?: BetaContainerNetworkPolicyDisabled { type } | BetaContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }

Network access policy for the container.

One of the following:
BetaContainerNetworkPolicyDisabled { type }
type: "disabled"

Disable outbound network access. Always disabled.

BetaContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
allowed_domains: Array<string>

A list of allowed domains when type is allowlist.

type: "allowlist"

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

domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret { domain, name, value } >

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: "code_interpreter"

The type of the code interpreter tool. Always code_interpreter.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
ProgrammaticToolCalling { type }
type: "programmatic_tool_calling"

The type of the tool. Always programmatic_tool_calling.

ImageGeneration { type, action, background, 9 more }

A tool that generates images using the GPT image models.

type: "image_generation"

The type of the image generation tool. Always image_generation.

action?: "generate" | "edit" | "auto"

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

One of the following:
"generate"
"edit"
"auto"
background?: "transparent" | "opaque" | "auto"

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

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

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

One of the following:
"transparent"
"opaque"
"auto"
input_fidelity?: "high" | "low" | null

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:
"high"
"low"
input_image_mask?: InputImageMask { file_id, image_url }

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

file_id?: string

File ID for the mask image.

image_url?: string

Base64-encoded mask image.

model?: (string & {}) | "gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 3 more

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

One of the following:
(string & {})
"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 3 more
"gpt-image-1"
"gpt-image-1-mini"
"gpt-image-2"
"gpt-image-2-2026-04-21"
"gpt-image-1.5"
"chatgpt-image-latest"
moderation?: "auto" | "low"

Moderation level for the generated image. Default: auto.

One of the following:
"auto"
"low"
output_compression?: number

Compression level for the output image. Default: 100.

minimum0
maximum100
output_format?: "png" | "webp" | "jpeg"

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

One of the following:
"png"
"webp"
"jpeg"
partial_images?: number

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

minimum0
maximum3
quality?: "low" | "medium" | "high" | "auto"

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

One of the following:
"low"
"medium"
"high"
"auto"
size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"

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

One of the following:
(string & {})
"1024x1024" | "1024x1536" | "1536x1024" | "auto"
"1024x1024"
"1024x1536"
"1536x1024"
"auto"
LocalShell { type }

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

type: "local_shell"

The type of the local shell tool. Always local_shell.

BetaFunctionShellTool { type, allowed_callers, environment }

A tool that allows the model to execute shell commands.

type: "shell"

The type of the shell tool. Always shell.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
environment?: BetaContainerAuto { type, file_ids, memory_limit, 2 more } | BetaLocalEnvironment { type, skills } | BetaContainerReference { container_id, type } | null
One of the following:
BetaContainerAuto { type, file_ids, memory_limit, 2 more }
type: "container_auto"

Automatically creates a container for this request

file_ids?: Array<string>

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

memory_limit?: "1g" | "4g" | "16g" | "64g" | null

The memory limit for the container.

One of the following:
"1g"
"4g"
"16g"
"64g"
network_policy?: BetaContainerNetworkPolicyDisabled { type } | BetaContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }

Network access policy for the container.

One of the following:
BetaContainerNetworkPolicyDisabled { type }
type: "disabled"

Disable outbound network access. Always disabled.

BetaContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
allowed_domains: Array<string>

A list of allowed domains when type is allowlist.

type: "allowlist"

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

domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret { domain, name, value } >

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?: Array<BetaSkillReference { skill_id, type, version } | BetaInlineSkill { description, name, source, type } >

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

One of the following:
BetaSkillReference { skill_id, type, version }
skill_id: string

The ID of the referenced skill.

maxLength64
minLength1
type: "skill_reference"

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

version?: string

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

BetaInlineSkill { description, name, source, type }
description: string

The description of the skill.

name: string

The name of the skill.

source: BetaInlineSkillSource { data, media_type, type }

Inline skill payload

type: "inline"

Defines an inline skill for this request.

BetaLocalEnvironment { type, skills }
type: "local"

Use a local computer environment.

skills?: Array<BetaLocalSkill { description, name, path } >

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.

BetaContainerReference { container_id, type }
container_id: string

The ID of the referenced container.

type: "container_reference"

References a container created with the /v1/containers endpoint

BetaCustomTool { name, type, allowed_callers, 3 more }

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.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
defer_loading?: boolean

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

description?: string

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

format?: Text { type } | Grammar { definition, syntax, type }

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

One of the following:
Text { type }

Unconstrained free-form text.

type: "text"

Unconstrained text format. Always text.

Grammar { definition, syntax, type }

A grammar defined by the user.

definition: string

The grammar definition.

syntax: "lark" | "regex"

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

One of the following:
"lark"
"regex"
type: "grammar"

Grammar format. Always grammar.

BetaNamespaceTool { description, name, tools, type }

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: Array<Function { name, type, allowed_callers, 5 more } | BetaCustomTool { name, type, allowed_callers, 3 more } >

The function/custom tools available inside this namespace.

One of the following:
Function { name, type, allowed_callers, 5 more }
name: string
maxLength128
minLength1
type: "function"
allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
defer_loading?: boolean

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

description?: string | null
output_schema?: Record<string, unknown> | null

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

parameters?: unknown
strict?: boolean | null

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

BetaCustomTool { name, type, allowed_callers, 3 more }

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.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
defer_loading?: boolean

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

description?: string

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

format?: Text { type } | Grammar { definition, syntax, type }

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

One of the following:
Text { type }

Unconstrained free-form text.

type: "text"

Unconstrained text format. Always text.

Grammar { definition, syntax, type }

A grammar defined by the user.

definition: string

The grammar definition.

syntax: "lark" | "regex"

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

One of the following:
"lark"
"regex"
type: "grammar"

Grammar format. Always grammar.

type: "namespace"

The type of the tool. Always namespace.

BetaToolSearchTool { type, description, execution, parameters }

Hosted or BYOT tool search configuration for deferred tools.

type: "tool_search"

The type of the tool. Always tool_search.

description?: string | null

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

execution?: "server" | "client"

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

One of the following:
"server"
"client"
parameters?: unknown

Parameter schema for a client-executed tool search tool.

BetaWebSearchPreviewTool { type, search_content_types, search_context_size, user_location }

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

type: "web_search_preview" | "web_search_preview_2025_03_11"

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

One of the following:
"web_search_preview"
"web_search_preview_2025_03_11"
search_content_types?: Array<"text" | "image">
One of the following:
"text"
"image"
search_context_size?: "low" | "medium" | "high"

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:
"low"
"medium"
"high"
user_location?: UserLocation | null

The user’s location.

type: "approximate"

The type of location approximation. Always approximate.

city?: string | null

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

country?: string | null

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

region?: string | null

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

timezone?: string | null

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

BetaApplyPatchTool { type, allowed_callers }

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

type: "apply_patch"

The type of the tool. Always apply_patch.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
type: "tool_search_output"

The type of the item. Always tool_search_output.

agent?: Agent { agent_name }

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

created_by?: string

The identifier of the actor that created the item.

AdditionalTools { id, role, tools, 2 more }
id: string

The unique ID of the additional tools item.

role: "unknown" | "user" | "assistant" | 5 more

The role that provided the additional tools.

One of the following:
"unknown"
"user"
"assistant"
"system"
"critic"
"discriminator"
"developer"
"tool"
tools: Array<BetaTool>

The additional tool definitions made available at this item.

One of the following:
BetaFunctionTool { name, parameters, strict, 5 more }

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: Record<string, unknown> | null

A JSON schema object describing the parameters of the function.

strict: boolean | null

Whether strict parameter validation is enforced for this function tool.

type: "function"

The type of the function tool. Always function.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
defer_loading?: boolean

Whether this function is deferred and loaded via tool search.

description?: string | null

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

output_schema?: Record<string, unknown> | null

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

BetaFileSearchTool { type, vector_store_ids, filters, 2 more }

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

type: "file_search"

The type of the file search tool. Always file_search.

vector_store_ids: Array<string>

The IDs of the vector stores to search.

filters?: ComparisonFilter { key, type, value } | CompoundFilter { filters, type } | null

A filter to apply.

One of the following:
ComparisonFilter { key, type, value }

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: "eq" | "ne" | "gt" | 5 more

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:
"eq"
"ne"
"gt"
"gte"
"lt"
"lte"
"in"
"nin"
value: string | number | boolean | Array<unknown>

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

One of the following:
string
number
boolean
Array<unknown>
CompoundFilter { filters, type }

Combine multiple filters using and or or.

filters: Array<ComparisonFilter { key, type, value } | unknown>

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

One of the following:
ComparisonFilter { key, type, value }

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: "eq" | "ne" | "gt" | 5 more

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:
"eq"
"ne"
"gt"
"gte"
"lt"
"lte"
"in"
"nin"
value: string | number | boolean | Array<unknown>

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

One of the following:
string
number
boolean
Array<unknown>
unknown
type: "and" | "or"

Type of operation: and or or.

One of the following:
"and"
"or"
max_num_results?: number

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

ranking_options?: RankingOptions { hybrid_search, ranker, score_threshold }

Ranking options for search.

ranker?: "auto" | "default-2024-11-15"

The ranker to use for the file search.

One of the following:
"auto"
"default-2024-11-15"
score_threshold?: number

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.

BetaComputerTool { type }

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

type: "computer"

The type of the computer tool. Always computer.

BetaComputerUsePreviewTool { display_height, display_width, environment, type }

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

display_height: number

The height of the computer display.

display_width: number

The width of the computer display.

environment: "windows" | "mac" | "linux" | 2 more

The type of computer environment to control.

One of the following:
"windows"
"mac"
"linux"
"ubuntu"
"browser"
type: "computer_use_preview"

The type of the computer use tool. Always computer_use_preview.

BetaWebSearchTool { type, filters, search_context_size, user_location }

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

type: "web_search" | "web_search_2025_08_26"

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

One of the following:
"web_search"
"web_search_2025_08_26"
filters?: Filters | null

Filters for the search.

allowed_domains?: Array<string> | null

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"]

search_context_size?: "low" | "medium" | "high"

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:
"low"
"medium"
"high"
user_location?: UserLocation | null

The approximate location of the user.

city?: string | null

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

country?: string | null

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

region?: string | null

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

timezone?: string | null

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

type?: "approximate"

The type of location approximation. Always approximate.

Mcp { server_label, type, allowed_callers, 9 more }

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

server_label: string

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

type: "mcp"

The type of the MCP tool. Always mcp.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
allowed_tools?: Array<string> | McpToolFilter { read_only, tool_names } | null

List of allowed tool names or a filter object.

One of the following:
Array<string>
McpToolFilter { read_only, tool_names }

A filter object to specify which tools are allowed.

read_only?: boolean

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.

tool_names?: Array<string>

List of allowed tool names.

authorization?: string

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.

connector_id?: "connector_dropbox" | "connector_gmail" | "connector_googlecalendar" | 5 more

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

Currently supported connector_id values are:

  • Dropbox: connector_dropbox
  • Gmail: connector_gmail
  • Google Calendar: connector_googlecalendar
  • Google Drive: connector_googledrive
  • Microsoft Teams: connector_microsoftteams
  • Outlook Calendar: connector_outlookcalendar
  • Outlook Email: connector_outlookemail
  • SharePoint: connector_sharepoint
One of the following:
"connector_dropbox"
"connector_gmail"
"connector_googlecalendar"
"connector_googledrive"
"connector_microsoftteams"
"connector_outlookcalendar"
"connector_outlookemail"
"connector_sharepoint"
defer_loading?: boolean

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

headers?: Record<string, string> | null

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

require_approval?: McpToolApprovalFilter { always, never } | "always" | "never" | null

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

One of the following:
McpToolApprovalFilter { always, never }

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?: Always { read_only, tool_names }

A filter object to specify which tools are allowed.

read_only?: boolean

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.

tool_names?: Array<string>

List of allowed tool names.

never?: Never { read_only, tool_names }

A filter object to specify which tools are allowed.

read_only?: boolean

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.

tool_names?: Array<string>

List of allowed tool names.

"always" | "never"
"always"
"never"
server_description?: string

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

server_url?: string

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

formaturi
tunnel_id?: string

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

CodeInterpreter { container, type, allowed_callers }

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

container: string | CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }

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
CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }

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

type: "auto"

Always auto.

file_ids?: Array<string>

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

memory_limit?: "1g" | "4g" | "16g" | "64g" | null

The memory limit for the code interpreter container.

One of the following:
"1g"
"4g"
"16g"
"64g"
network_policy?: BetaContainerNetworkPolicyDisabled { type } | BetaContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }

Network access policy for the container.

One of the following:
BetaContainerNetworkPolicyDisabled { type }
type: "disabled"

Disable outbound network access. Always disabled.

BetaContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
allowed_domains: Array<string>

A list of allowed domains when type is allowlist.

type: "allowlist"

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

domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret { domain, name, value } >

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: "code_interpreter"

The type of the code interpreter tool. Always code_interpreter.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
ProgrammaticToolCalling { type }
type: "programmatic_tool_calling"

The type of the tool. Always programmatic_tool_calling.

ImageGeneration { type, action, background, 9 more }

A tool that generates images using the GPT image models.

type: "image_generation"

The type of the image generation tool. Always image_generation.

action?: "generate" | "edit" | "auto"

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

One of the following:
"generate"
"edit"
"auto"
background?: "transparent" | "opaque" | "auto"

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

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

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

One of the following:
"transparent"
"opaque"
"auto"
input_fidelity?: "high" | "low" | null

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:
"high"
"low"
input_image_mask?: InputImageMask { file_id, image_url }

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

file_id?: string

File ID for the mask image.

image_url?: string

Base64-encoded mask image.

model?: (string & {}) | "gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 3 more

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

One of the following:
(string & {})
"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 3 more
"gpt-image-1"
"gpt-image-1-mini"
"gpt-image-2"
"gpt-image-2-2026-04-21"
"gpt-image-1.5"
"chatgpt-image-latest"
moderation?: "auto" | "low"

Moderation level for the generated image. Default: auto.

One of the following:
"auto"
"low"
output_compression?: number

Compression level for the output image. Default: 100.

minimum0
maximum100
output_format?: "png" | "webp" | "jpeg"

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

One of the following:
"png"
"webp"
"jpeg"
partial_images?: number

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

minimum0
maximum3
quality?: "low" | "medium" | "high" | "auto"

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

One of the following:
"low"
"medium"
"high"
"auto"
size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"

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

One of the following:
(string & {})
"1024x1024" | "1024x1536" | "1536x1024" | "auto"
"1024x1024"
"1024x1536"
"1536x1024"
"auto"
LocalShell { type }

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

type: "local_shell"

The type of the local shell tool. Always local_shell.

BetaFunctionShellTool { type, allowed_callers, environment }

A tool that allows the model to execute shell commands.

type: "shell"

The type of the shell tool. Always shell.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
environment?: BetaContainerAuto { type, file_ids, memory_limit, 2 more } | BetaLocalEnvironment { type, skills } | BetaContainerReference { container_id, type } | null
One of the following:
BetaContainerAuto { type, file_ids, memory_limit, 2 more }
type: "container_auto"

Automatically creates a container for this request

file_ids?: Array<string>

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

memory_limit?: "1g" | "4g" | "16g" | "64g" | null

The memory limit for the container.

One of the following:
"1g"
"4g"
"16g"
"64g"
network_policy?: BetaContainerNetworkPolicyDisabled { type } | BetaContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }

Network access policy for the container.

One of the following:
BetaContainerNetworkPolicyDisabled { type }
type: "disabled"

Disable outbound network access. Always disabled.

BetaContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
allowed_domains: Array<string>

A list of allowed domains when type is allowlist.

type: "allowlist"

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

domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret { domain, name, value } >

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?: Array<BetaSkillReference { skill_id, type, version } | BetaInlineSkill { description, name, source, type } >

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

One of the following:
BetaSkillReference { skill_id, type, version }
skill_id: string

The ID of the referenced skill.

maxLength64
minLength1
type: "skill_reference"

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

version?: string

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

BetaInlineSkill { description, name, source, type }
description: string

The description of the skill.

name: string

The name of the skill.

source: BetaInlineSkillSource { data, media_type, type }

Inline skill payload

type: "inline"

Defines an inline skill for this request.

BetaLocalEnvironment { type, skills }
type: "local"

Use a local computer environment.

skills?: Array<BetaLocalSkill { description, name, path } >

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.

BetaContainerReference { container_id, type }
container_id: string

The ID of the referenced container.

type: "container_reference"

References a container created with the /v1/containers endpoint

BetaCustomTool { name, type, allowed_callers, 3 more }

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.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
defer_loading?: boolean

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

description?: string

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

format?: Text { type } | Grammar { definition, syntax, type }

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

One of the following:
Text { type }

Unconstrained free-form text.

type: "text"

Unconstrained text format. Always text.

Grammar { definition, syntax, type }

A grammar defined by the user.

definition: string

The grammar definition.

syntax: "lark" | "regex"

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

One of the following:
"lark"
"regex"
type: "grammar"

Grammar format. Always grammar.

BetaNamespaceTool { description, name, tools, type }

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: Array<Function { name, type, allowed_callers, 5 more } | BetaCustomTool { name, type, allowed_callers, 3 more } >

The function/custom tools available inside this namespace.

One of the following:
Function { name, type, allowed_callers, 5 more }
name: string
maxLength128
minLength1
type: "function"
allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
defer_loading?: boolean

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

description?: string | null
output_schema?: Record<string, unknown> | null

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

parameters?: unknown
strict?: boolean | null

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

BetaCustomTool { name, type, allowed_callers, 3 more }

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.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
defer_loading?: boolean

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

description?: string

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

format?: Text { type } | Grammar { definition, syntax, type }

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

One of the following:
Text { type }

Unconstrained free-form text.

type: "text"

Unconstrained text format. Always text.

Grammar { definition, syntax, type }

A grammar defined by the user.

definition: string

The grammar definition.

syntax: "lark" | "regex"

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

One of the following:
"lark"
"regex"
type: "grammar"

Grammar format. Always grammar.

type: "namespace"

The type of the tool. Always namespace.

BetaToolSearchTool { type, description, execution, parameters }

Hosted or BYOT tool search configuration for deferred tools.

type: "tool_search"

The type of the tool. Always tool_search.

description?: string | null

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

execution?: "server" | "client"

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

One of the following:
"server"
"client"
parameters?: unknown

Parameter schema for a client-executed tool search tool.

BetaWebSearchPreviewTool { type, search_content_types, search_context_size, user_location }

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

type: "web_search_preview" | "web_search_preview_2025_03_11"

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

One of the following:
"web_search_preview"
"web_search_preview_2025_03_11"
search_content_types?: Array<"text" | "image">
One of the following:
"text"
"image"
search_context_size?: "low" | "medium" | "high"

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:
"low"
"medium"
"high"
user_location?: UserLocation | null

The user’s location.

type: "approximate"

The type of location approximation. Always approximate.

city?: string | null

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

country?: string | null

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

region?: string | null

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

timezone?: string | null

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

BetaApplyPatchTool { type, allowed_callers }

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

type: "apply_patch"

The type of the tool. Always apply_patch.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
type: "additional_tools"

The type of the item. Always additional_tools.

agent?: Agent { agent_name }

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

BetaResponseCompactionItem { id, encrypted_content, type, 2 more }

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

id: string

The unique ID of the compaction item.

encrypted_content: string

The encrypted content that was produced by compaction.

type: "compaction"

The type of the item. Always compaction.

agent?: Agent { agent_name }

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

created_by?: string

The identifier of the actor that created the item.

ImageGenerationCall { id, result, status, 2 more }

An image generation request made by the model.

id: string

The unique ID of the image generation call.

result: string | null

The generated image encoded in base64.

status: "in_progress" | "completed" | "generating" | "failed"

The status of the image generation call.

One of the following:
"in_progress"
"completed"
"generating"
"failed"
type: "image_generation_call"

The type of the image generation call. Always image_generation_call.

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

BetaResponseCodeInterpreterToolCall { id, code, container_id, 4 more }

A tool call to run code.

id: string

The unique ID of the code interpreter tool call.

code: string | null

The code to run, or null if not available.

container_id: string

The ID of the container used to run the code.

outputs: Array<Logs { logs, type } | Image { type, url } > | null

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

One of the following:
Logs { logs, type }

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.

Image { type, url }

The image output from the code interpreter.

type: "image"

The type of the output. Always image.

url: string

The URL of the image output from the code interpreter.

formaturi
status: "in_progress" | "completed" | "incomplete" | 2 more

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

One of the following:
"in_progress"
"completed"
"incomplete"
"interpreting"
"failed"
type: "code_interpreter_call"

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

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

LocalShellCall { id, action, call_id, 3 more }

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

id: string

The unique ID of the local shell call.

action: Action { command, env, type, 3 more }

Execute a shell command on the server.

command: Array<string>

The command to run.

env: Record<string, string>

Environment variables to set for the command.

type: "exec"

The type of the local shell action. Always exec.

timeout_ms?: number | null

Optional timeout in milliseconds for the command.

user?: string | null

Optional user to run the command as.

working_directory?: string | null

Optional working directory to run the command in.

call_id: string

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

status: "in_progress" | "completed" | "incomplete"

The status of the local shell call.

One of the following:
"in_progress"
"completed"
"incomplete"
type: "local_shell_call"

The type of the local shell call. Always local_shell_call.

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

LocalShellCallOutput { id, output, type, 2 more }

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: "local_shell_call_output"

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

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

status?: "in_progress" | "completed" | "incomplete" | null

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

One of the following:
"in_progress"
"completed"
"incomplete"
BetaResponseFunctionShellToolCall { id, action, call_id, 6 more }

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: Action { commands, max_output_length, timeout_ms }

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

commands: Array<string>
max_output_length: number | null

Optional maximum number of characters to return from each command.

timeout_ms: number | null

Optional timeout in milliseconds for the commands.

call_id: string

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

environment: BetaResponseLocalEnvironment { type } | BetaResponseContainerReference { container_id, type } | null

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

One of the following:
BetaResponseLocalEnvironment { type }

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

type: "local"

The environment type. Always local.

BetaResponseContainerReference { container_id, type }

Represents a container created with /v1/containers.

container_id: string
type: "container_reference"

The environment type. Always container_reference.

status: "in_progress" | "completed" | "incomplete"

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

One of the following:
"in_progress"
"completed"
"incomplete"
type: "shell_call"

The type of the item. Always shell_call.

agent?: Agent { agent_name }

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

caller?: Direct { type } | Program { caller_id, type } | null

The execution context that produced this tool call.

One of the following:
Direct { type }
type: "direct"
Program { caller_id, type }
caller_id: string

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

type: "program"
created_by?: string

The ID of the entity that created this tool call.

BetaResponseFunctionShellToolCallOutput { id, call_id, max_output_length, 6 more }

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.

call_id: string

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

max_output_length: number | null

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

output: Array<Output>

An array of shell call output contents

outcome: Timeout { type } | Exit { exit_code, type }

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

One of the following:
Timeout { type }

Indicates that the shell call exceeded its configured time limit.

type: "timeout"

The outcome type. Always timeout.

Exit { exit_code, type }

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

exit_code: number

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.

created_by?: string

The identifier of the actor that created the item.

status: "in_progress" | "completed" | "incomplete"

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

One of the following:
"in_progress"
"completed"
"incomplete"
type: "shell_call_output"

The type of the shell call output. Always shell_call_output.

agent?: Agent { agent_name }

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

caller?: Direct { type } | Program { caller_id, type } | null

The execution context that produced this tool call.

One of the following:
Direct { type }
type: "direct"
Program { caller_id, type }
caller_id: string

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

type: "program"
created_by?: string

The identifier of the actor that created the item.

BetaResponseApplyPatchToolCall { id, call_id, operation, 5 more }

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.

call_id: string

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

operation: CreateFile { diff, path, type } | DeleteFile { path, type } | UpdateFile { diff, path, type }

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

One of the following:
CreateFile { diff, path, type }

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: "create_file"

Create a new file with the provided diff.

DeleteFile { path, type }

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

path: string

Path of the file to delete.

type: "delete_file"

Delete the specified file.

UpdateFile { diff, path, type }

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: "update_file"

Update an existing file with the provided diff.

status: "in_progress" | "completed"

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

One of the following:
"in_progress"
"completed"
type: "apply_patch_call"

The type of the item. Always apply_patch_call.

agent?: Agent { agent_name }

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

caller?: Direct { type } | Program { caller_id, type } | null

The execution context that produced this tool call.

One of the following:
Direct { type }
type: "direct"
Program { caller_id, type }
caller_id: string

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

type: "program"
created_by?: string

The ID of the entity that created this tool call.

BetaResponseApplyPatchToolCallOutput { id, call_id, status, 5 more }

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.

call_id: string

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

status: "completed" | "failed"

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

One of the following:
"completed"
"failed"
type: "apply_patch_call_output"

The type of the item. Always apply_patch_call_output.

agent?: Agent { agent_name }

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

caller?: Direct { type } | Program { caller_id, type } | null

The execution context that produced this tool call.

One of the following:
Direct { type }
type: "direct"
Program { caller_id, type }
caller_id: string

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

type: "program"
created_by?: string

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

output?: string | null

Optional textual output returned by the apply patch tool.

McpCall { id, arguments, name, 7 more }

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.

server_label: string

The label of the MCP server running the tool.

type: "mcp_call"

The type of the item. Always mcp_call.

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

approval_request_id?: string | null

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?: string | null

The error from the tool call, if any.

output?: string | null

The output from the tool call.

status?: "in_progress" | "completed" | "incomplete" | 2 more

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

One of the following:
"in_progress"
"completed"
"incomplete"
"calling"
"failed"
McpListTools { id, server_label, tools, 3 more }

A list of tools available on an MCP server.

id: string

The unique ID of the list.

server_label: string

The label of the MCP server.

tools: Array<Tool>

The tools available on the server.

input_schema: unknown

The JSON schema describing the tool’s input.

name: string

The name of the tool.

annotations?: unknown

Additional annotations about the tool.

description?: string | null

The description of the tool.

type: "mcp_list_tools"

The type of the item. Always mcp_list_tools.

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

error?: string | null

Error message if the server could not list tools.

McpApprovalRequest { id, arguments, name, 3 more }

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.

server_label: string

The label of the MCP server making the request.

type: "mcp_approval_request"

The type of the item. Always mcp_approval_request.

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

McpApprovalResponse { id, approval_request_id, approve, 3 more }

A response to an MCP approval request.

id: string

The unique ID of the approval response

approval_request_id: string

The ID of the approval request being answered.

approve: boolean

Whether the request was approved.

type: "mcp_approval_response"

The type of the item. Always mcp_approval_response.

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

reason?: string | null

Optional reason for the decision.

BetaResponseCustomToolCall { call_id, input, name, 5 more }

A call to a custom tool created by the model.

call_id: 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: "custom_tool_call"

The type of the custom tool call. Always custom_tool_call.

id?: string

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

agent?: Agent | null

The agent that produced this item.

agent_name: string

The canonical name of the agent that produced this item.

caller?: Direct { type } | Program { caller_id, type } | null

The execution context that produced this tool call.

One of the following:
Direct { type }
type: "direct"
Program { caller_id, type }
caller_id: string

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

type: "program"
namespace?: string

The namespace of the custom tool being called.

BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput { call_id, output, type, 3 more } { id, status, created_by }

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: "in_progress" | "completed" | "incomplete"

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

One of the following:
"in_progress"
"completed"
"incomplete"
created_by?: string

The identifier of the actor that created the item.

usage: BetaResponseUsage { input_tokens, input_tokens_details, output_tokens, 2 more }

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

BetaComputerAction = Click { button, type, x, 2 more } | DoubleClick { keys, type, x, y } | Drag { path, type, keys } | 6 more

A click action.

One of the following:
Click { button, type, x, 2 more }

A click action.

button: "left" | "right" | "wheel" | 2 more

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

One of the following:
"left"
"right"
"wheel"
"back"
"forward"
type: "click"

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

x: number

The x-coordinate where the click occurred.

y: number

The y-coordinate where the click occurred.

keys?: Array<string> | null

The keys being held while clicking.

DoubleClick { keys, type, x, y }

A double click action.

keys: Array<string> | null

The keys being held while double-clicking.

type: "double_click"

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

x: number

The x-coordinate where the double click occurred.

y: number

The y-coordinate where the double click occurred.

Drag { path, type, keys }

A drag action.

path: Array<Path>

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: number

The x-coordinate.

y: number

The y-coordinate.

type: "drag"

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

keys?: Array<string> | null

The keys being held while dragging the mouse.

Keypress { keys, type }

A collection of keypresses the model would like to perform.

keys: Array<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.

Move { type, x, y, keys }

A mouse move action.

type: "move"

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

x: number

The x-coordinate to move to.

y: number

The y-coordinate to move to.

keys?: Array<string> | null

The keys being held while moving the mouse.

Screenshot { type }

A screenshot action.

type: "screenshot"

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

Scroll { scroll_x, scroll_y, type, 3 more }

A scroll action.

scroll_x: number

The horizontal scroll distance.

scroll_y: number

The vertical scroll distance.

type: "scroll"

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

x: number

The x-coordinate where the scroll occurred.

y: number

The y-coordinate where the scroll occurred.

keys?: Array<string> | null

The keys being held while scrolling.

Type { text, type }

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.

Wait { type }

A wait action.

type: "wait"

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

BetaComputerActionList = Array<BetaComputerAction>

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

One of the following:
Click { button, type, x, 2 more }

A click action.

button: "left" | "right" | "wheel" | 2 more

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

One of the following:
"left"
"right"
"wheel"
"back"
"forward"
type: "click"

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

x: number

The x-coordinate where the click occurred.

y: number

The y-coordinate where the click occurred.

keys?: Array<string> | null

The keys being held while clicking.

DoubleClick { keys, type, x, y }

A double click action.

keys: Array<string> | null

The keys being held while double-clicking.

type: "double_click"

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

x: number

The x-coordinate where the double click occurred.

y: number

The y-coordinate where the double click occurred.

Drag { path, type, keys }

A drag action.

path: Array<Path>

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: number

The x-coordinate.

y: number

The y-coordinate.

type: "drag"

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

keys?: Array<string> | null

The keys being held while dragging the mouse.

Keypress { keys, type }

A collection of keypresses the model would like to perform.

keys: Array<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.

Move { type, x, y, keys }

A mouse move action.

type: "move"

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

x: number

The x-coordinate to move to.

y: number

The y-coordinate to move to.

keys?: Array<string> | null

The keys being held while moving the mouse.

Screenshot { type }

A screenshot action.

type: "screenshot"

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

Scroll { scroll_x, scroll_y, type, 3 more }

A scroll action.

scroll_x: number

The horizontal scroll distance.

scroll_y: number

The vertical scroll distance.

type: "scroll"

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

x: number

The x-coordinate where the scroll occurred.

y: number

The y-coordinate where the scroll occurred.

keys?: Array<string> | null

The keys being held while scrolling.

Type { text, type }

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.

Wait { type }

A wait action.

type: "wait"

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

BetaComputerTool { type }

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

type: "computer"

The type of the computer tool. Always computer.

BetaComputerUsePreviewTool { display_height, display_width, environment, type }

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

display_height: number

The height of the computer display.

display_width: number

The width of the computer display.

environment: "windows" | "mac" | "linux" | 2 more

The type of computer environment to control.

One of the following:
"windows"
"mac"
"linux"
"ubuntu"
"browser"
type: "computer_use_preview"

The type of the computer use tool. Always computer_use_preview.

BetaContainerAuto { type, file_ids, memory_limit, 2 more }
type: "container_auto"

Automatically creates a container for this request

file_ids?: Array<string>

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

memory_limit?: "1g" | "4g" | "16g" | "64g" | null

The memory limit for the container.

One of the following:
"1g"
"4g"
"16g"
"64g"
network_policy?: BetaContainerNetworkPolicyDisabled { type } | BetaContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }

Network access policy for the container.

One of the following:
BetaContainerNetworkPolicyDisabled { type }
type: "disabled"

Disable outbound network access. Always disabled.

BetaContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
allowed_domains: Array<string>

A list of allowed domains when type is allowlist.

type: "allowlist"

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

domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret { domain, name, value } >

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?: Array<BetaSkillReference { skill_id, type, version } | BetaInlineSkill { description, name, source, type } >

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

One of the following:
BetaSkillReference { skill_id, type, version }
skill_id: string

The ID of the referenced skill.

maxLength64
minLength1
type: "skill_reference"

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

version?: string

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

BetaInlineSkill { description, name, source, type }
description: string

The description of the skill.

name: string

The name of the skill.

source: BetaInlineSkillSource { data, media_type, type }

Inline skill payload

type: "inline"

Defines an inline skill for this request.

BetaContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
allowed_domains: Array<string>

A list of allowed domains when type is allowlist.

type: "allowlist"

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

domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret { domain, name, value } >

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
BetaContainerNetworkPolicyDisabled { type }
type: "disabled"

Disable outbound network access. Always disabled.

BetaContainerNetworkPolicyDomainSecret { domain, name, value }
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
BetaContainerReference { container_id, type }
container_id: string

The ID of the referenced container.

type: "container_reference"

References a container created with the /v1/containers endpoint

BetaCustomTool { name, type, allowed_callers, 3 more }

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.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
defer_loading?: boolean

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

description?: string

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

format?: Text { type } | Grammar { definition, syntax, type }

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

One of the following:
Text { type }

Unconstrained free-form text.

type: "text"

Unconstrained text format. Always text.

Grammar { definition, syntax, type }

A grammar defined by the user.

definition: string

The grammar definition.

syntax: "lark" | "regex"

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

One of the following:
"lark"
"regex"
type: "grammar"

Grammar format. Always grammar.

BetaEasyInputMessage { content, role, phase, type }

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: string | BetaResponseInputMessageContentList { , , }

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

One of the following:
string
BetaResponseInputMessageContentList = Array<BetaResponseInputContent>

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

One of the following:
BetaResponseInputText { text, type, prompt_cache_breakpoint }

A text input to the model.

text: string

The text input to the model.

type: "input_text"

The type of the input item. Always input_text.

prompt_cache_breakpoint?: PromptCacheBreakpoint { mode }

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

mode: "explicit"

The breakpoint mode. Always explicit.

BetaResponseInputImage { detail, type, file_id, 2 more }

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

detail: "low" | "high" | "auto" | "original"

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:
"low"
"high"
"auto"
"original"
type: "input_image"

The type of the input item. Always input_image.

file_id?: string | null

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

image_url?: string | null

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

formaturi
prompt_cache_breakpoint?: PromptCacheBreakpoint { mode }

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

mode: "explicit"

The breakpoint mode. Always explicit.

BetaResponseInputFile { type, detail, file_data, 4 more }

A file input to the model.

type: "input_file"

The type of the input item. Always input_file.

detail?: "auto" | "low" | "high"

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

One of the following:
"auto"
"low"
"high"
file_data?: string

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

file_id?: string | null

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

file_url?: string

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

formaturi
filename?: string

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

prompt_cache_breakpoint?: PromptCacheBreakpoint { mode }

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

mode: "explicit"

The breakpoint mode. Always explicit.

role: "user" | "assistant" | "system" | "developer"

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

One of the following:
"user"
"assistant"
"system"
"developer"
phase?: "commentary" | null

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.

type?: "message"

The type of the message input. Always message.

BetaFileSearchTool { type, vector_store_ids, filters, 2 more }

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

type: "file_search"

The type of the file search tool. Always file_search.

vector_store_ids: Array<string>

The IDs of the vector stores to search.

filters?: ComparisonFilter { key, type, value } | CompoundFilter { filters, type } | null

A filter to apply.

One of the following:
ComparisonFilter { key, type, value }

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: "eq" | "ne" | "gt" | 5 more

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:
"eq"
"ne"
"gt"
"gte"
"lt"
"lte"
"in"
"nin"
value: string | number | boolean | Array<unknown>

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

One of the following:
string
number
boolean
Array<unknown>
CompoundFilter { filters, type }

Combine multiple filters using and or or.

filters: Array<ComparisonFilter { key, type, value } | unknown>

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

One of the following:
ComparisonFilter { key, type, value }

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: "eq" | "ne" | "gt" | 5 more

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:
"eq"
"ne"
"gt"
"gte"
"lt"
"lte"
"in"
"nin"
value: string | number | boolean | Array<unknown>

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

One of the following:
string
number
boolean
Array<unknown>
unknown
type: "and" | "or"

Type of operation: and or or.

One of the following:
"and"
"or"
max_num_results?: number

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

ranking_options?: RankingOptions { hybrid_search, ranker, score_threshold }

Ranking options for search.

ranker?: "auto" | "default-2024-11-15"

The ranker to use for the file search.

One of the following:
"auto"
"default-2024-11-15"
score_threshold?: number

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.

BetaFunctionShellTool { type, allowed_callers, environment }

A tool that allows the model to execute shell commands.

type: "shell"

The type of the shell tool. Always shell.

allowed_callers?: Array<"direct" | "programmatic"> | null

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
environment?: BetaContainerAuto { type, file_ids, memory_limit, 2 more } | BetaLocalEnvironment { type, skills } | BetaContainerReference { container_id, type } | null
One of the following:
BetaContainerAuto { type, file_ids, memory_limit, 2 more }
type: "container_auto"

Automatically creates a container for this request

file_ids?: Array<string>

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

memory_limit?: "1g" | "4g" | "16g" | "64g" | null

The memory limit for the container.

One of the following:
"1g"
"4g"
"16g"
"64g"
network_policy?: BetaContainerNetworkPolicyDisabled { type } | BetaContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }

Network access policy for the container.

One of the following:
BetaContainerNetworkPolicyDisabled { type }
type: "disabled"

Disable outbound network access. Always disabled.

BetaContainerNetworkPolicyAllowlist { allowed_domains, type, domain_secrets }
allowed_domains: Array<string>

A list of allowed domains when type is allowlist.

type: "allowlist"

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

domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret { domain, name, value } >

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?: Array<BetaSkillReference { skill_id, type, version } | BetaInlineSkill { description, name, source, type } >

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

One of the following:
BetaSkillReference { skill_id, type, version }
skill_id: string

The ID of the referenced skill.

maxLength64
minLength1
type: "skill_reference"

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

version?: string

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

BetaInlineSkill { description, name, source, type }
description: string

The description of the skill.

name: string

The name of the skill.

source: BetaInlineSkillSource { data, media_type, type }

Inline skill payload

type: