# Beta

# Agents

## Create an agent

`client.beta.agents.create(AgentCreateParamsbody, RequestOptionsoptions?): Agent`

**post** `/agents`

Creates a reusable agent without storing credentials. See [agent configuration](/api/docs/guides/agents-api/configuration).

### Parameters

- `body: AgentCreateParams`

  - `model: string`

    The model to use for the agent. The requested model name is preserved.

    `minLength: 0`, `maxLength: 1048576`

  - `compaction?: Compaction | null`

    Context compaction settings. Omission or null enables background compaction.

    - `async?: boolean | null`

      Whether to compact context in the background. Omission or null defaults to true. Set to false to use blocking compaction. Background compaction may increase token usage.

  - `experimental?: Experimental`

    Experimental agent settings. All experimental features default to disabled.

    - `time_awareness?: boolean`

      Whether to give the model periodic current-time reminders. Defaults to false.

  - `instructions?: string | null`

    Additional instructions appended to the agent's default base instructions. Omit or set to null to add no custom instructions.

    `minLength: 0`, `maxLength: 1048576`

  - `metadata?: Record<string, string> | null`

    Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map.

  - `multi_agent?: MultiAgentConfigParam | null`

    Configuration for creating and coordinating subagents. Subagent tools are disabled by default.

    - `enabled: boolean`

      Whether subagent tools are enabled.

    - `max_concurrent_subagents?: number`

      Maximum number of subagents that may run concurrently. Defaults to 6.

      `format: int64`, `minimum: 1`, `maximum: 4294967295`

  - `name?: string | null`

    A human-readable name for the agent. Omission or null leaves the agent unnamed.

    `minLength: 0`, `maxLength: 128`

  - `reasoning?: AgentReasoningParam | null`

    Configuration for model reasoning. Omission uses the model's default effort.

    - `effort?: "none" | "minimal" | "low" | 4 more | null`

      The amount of reasoning effort the model should use. Omission lets the model select it.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `summary?: "concise" | "detailed" | "auto" | null`

      Controls whether the response includes a reasoning summary.

      - `"concise"`

        Returns a concise reasoning summary when supported.

      - `"detailed"`

        Returns a detailed reasoning summary when supported.

      - `"auto"`

        Automatically selects the most detailed summary supported by the model.

  - `service_tier?: "auto" | "default" | "flex" | 3 more | null`

    The service tier used for model requests. Defaults to `auto`.

    - `"auto"`

      Selects the service tier automatically.

    - `"default"`

      Uses the default service tier.

    - `"flex"`

      Uses the flex service tier.

    - `"priority"`

      Uses the priority service tier.

    - `"fast"`

      Uses the fast service tier.

    - `"ultrafast"`

      Uses the ultrafast service tier.

  - `text?: AgentTextParam | null`

    Configuration for generated text. Defaults to the `text` format and medium verbosity.

    - `format?: TextFormatParam | null`

      The output format. Omission uses ordinary text (`{"type": "text"}`).

      - `TextFormatParamText`

        Generates ordinary text without a structured-output constraint.

        - `type: "text"`

          The type of the object. Always `text`.

          - `"text"`

      - `TextFormatParamJSONSchema`

        Constrains generated text to a JSON Schema.

        - `schema: Record<string, unknown>`

          The JSON Schema that generated text must match.

        - `type: "json_schema"`

          The type of the object. Always `json_schema`.

          - `"json_schema"`

    - `verbosity?: "low" | "medium" | "high" | null`

      The amount of text the model should produce. Defaults to `medium`, matching Responses.

      - `"low"`

        Produces less text.

      - `"medium"`

        Uses the default amount of text.

      - `"high"`

        Produces more text.

  - `tools?: Array<PersistedAgentToolParam> | null`

    Tools available to the agent. Defaults to an empty list. The tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON.

    `minItems: 0`, `maxItems: 2000`

    - `PersistedAgentToolConfigParamFunction`

      A function defined by the application.

      - `description: string`

        A description of what the function does.

        `minLength: 0`, `maxLength: 1048576`

      - `name: string`

        The name of the function.

        `minLength: 0`, `maxLength: 1048576`

      - `parameters: Record<string, unknown>`

        A JSON Schema object describing the function's arguments.

      - `type: "function"`

        The type of the object. Always `function`.

        - `"function"`

      - `async?: boolean`

        Whether the agent continues without waiting for the function result. Defaults to `false`.

      - `defer_loading?: boolean`

        Whether this function is deferred and discovered through tool search. Defaults to `false`.

    - `PersistedAgentToolConfigParamToolSearch`

      Discovers deferred function tools and loads them into the model context.

      - `type: "tool_search"`

        The type of the object. Always `tool_search`.

        - `"tool_search"`

    - `PersistedAgentToolConfigParamProgrammaticToolCalling`

      Enables calling tools from model-generated code.

      - `type: "programmatic_tool_calling"`

        The type of the object. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

      - `enabled?: boolean`

        Whether tools can be called from model-generated code. Defaults to `true`.

    - `PersistedAgentToolConfigParamMcp`

      Tools provided by a remote MCP server without stored credentials.

      - `server_label: string`

        A label used to identify the MCP server in tool calls.

        `minLength: 0`, `maxLength: 1048576`

      - `transport: PersistedMcpTransportParam`

        The credential-free transport used to connect to the MCP server.

        - `PersistedMcpTransportConfigParamHTTP`

          Connects to an MCP server over HTTP.

          - `server_url: string`

            The URL of the MCP server.

            `minLength: 0`, `maxLength: 1048576`

          - `type: "http"`

            The type of the object. Always `http`.

            - `"http"`

          - `headers?: Record<string, string> | null`

            Non-secret HTTP headers sent to the MCP server.

        - `PersistedMcpTransportConfigParamStdio`

          Starts an MCP server as a local process.

          - `command: string`

            The command used to start the MCP server.

            `minLength: 0`, `maxLength: 1048576`

          - `cwd: string`

            The working directory used to start the MCP server.

            `minLength: 0`, `maxLength: 1048576`

          - `type: "stdio"`

            The type of the object. Always `stdio`.

            - `"stdio"`

          - `args?: Array<string> | null`

            Arguments passed to the MCP server command.

            `minItems: 0`, `maxItems: 16384`

          - `env_vars?: Array<string> | null`

            Environment variable names to inherit from the selected execution environment.

            `minItems: 0`, `maxItems: 16384`

      - `type: "mcp"`

        The type of the object. Always `mcp`.

        - `"mcp"`

      - `allowed_tools?: Array<string> | null`

        The MCP tools the agent may call. All server tools are allowed when omitted.

        `minItems: 0`, `maxItems: 16384`

      - `connection_origin?: "service" | "environment" | null`

        Selects where outbound MCP HTTP connections originate.

        - `"service"`

          Uses the Managed Agents service network.

        - `"environment"`

          Uses the session's execution environment.

      - `credential_id?: string | null`

        The vault credential selected for this MCP server. Optional when exactly one attached credential matches the server URL.

        `minLength: 0`, `maxLength: 1048576`

      - `request_metadata?: Record<string, unknown> | null`

        Metadata included with requests to this MCP server.

      - `required?: boolean`

        Whether this MCP server must initialize before the first turn. Defaults to `false`.

    - `PersistedAgentToolConfigParamWebSearch`

      Web search.

      - `type: "web_search"`

        The type of the object. Always `web_search`.

        - `"web_search"`

      - `allowed_domains?: Array<string> | null`

        Domains the search may include.

        `minItems: 0`, `maxItems: 16384`

      - `context_size?: "low" | "medium" | "high" | null`

        The amount of search context made available to the model. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

      - `location?: Location | null`

        Approximate location used to localize search results.

        - `city?: string | null`

          The city name.

          `minLength: 0`, `maxLength: 1048576`

        - `country?: string | null`

          The two-letter ISO country code, such as `US`.

          `minLength: 0`, `maxLength: 1048576`

        - `region?: string | null`

          The region or state name.

          `minLength: 0`, `maxLength: 1048576`

        - `timezone?: string | null`

          The IANA timezone, such as `America/Los_Angeles`.

          `minLength: 0`, `maxLength: 1048576`

      - `mode?: "disabled" | "cached" | "live" | null`

        The source used for web search results. Defaults to `live`.

        - `"disabled"`

          Disables web search.

        - `"cached"`

          Uses cached search results.

        - `"live"`

          Searches the live web.

    - `PersistedAgentToolConfigParamComputerUse`

      Browser use in an OpenAI-hosted session.

      - `type: "computer_use"`

        The type of the object. Always `computer_use`.

        - `"computer_use"`

      - `include_screenshots?: boolean`

        Whether computer tool outputs include screenshots. Defaults to `false`.

    - `PersistedAgentToolConfigParamAutomations`

      Lets the agent manage its own scheduled wakeups.

      - `type: "automations"`

        The type of the object. Always `automations`.

        - `"automations"`

### Returns

- `Agent`

  A reusable agent scoped to the caller's project.

  - `id: string`

    The ID of the reusable agent.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp, in seconds, when the agent was created.

    `format: int64`

  - `instructions: string | null`

    Custom instructions appended to the agent's default base instructions.

    `minLength: 0`

  - `metadata: Record<string, string>`

    Custom string key-value pairs attached to the agent.

  - `model: string`

    The requested model name used for inference.

    `minLength: 0`

  - `multi_agent: MultiAgentConfig`

    The resolved configuration for creating and coordinating subagents.

    - `enabled: boolean`

      Whether subagent tools are enabled. Defaults to false.

    - `max_concurrent_subagents: number | null`

      Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

      `format: int64`, `minimum: 1`, `maximum: 4294967295`

  - `name: string | null`

    A human-readable name for the agent, or null if it is unnamed.

    `minLength: 0`

  - `object: "agent"`

    The object type. Always `agent`.

    - `"agent"`

  - `reasoning: AgentReasoning`

    The resolved reasoning configuration, including the model default for an omitted effort.

    - `effort: "none" | "minimal" | "low" | 4 more | null`

      The requested reasoning effort, or `null` when the model selects its own default.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `summary: "concise" | "detailed" | "auto" | null`

      The requested reasoning summary format, or `null` when summaries are disabled.

      - `"concise"`

        Returns a concise reasoning summary when supported.

      - `"detailed"`

        Returns a detailed reasoning summary when supported.

      - `"auto"`

        Automatically selects the most detailed summary supported by the model.

  - `service_tier: "auto" | "default" | "flex" | 3 more`

    The resolved service-tier policy used for model requests.

    - `"auto"`

    - `"default"`

    - `"flex"`

    - `"priority"`

    - `"fast"`

    - `"ultrafast"`

  - `text: AgentText`

    The resolved configuration for text generated by the agent.

    - `format: TextFormat`

      The effective output format. Defaults to ordinary text.

      - `TextFormatResourceText`

        Generates ordinary text without a structured-output constraint.

        - `type: "text"`

          The type of the object. Always `text`.

          - `"text"`

      - `TextFormatResourceJSONSchema`

        Constrains generated text to a JSON Schema.

        - `schema: Record<string, unknown>`

          The JSON Schema that generated text must match.

        - `type: "json_schema"`

          The type of the object. Always `json_schema`.

          - `"json_schema"`

    - `verbosity: "low" | "medium" | "high"`

      The amount of text produced by the agent. Defaults to `medium`.

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tools: Array<PersistedAgentTool>`

    Tools available to the agent.

    `minItems: 0`, `maxItems: 2000`

    - `PersistedAgentToolResourceFunction`

      A function defined by the application.

      - `defer_loading: boolean`

        Whether the function is deferred and discovered through tool search.

      - `description: string`

        A description of what the function does.

        `minLength: 0`

      - `name: string`

        The name of the function.

        `minLength: 0`

      - `parameters: Record<string, unknown>`

        A JSON Schema object describing the function's arguments.

      - `type: "function"`

        The type of the object. Always `function`.

        - `"function"`

      - `async?: boolean`

        Whether the agent continues without waiting for the function result.

    - `PersistedAgentToolResourceToolSearch`

      Discovers deferred function tools and loads them into the model context.

      - `type: "tool_search"`

        The type of the object. Always `tool_search`.

        - `"tool_search"`

    - `PersistedAgentToolResourceProgrammaticToolCalling`

      Enables calling tools from model-generated code.

      - `enabled: boolean`

        Whether tools can be called from model-generated code.

      - `type: "programmatic_tool_calling"`

        The type of the object. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `PersistedAgentToolResourceMcp`

      Tools provided by a remote MCP server without stored credentials.

      - `allowed_tools: Array<string> | null`

        The MCP tools the agent may call, or null when all server tools are allowed.

        `minItems: 0`, `maxItems: 2000`

      - `connection_origin: "service" | "environment"`

        Where outbound MCP HTTP connections originate.

        - `"service"`

        - `"environment"`

      - `credential_id: string | null`

        The vault credential selected for this MCP server, if any.

        `minLength: 0`

      - `request_metadata: Record<string, unknown>`

        Metadata included with requests to this MCP server.

      - `required: boolean`

        Whether this MCP server must initialize before the first turn.

      - `server_label: string`

        A label used to identify the MCP server in tool calls.

        `minLength: 0`

      - `transport: PersistedMcpTransport`

        The credential-free transport used to connect to the MCP server.

        - `PersistedMcpTransportResourceHTTP`

          Connects to an MCP server over HTTP.

          - `headers: Record<string, string>`

            Non-secret HTTP headers sent to the MCP server.

          - `server_url: string`

            The URL of the MCP server.

            `minLength: 0`

          - `type: "http"`

            The type of the object. Always `http`.

            - `"http"`

        - `PersistedMcpTransportResourceStdio`

          Starts an MCP server as a local process.

          - `args: Array<string>`

            Arguments passed to the MCP server command.

            `minItems: 0`, `maxItems: 2000`

          - `command: string`

            The command used to start the MCP server.

            `minLength: 0`

          - `cwd: string`

            The working directory used to start the MCP server.

            `minLength: 0`

          - `env_vars: Array<string>`

            Environment variable names inherited from the execution environment.

            `minItems: 0`, `maxItems: 2000`

          - `type: "stdio"`

            The type of the object. Always `stdio`.

            - `"stdio"`

      - `type: "mcp"`

        The type of the object. Always `mcp`.

        - `"mcp"`

    - `PersistedAgentToolResourceWebSearch`

      Web search.

      - `allowed_domains: Array<string> | null`

        Allowed search domains, or `null` when the search is unrestricted.

        `minItems: 0`, `maxItems: 2000`

      - `context_size: "low" | "medium" | "high"`

        The amount of search context made available to the model. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

      - `location: Location | null`

        Approximate location used to localize search results, if provided.

        - `city: string | null`

          The city name.

          `minLength: 0`

        - `country: string | null`

          The two-letter ISO country code, such as `US`.

          `minLength: 0`

        - `region: string | null`

          The region or state name.

          `minLength: 0`

        - `timezone: string | null`

          The IANA timezone, such as `America/Los_Angeles`.

          `minLength: 0`

      - `mode: "disabled" | "cached" | "live"`

        The source used for web search results.

        - `"disabled"`

        - `"cached"`

        - `"live"`

      - `type: "web_search"`

        The type of the object. Always `web_search`.

        - `"web_search"`

    - `PersistedAgentToolResourceComputerUse`

      Browser use in an OpenAI-hosted session.

      - `include_screenshots: boolean`

        Whether computer tool outputs include screenshots.

      - `type: "computer_use"`

        The type of the object. Always `computer_use`.

        - `"computer_use"`

    - `PersistedAgentToolResourceAutomations`

      Lets the agent manage its own scheduled wakeups.

      - `type: "automations"`

        The type of the object. Always `automations`.

        - `"automations"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the agent was last updated.

    `format: int64`

  - `compaction?: Compaction`

    The effective context compaction settings.

    - `async: boolean`

      Whether context is compacted in the background. Defaults to true.

  - `experimental?: Experimental`

    The effective experimental settings for the agent.

    - `time_awareness: boolean`

      Whether the model receives periodic current-time reminders.

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const agent = await client.beta.agents.create({ model: 'model' });

console.log(agent.id);
```

#### 201 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "instructions": "instructions",
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "multi_agent": {
    "enabled": true,
    "max_concurrent_subagents": 1
  },
  "name": "name",
  "object": "agent",
  "reasoning": {
    "effort": "none",
    "summary": "concise"
  },
  "service_tier": "auto",
  "text": {
    "format": {
      "type": "text"
    },
    "verbosity": "low"
  },
  "tools": [
    {
      "defer_loading": true,
      "description": "description",
      "name": "name",
      "parameters": {
        "foo": "bar"
      },
      "type": "function",
      "async": true
    }
  ],
  "updated_at": 0,
  "compaction": {
    "async": true
  },
  "experimental": {
    "time_awareness": true
  }
}
```

## Delete an agent

`client.beta.agents.delete(stringagentID, RequestOptionsoptions?): AgentDeleted`

**delete** `/agents/{agent_id}`

Deletes a reusable agent. See [agent configuration](/api/docs/guides/agents-api/configuration).

### Parameters

- `agentID: string`

  `minLength: 0`, `maxLength: 1048576`

### Returns

- `AgentDeleted`

  A deleted reusable agent.

  - `id: string`

    The ID of the deleted agent.

    `minLength: 0`

  - `deleted: boolean`

    Whether the agent was deleted. Always `true`.

  - `object: "agent.deleted"`

    The object type. Always `agent.deleted`.

    - `"agent.deleted"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const agentDeleted = await client.beta.agents.delete('agent_id');

console.log(agentDeleted.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "deleted": true,
  "object": "agent.deleted"
}
```

## List agents

`client.beta.agents.list(AgentListParamsquery?, RequestOptionsoptions?): CursorPage<Agent>`

**get** `/agents`

Lists reusable agents in the current project. See [agent configuration](/api/docs/guides/agents-api/configuration).

### Parameters

- `query: AgentListParams`

  - `after?: string`

    Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

### Returns

- `Agent`

  A reusable agent scoped to the caller's project.

  - `id: string`

    The ID of the reusable agent.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp, in seconds, when the agent was created.

    `format: int64`

  - `instructions: string | null`

    Custom instructions appended to the agent's default base instructions.

    `minLength: 0`

  - `metadata: Record<string, string>`

    Custom string key-value pairs attached to the agent.

  - `model: string`

    The requested model name used for inference.

    `minLength: 0`

  - `multi_agent: MultiAgentConfig`

    The resolved configuration for creating and coordinating subagents.

    - `enabled: boolean`

      Whether subagent tools are enabled. Defaults to false.

    - `max_concurrent_subagents: number | null`

      Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

      `format: int64`, `minimum: 1`, `maximum: 4294967295`

  - `name: string | null`

    A human-readable name for the agent, or null if it is unnamed.

    `minLength: 0`

  - `object: "agent"`

    The object type. Always `agent`.

    - `"agent"`

  - `reasoning: AgentReasoning`

    The resolved reasoning configuration, including the model default for an omitted effort.

    - `effort: "none" | "minimal" | "low" | 4 more | null`

      The requested reasoning effort, or `null` when the model selects its own default.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `summary: "concise" | "detailed" | "auto" | null`

      The requested reasoning summary format, or `null` when summaries are disabled.

      - `"concise"`

        Returns a concise reasoning summary when supported.

      - `"detailed"`

        Returns a detailed reasoning summary when supported.

      - `"auto"`

        Automatically selects the most detailed summary supported by the model.

  - `service_tier: "auto" | "default" | "flex" | 3 more`

    The resolved service-tier policy used for model requests.

    - `"auto"`

    - `"default"`

    - `"flex"`

    - `"priority"`

    - `"fast"`

    - `"ultrafast"`

  - `text: AgentText`

    The resolved configuration for text generated by the agent.

    - `format: TextFormat`

      The effective output format. Defaults to ordinary text.

      - `TextFormatResourceText`

        Generates ordinary text without a structured-output constraint.

        - `type: "text"`

          The type of the object. Always `text`.

          - `"text"`

      - `TextFormatResourceJSONSchema`

        Constrains generated text to a JSON Schema.

        - `schema: Record<string, unknown>`

          The JSON Schema that generated text must match.

        - `type: "json_schema"`

          The type of the object. Always `json_schema`.

          - `"json_schema"`

    - `verbosity: "low" | "medium" | "high"`

      The amount of text produced by the agent. Defaults to `medium`.

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tools: Array<PersistedAgentTool>`

    Tools available to the agent.

    `minItems: 0`, `maxItems: 2000`

    - `PersistedAgentToolResourceFunction`

      A function defined by the application.

      - `defer_loading: boolean`

        Whether the function is deferred and discovered through tool search.

      - `description: string`

        A description of what the function does.

        `minLength: 0`

      - `name: string`

        The name of the function.

        `minLength: 0`

      - `parameters: Record<string, unknown>`

        A JSON Schema object describing the function's arguments.

      - `type: "function"`

        The type of the object. Always `function`.

        - `"function"`

      - `async?: boolean`

        Whether the agent continues without waiting for the function result.

    - `PersistedAgentToolResourceToolSearch`

      Discovers deferred function tools and loads them into the model context.

      - `type: "tool_search"`

        The type of the object. Always `tool_search`.

        - `"tool_search"`

    - `PersistedAgentToolResourceProgrammaticToolCalling`

      Enables calling tools from model-generated code.

      - `enabled: boolean`

        Whether tools can be called from model-generated code.

      - `type: "programmatic_tool_calling"`

        The type of the object. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `PersistedAgentToolResourceMcp`

      Tools provided by a remote MCP server without stored credentials.

      - `allowed_tools: Array<string> | null`

        The MCP tools the agent may call, or null when all server tools are allowed.

        `minItems: 0`, `maxItems: 2000`

      - `connection_origin: "service" | "environment"`

        Where outbound MCP HTTP connections originate.

        - `"service"`

        - `"environment"`

      - `credential_id: string | null`

        The vault credential selected for this MCP server, if any.

        `minLength: 0`

      - `request_metadata: Record<string, unknown>`

        Metadata included with requests to this MCP server.

      - `required: boolean`

        Whether this MCP server must initialize before the first turn.

      - `server_label: string`

        A label used to identify the MCP server in tool calls.

        `minLength: 0`

      - `transport: PersistedMcpTransport`

        The credential-free transport used to connect to the MCP server.

        - `PersistedMcpTransportResourceHTTP`

          Connects to an MCP server over HTTP.

          - `headers: Record<string, string>`

            Non-secret HTTP headers sent to the MCP server.

          - `server_url: string`

            The URL of the MCP server.

            `minLength: 0`

          - `type: "http"`

            The type of the object. Always `http`.

            - `"http"`

        - `PersistedMcpTransportResourceStdio`

          Starts an MCP server as a local process.

          - `args: Array<string>`

            Arguments passed to the MCP server command.

            `minItems: 0`, `maxItems: 2000`

          - `command: string`

            The command used to start the MCP server.

            `minLength: 0`

          - `cwd: string`

            The working directory used to start the MCP server.

            `minLength: 0`

          - `env_vars: Array<string>`

            Environment variable names inherited from the execution environment.

            `minItems: 0`, `maxItems: 2000`

          - `type: "stdio"`

            The type of the object. Always `stdio`.

            - `"stdio"`

      - `type: "mcp"`

        The type of the object. Always `mcp`.

        - `"mcp"`

    - `PersistedAgentToolResourceWebSearch`

      Web search.

      - `allowed_domains: Array<string> | null`

        Allowed search domains, or `null` when the search is unrestricted.

        `minItems: 0`, `maxItems: 2000`

      - `context_size: "low" | "medium" | "high"`

        The amount of search context made available to the model. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

      - `location: Location | null`

        Approximate location used to localize search results, if provided.

        - `city: string | null`

          The city name.

          `minLength: 0`

        - `country: string | null`

          The two-letter ISO country code, such as `US`.

          `minLength: 0`

        - `region: string | null`

          The region or state name.

          `minLength: 0`

        - `timezone: string | null`

          The IANA timezone, such as `America/Los_Angeles`.

          `minLength: 0`

      - `mode: "disabled" | "cached" | "live"`

        The source used for web search results.

        - `"disabled"`

        - `"cached"`

        - `"live"`

      - `type: "web_search"`

        The type of the object. Always `web_search`.

        - `"web_search"`

    - `PersistedAgentToolResourceComputerUse`

      Browser use in an OpenAI-hosted session.

      - `include_screenshots: boolean`

        Whether computer tool outputs include screenshots.

      - `type: "computer_use"`

        The type of the object. Always `computer_use`.

        - `"computer_use"`

    - `PersistedAgentToolResourceAutomations`

      Lets the agent manage its own scheduled wakeups.

      - `type: "automations"`

        The type of the object. Always `automations`.

        - `"automations"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the agent was last updated.

    `format: int64`

  - `compaction?: Compaction`

    The effective context compaction settings.

    - `async: boolean`

      Whether context is compacted in the background. Defaults to true.

  - `experimental?: Experimental`

    The effective experimental settings for the agent.

    - `time_awareness: boolean`

      Whether the model receives periodic current-time reminders.

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const agent of client.beta.agents.list()) {
  console.log(agent.id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "instructions": "instructions",
      "metadata": {
        "foo": "string"
      },
      "model": "model",
      "multi_agent": {
        "enabled": true,
        "max_concurrent_subagents": 1
      },
      "name": "name",
      "object": "agent",
      "reasoning": {
        "effort": "none",
        "summary": "concise"
      },
      "service_tier": "auto",
      "text": {
        "format": {
          "type": "text"
        },
        "verbosity": "low"
      },
      "tools": [
        {
          "defer_loading": true,
          "description": "description",
          "name": "name",
          "parameters": {
            "foo": "bar"
          },
          "type": "function",
          "async": true
        }
      ],
      "updated_at": 0,
      "compaction": {
        "async": true
      },
      "experimental": {
        "time_awareness": true
      }
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve an agent

`client.beta.agents.retrieve(stringagentID, RequestOptionsoptions?): Agent`

**get** `/agents/{agent_id}`

Retrieves a reusable agent by ID. See [agent configuration](/api/docs/guides/agents-api/configuration).

### Parameters

- `agentID: string`

  `minLength: 0`, `maxLength: 1048576`

### Returns

- `Agent`

  A reusable agent scoped to the caller's project.

  - `id: string`

    The ID of the reusable agent.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp, in seconds, when the agent was created.

    `format: int64`

  - `instructions: string | null`

    Custom instructions appended to the agent's default base instructions.

    `minLength: 0`

  - `metadata: Record<string, string>`

    Custom string key-value pairs attached to the agent.

  - `model: string`

    The requested model name used for inference.

    `minLength: 0`

  - `multi_agent: MultiAgentConfig`

    The resolved configuration for creating and coordinating subagents.

    - `enabled: boolean`

      Whether subagent tools are enabled. Defaults to false.

    - `max_concurrent_subagents: number | null`

      Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

      `format: int64`, `minimum: 1`, `maximum: 4294967295`

  - `name: string | null`

    A human-readable name for the agent, or null if it is unnamed.

    `minLength: 0`

  - `object: "agent"`

    The object type. Always `agent`.

    - `"agent"`

  - `reasoning: AgentReasoning`

    The resolved reasoning configuration, including the model default for an omitted effort.

    - `effort: "none" | "minimal" | "low" | 4 more | null`

      The requested reasoning effort, or `null` when the model selects its own default.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `summary: "concise" | "detailed" | "auto" | null`

      The requested reasoning summary format, or `null` when summaries are disabled.

      - `"concise"`

        Returns a concise reasoning summary when supported.

      - `"detailed"`

        Returns a detailed reasoning summary when supported.

      - `"auto"`

        Automatically selects the most detailed summary supported by the model.

  - `service_tier: "auto" | "default" | "flex" | 3 more`

    The resolved service-tier policy used for model requests.

    - `"auto"`

    - `"default"`

    - `"flex"`

    - `"priority"`

    - `"fast"`

    - `"ultrafast"`

  - `text: AgentText`

    The resolved configuration for text generated by the agent.

    - `format: TextFormat`

      The effective output format. Defaults to ordinary text.

      - `TextFormatResourceText`

        Generates ordinary text without a structured-output constraint.

        - `type: "text"`

          The type of the object. Always `text`.

          - `"text"`

      - `TextFormatResourceJSONSchema`

        Constrains generated text to a JSON Schema.

        - `schema: Record<string, unknown>`

          The JSON Schema that generated text must match.

        - `type: "json_schema"`

          The type of the object. Always `json_schema`.

          - `"json_schema"`

    - `verbosity: "low" | "medium" | "high"`

      The amount of text produced by the agent. Defaults to `medium`.

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tools: Array<PersistedAgentTool>`

    Tools available to the agent.

    `minItems: 0`, `maxItems: 2000`

    - `PersistedAgentToolResourceFunction`

      A function defined by the application.

      - `defer_loading: boolean`

        Whether the function is deferred and discovered through tool search.

      - `description: string`

        A description of what the function does.

        `minLength: 0`

      - `name: string`

        The name of the function.

        `minLength: 0`

      - `parameters: Record<string, unknown>`

        A JSON Schema object describing the function's arguments.

      - `type: "function"`

        The type of the object. Always `function`.

        - `"function"`

      - `async?: boolean`

        Whether the agent continues without waiting for the function result.

    - `PersistedAgentToolResourceToolSearch`

      Discovers deferred function tools and loads them into the model context.

      - `type: "tool_search"`

        The type of the object. Always `tool_search`.

        - `"tool_search"`

    - `PersistedAgentToolResourceProgrammaticToolCalling`

      Enables calling tools from model-generated code.

      - `enabled: boolean`

        Whether tools can be called from model-generated code.

      - `type: "programmatic_tool_calling"`

        The type of the object. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `PersistedAgentToolResourceMcp`

      Tools provided by a remote MCP server without stored credentials.

      - `allowed_tools: Array<string> | null`

        The MCP tools the agent may call, or null when all server tools are allowed.

        `minItems: 0`, `maxItems: 2000`

      - `connection_origin: "service" | "environment"`

        Where outbound MCP HTTP connections originate.

        - `"service"`

        - `"environment"`

      - `credential_id: string | null`

        The vault credential selected for this MCP server, if any.

        `minLength: 0`

      - `request_metadata: Record<string, unknown>`

        Metadata included with requests to this MCP server.

      - `required: boolean`

        Whether this MCP server must initialize before the first turn.

      - `server_label: string`

        A label used to identify the MCP server in tool calls.

        `minLength: 0`

      - `transport: PersistedMcpTransport`

        The credential-free transport used to connect to the MCP server.

        - `PersistedMcpTransportResourceHTTP`

          Connects to an MCP server over HTTP.

          - `headers: Record<string, string>`

            Non-secret HTTP headers sent to the MCP server.

          - `server_url: string`

            The URL of the MCP server.

            `minLength: 0`

          - `type: "http"`

            The type of the object. Always `http`.

            - `"http"`

        - `PersistedMcpTransportResourceStdio`

          Starts an MCP server as a local process.

          - `args: Array<string>`

            Arguments passed to the MCP server command.

            `minItems: 0`, `maxItems: 2000`

          - `command: string`

            The command used to start the MCP server.

            `minLength: 0`

          - `cwd: string`

            The working directory used to start the MCP server.

            `minLength: 0`

          - `env_vars: Array<string>`

            Environment variable names inherited from the execution environment.

            `minItems: 0`, `maxItems: 2000`

          - `type: "stdio"`

            The type of the object. Always `stdio`.

            - `"stdio"`

      - `type: "mcp"`

        The type of the object. Always `mcp`.

        - `"mcp"`

    - `PersistedAgentToolResourceWebSearch`

      Web search.

      - `allowed_domains: Array<string> | null`

        Allowed search domains, or `null` when the search is unrestricted.

        `minItems: 0`, `maxItems: 2000`

      - `context_size: "low" | "medium" | "high"`

        The amount of search context made available to the model. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

      - `location: Location | null`

        Approximate location used to localize search results, if provided.

        - `city: string | null`

          The city name.

          `minLength: 0`

        - `country: string | null`

          The two-letter ISO country code, such as `US`.

          `minLength: 0`

        - `region: string | null`

          The region or state name.

          `minLength: 0`

        - `timezone: string | null`

          The IANA timezone, such as `America/Los_Angeles`.

          `minLength: 0`

      - `mode: "disabled" | "cached" | "live"`

        The source used for web search results.

        - `"disabled"`

        - `"cached"`

        - `"live"`

      - `type: "web_search"`

        The type of the object. Always `web_search`.

        - `"web_search"`

    - `PersistedAgentToolResourceComputerUse`

      Browser use in an OpenAI-hosted session.

      - `include_screenshots: boolean`

        Whether computer tool outputs include screenshots.

      - `type: "computer_use"`

        The type of the object. Always `computer_use`.

        - `"computer_use"`

    - `PersistedAgentToolResourceAutomations`

      Lets the agent manage its own scheduled wakeups.

      - `type: "automations"`

        The type of the object. Always `automations`.

        - `"automations"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the agent was last updated.

    `format: int64`

  - `compaction?: Compaction`

    The effective context compaction settings.

    - `async: boolean`

      Whether context is compacted in the background. Defaults to true.

  - `experimental?: Experimental`

    The effective experimental settings for the agent.

    - `time_awareness: boolean`

      Whether the model receives periodic current-time reminders.

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const agent = await client.beta.agents.retrieve('agent_id');

console.log(agent.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "instructions": "instructions",
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "multi_agent": {
    "enabled": true,
    "max_concurrent_subagents": 1
  },
  "name": "name",
  "object": "agent",
  "reasoning": {
    "effort": "none",
    "summary": "concise"
  },
  "service_tier": "auto",
  "text": {
    "format": {
      "type": "text"
    },
    "verbosity": "low"
  },
  "tools": [
    {
      "defer_loading": true,
      "description": "description",
      "name": "name",
      "parameters": {
        "foo": "bar"
      },
      "type": "function",
      "async": true
    }
  ],
  "updated_at": 0,
  "compaction": {
    "async": true
  },
  "experimental": {
    "time_awareness": true
  }
}
```

## Update an agent

`client.beta.agents.update(stringagentID, AgentUpdateParamsbody?, RequestOptionsoptions?): Agent`

**post** `/agents/{agent_id}`

Updates a reusable agent. See [agent configuration](/api/docs/guides/agents-api/configuration).

### Parameters

- `agentID: string`

  `minLength: 0`, `maxLength: 1048576`

- `body: AgentUpdateParams`

  - `compaction?: Compaction | null`

    Context compaction settings. Omit to keep the current settings. A supplied object replaces the settings; null or an empty object enables background compaction.

    - `async?: boolean | null`

      Whether to compact context in the background. Omission or null defaults to true. Set to false to use blocking compaction. Background compaction may increase token usage.

  - `experimental?: Experimental`

    Experimental settings to merge by key. Omitted settings keep their current values.

    - `time_awareness?: boolean`

      Whether to give the model periodic current-time reminders. Omit to keep the current setting.

  - `instructions?: string | null`

    Additional instructions appended to the agent's default base instructions. Omit to leave unchanged.

    `minLength: 0`, `maxLength: 1048576`

  - `metadata?: Record<string, string> | null`

    Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters.

  - `model?: string`

    The model to use for the agent. The requested model name is preserved.

    `minLength: 0`, `maxLength: 1048576`

  - `multi_agent?: MultiAgentConfigParam | null`

    Configuration for creating and coordinating subagents.

    - `enabled: boolean`

      Whether subagent tools are enabled.

    - `max_concurrent_subagents?: number`

      Maximum number of subagents that may run concurrently. Defaults to 6.

      `format: int64`, `minimum: 1`, `maximum: 4294967295`

  - `name?: string | null`

    A replacement name. Omit to leave unchanged, or pass null to clear it.

    `minLength: 0`, `maxLength: 128`

  - `reasoning?: AgentReasoningParam | null`

    Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort.

    - `effort?: "none" | "minimal" | "low" | 4 more | null`

      The amount of reasoning effort the model should use. Omission lets the model select it.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `summary?: "concise" | "detailed" | "auto" | null`

      Controls whether the response includes a reasoning summary.

      - `"concise"`

        Returns a concise reasoning summary when supported.

      - `"detailed"`

        Returns a detailed reasoning summary when supported.

      - `"auto"`

        Automatically selects the most detailed summary supported by the model.

  - `service_tier?: "auto" | "default" | "flex" | 3 more | null`

    The service tier used for model requests.

    - `"auto"`

      Selects the service tier automatically.

    - `"default"`

      Uses the default service tier.

    - `"flex"`

      Uses the flex service tier.

    - `"priority"`

      Uses the priority service tier.

    - `"fast"`

      Uses the fast service tier.

    - `"ultrafast"`

      Uses the ultrafast service tier.

  - `text?: AgentTextParam | null`

    Configuration for text generated by the agent.

    - `format?: TextFormatParam | null`

      The output format. Omission uses ordinary text (`{"type": "text"}`).

      - `TextFormatParamText`

        Generates ordinary text without a structured-output constraint.

        - `type: "text"`

          The type of the object. Always `text`.

          - `"text"`

      - `TextFormatParamJSONSchema`

        Constrains generated text to a JSON Schema.

        - `schema: Record<string, unknown>`

          The JSON Schema that generated text must match.

        - `type: "json_schema"`

          The type of the object. Always `json_schema`.

          - `"json_schema"`

    - `verbosity?: "low" | "medium" | "high" | null`

      The amount of text the model should produce. Defaults to `medium`, matching Responses.

      - `"low"`

        Produces less text.

      - `"medium"`

        Uses the default amount of text.

      - `"high"`

        Produces more text.

  - `tools?: Array<PersistedAgentToolParam> | null`

    Replaces the tool list. Omit to leave it unchanged, or pass null to clear it. The replacement must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON.

    `minItems: 0`, `maxItems: 2000`

    - `PersistedAgentToolConfigParamFunction`

      A function defined by the application.

      - `description: string`

        A description of what the function does.

        `minLength: 0`, `maxLength: 1048576`

      - `name: string`

        The name of the function.

        `minLength: 0`, `maxLength: 1048576`

      - `parameters: Record<string, unknown>`

        A JSON Schema object describing the function's arguments.

      - `type: "function"`

        The type of the object. Always `function`.

        - `"function"`

      - `async?: boolean`

        Whether the agent continues without waiting for the function result. Defaults to `false`.

      - `defer_loading?: boolean`

        Whether this function is deferred and discovered through tool search. Defaults to `false`.

    - `PersistedAgentToolConfigParamToolSearch`

      Discovers deferred function tools and loads them into the model context.

      - `type: "tool_search"`

        The type of the object. Always `tool_search`.

        - `"tool_search"`

    - `PersistedAgentToolConfigParamProgrammaticToolCalling`

      Enables calling tools from model-generated code.

      - `type: "programmatic_tool_calling"`

        The type of the object. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

      - `enabled?: boolean`

        Whether tools can be called from model-generated code. Defaults to `true`.

    - `PersistedAgentToolConfigParamMcp`

      Tools provided by a remote MCP server without stored credentials.

      - `server_label: string`

        A label used to identify the MCP server in tool calls.

        `minLength: 0`, `maxLength: 1048576`

      - `transport: PersistedMcpTransportParam`

        The credential-free transport used to connect to the MCP server.

        - `PersistedMcpTransportConfigParamHTTP`

          Connects to an MCP server over HTTP.

          - `server_url: string`

            The URL of the MCP server.

            `minLength: 0`, `maxLength: 1048576`

          - `type: "http"`

            The type of the object. Always `http`.

            - `"http"`

          - `headers?: Record<string, string> | null`

            Non-secret HTTP headers sent to the MCP server.

        - `PersistedMcpTransportConfigParamStdio`

          Starts an MCP server as a local process.

          - `command: string`

            The command used to start the MCP server.

            `minLength: 0`, `maxLength: 1048576`

          - `cwd: string`

            The working directory used to start the MCP server.

            `minLength: 0`, `maxLength: 1048576`

          - `type: "stdio"`

            The type of the object. Always `stdio`.

            - `"stdio"`

          - `args?: Array<string> | null`

            Arguments passed to the MCP server command.

            `minItems: 0`, `maxItems: 16384`

          - `env_vars?: Array<string> | null`

            Environment variable names to inherit from the selected execution environment.

            `minItems: 0`, `maxItems: 16384`

      - `type: "mcp"`

        The type of the object. Always `mcp`.

        - `"mcp"`

      - `allowed_tools?: Array<string> | null`

        The MCP tools the agent may call. All server tools are allowed when omitted.

        `minItems: 0`, `maxItems: 16384`

      - `connection_origin?: "service" | "environment" | null`

        Selects where outbound MCP HTTP connections originate.

        - `"service"`

          Uses the Managed Agents service network.

        - `"environment"`

          Uses the session's execution environment.

      - `credential_id?: string | null`

        The vault credential selected for this MCP server. Optional when exactly one attached credential matches the server URL.

        `minLength: 0`, `maxLength: 1048576`

      - `request_metadata?: Record<string, unknown> | null`

        Metadata included with requests to this MCP server.

      - `required?: boolean`

        Whether this MCP server must initialize before the first turn. Defaults to `false`.

    - `PersistedAgentToolConfigParamWebSearch`

      Web search.

      - `type: "web_search"`

        The type of the object. Always `web_search`.

        - `"web_search"`

      - `allowed_domains?: Array<string> | null`

        Domains the search may include.

        `minItems: 0`, `maxItems: 16384`

      - `context_size?: "low" | "medium" | "high" | null`

        The amount of search context made available to the model. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

      - `location?: Location | null`

        Approximate location used to localize search results.

        - `city?: string | null`

          The city name.

          `minLength: 0`, `maxLength: 1048576`

        - `country?: string | null`

          The two-letter ISO country code, such as `US`.

          `minLength: 0`, `maxLength: 1048576`

        - `region?: string | null`

          The region or state name.

          `minLength: 0`, `maxLength: 1048576`

        - `timezone?: string | null`

          The IANA timezone, such as `America/Los_Angeles`.

          `minLength: 0`, `maxLength: 1048576`

      - `mode?: "disabled" | "cached" | "live" | null`

        The source used for web search results. Defaults to `live`.

        - `"disabled"`

          Disables web search.

        - `"cached"`

          Uses cached search results.

        - `"live"`

          Searches the live web.

    - `PersistedAgentToolConfigParamComputerUse`

      Browser use in an OpenAI-hosted session.

      - `type: "computer_use"`

        The type of the object. Always `computer_use`.

        - `"computer_use"`

      - `include_screenshots?: boolean`

        Whether computer tool outputs include screenshots. Defaults to `false`.

    - `PersistedAgentToolConfigParamAutomations`

      Lets the agent manage its own scheduled wakeups.

      - `type: "automations"`

        The type of the object. Always `automations`.

        - `"automations"`

### Returns

- `Agent`

  A reusable agent scoped to the caller's project.

  - `id: string`

    The ID of the reusable agent.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp, in seconds, when the agent was created.

    `format: int64`

  - `instructions: string | null`

    Custom instructions appended to the agent's default base instructions.

    `minLength: 0`

  - `metadata: Record<string, string>`

    Custom string key-value pairs attached to the agent.

  - `model: string`

    The requested model name used for inference.

    `minLength: 0`

  - `multi_agent: MultiAgentConfig`

    The resolved configuration for creating and coordinating subagents.

    - `enabled: boolean`

      Whether subagent tools are enabled. Defaults to false.

    - `max_concurrent_subagents: number | null`

      Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

      `format: int64`, `minimum: 1`, `maximum: 4294967295`

  - `name: string | null`

    A human-readable name for the agent, or null if it is unnamed.

    `minLength: 0`

  - `object: "agent"`

    The object type. Always `agent`.

    - `"agent"`

  - `reasoning: AgentReasoning`

    The resolved reasoning configuration, including the model default for an omitted effort.

    - `effort: "none" | "minimal" | "low" | 4 more | null`

      The requested reasoning effort, or `null` when the model selects its own default.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `summary: "concise" | "detailed" | "auto" | null`

      The requested reasoning summary format, or `null` when summaries are disabled.

      - `"concise"`

        Returns a concise reasoning summary when supported.

      - `"detailed"`

        Returns a detailed reasoning summary when supported.

      - `"auto"`

        Automatically selects the most detailed summary supported by the model.

  - `service_tier: "auto" | "default" | "flex" | 3 more`

    The resolved service-tier policy used for model requests.

    - `"auto"`

    - `"default"`

    - `"flex"`

    - `"priority"`

    - `"fast"`

    - `"ultrafast"`

  - `text: AgentText`

    The resolved configuration for text generated by the agent.

    - `format: TextFormat`

      The effective output format. Defaults to ordinary text.

      - `TextFormatResourceText`

        Generates ordinary text without a structured-output constraint.

        - `type: "text"`

          The type of the object. Always `text`.

          - `"text"`

      - `TextFormatResourceJSONSchema`

        Constrains generated text to a JSON Schema.

        - `schema: Record<string, unknown>`

          The JSON Schema that generated text must match.

        - `type: "json_schema"`

          The type of the object. Always `json_schema`.

          - `"json_schema"`

    - `verbosity: "low" | "medium" | "high"`

      The amount of text produced by the agent. Defaults to `medium`.

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tools: Array<PersistedAgentTool>`

    Tools available to the agent.

    `minItems: 0`, `maxItems: 2000`

    - `PersistedAgentToolResourceFunction`

      A function defined by the application.

      - `defer_loading: boolean`

        Whether the function is deferred and discovered through tool search.

      - `description: string`

        A description of what the function does.

        `minLength: 0`

      - `name: string`

        The name of the function.

        `minLength: 0`

      - `parameters: Record<string, unknown>`

        A JSON Schema object describing the function's arguments.

      - `type: "function"`

        The type of the object. Always `function`.

        - `"function"`

      - `async?: boolean`

        Whether the agent continues without waiting for the function result.

    - `PersistedAgentToolResourceToolSearch`

      Discovers deferred function tools and loads them into the model context.

      - `type: "tool_search"`

        The type of the object. Always `tool_search`.

        - `"tool_search"`

    - `PersistedAgentToolResourceProgrammaticToolCalling`

      Enables calling tools from model-generated code.

      - `enabled: boolean`

        Whether tools can be called from model-generated code.

      - `type: "programmatic_tool_calling"`

        The type of the object. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `PersistedAgentToolResourceMcp`

      Tools provided by a remote MCP server without stored credentials.

      - `allowed_tools: Array<string> | null`

        The MCP tools the agent may call, or null when all server tools are allowed.

        `minItems: 0`, `maxItems: 2000`

      - `connection_origin: "service" | "environment"`

        Where outbound MCP HTTP connections originate.

        - `"service"`

        - `"environment"`

      - `credential_id: string | null`

        The vault credential selected for this MCP server, if any.

        `minLength: 0`

      - `request_metadata: Record<string, unknown>`

        Metadata included with requests to this MCP server.

      - `required: boolean`

        Whether this MCP server must initialize before the first turn.

      - `server_label: string`

        A label used to identify the MCP server in tool calls.

        `minLength: 0`

      - `transport: PersistedMcpTransport`

        The credential-free transport used to connect to the MCP server.

        - `PersistedMcpTransportResourceHTTP`

          Connects to an MCP server over HTTP.

          - `headers: Record<string, string>`

            Non-secret HTTP headers sent to the MCP server.

          - `server_url: string`

            The URL of the MCP server.

            `minLength: 0`

          - `type: "http"`

            The type of the object. Always `http`.

            - `"http"`

        - `PersistedMcpTransportResourceStdio`

          Starts an MCP server as a local process.

          - `args: Array<string>`

            Arguments passed to the MCP server command.

            `minItems: 0`, `maxItems: 2000`

          - `command: string`

            The command used to start the MCP server.

            `minLength: 0`

          - `cwd: string`

            The working directory used to start the MCP server.

            `minLength: 0`

          - `env_vars: Array<string>`

            Environment variable names inherited from the execution environment.

            `minItems: 0`, `maxItems: 2000`

          - `type: "stdio"`

            The type of the object. Always `stdio`.

            - `"stdio"`

      - `type: "mcp"`

        The type of the object. Always `mcp`.

        - `"mcp"`

    - `PersistedAgentToolResourceWebSearch`

      Web search.

      - `allowed_domains: Array<string> | null`

        Allowed search domains, or `null` when the search is unrestricted.

        `minItems: 0`, `maxItems: 2000`

      - `context_size: "low" | "medium" | "high"`

        The amount of search context made available to the model. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

      - `location: Location | null`

        Approximate location used to localize search results, if provided.

        - `city: string | null`

          The city name.

          `minLength: 0`

        - `country: string | null`

          The two-letter ISO country code, such as `US`.

          `minLength: 0`

        - `region: string | null`

          The region or state name.

          `minLength: 0`

        - `timezone: string | null`

          The IANA timezone, such as `America/Los_Angeles`.

          `minLength: 0`

      - `mode: "disabled" | "cached" | "live"`

        The source used for web search results.

        - `"disabled"`

        - `"cached"`

        - `"live"`

      - `type: "web_search"`

        The type of the object. Always `web_search`.

        - `"web_search"`

    - `PersistedAgentToolResourceComputerUse`

      Browser use in an OpenAI-hosted session.

      - `include_screenshots: boolean`

        Whether computer tool outputs include screenshots.

      - `type: "computer_use"`

        The type of the object. Always `computer_use`.

        - `"computer_use"`

    - `PersistedAgentToolResourceAutomations`

      Lets the agent manage its own scheduled wakeups.

      - `type: "automations"`

        The type of the object. Always `automations`.

        - `"automations"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the agent was last updated.

    `format: int64`

  - `compaction?: Compaction`

    The effective context compaction settings.

    - `async: boolean`

      Whether context is compacted in the background. Defaults to true.

  - `experimental?: Experimental`

    The effective experimental settings for the agent.

    - `time_awareness: boolean`

      Whether the model receives periodic current-time reminders.

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const agent = await client.beta.agents.update('agent_id');

console.log(agent.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "instructions": "instructions",
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "multi_agent": {
    "enabled": true,
    "max_concurrent_subagents": 1
  },
  "name": "name",
  "object": "agent",
  "reasoning": {
    "effort": "none",
    "summary": "concise"
  },
  "service_tier": "auto",
  "text": {
    "format": {
      "type": "text"
    },
    "verbosity": "low"
  },
  "tools": [
    {
      "defer_loading": true,
      "description": "description",
      "name": "name",
      "parameters": {
        "foo": "bar"
      },
      "type": "function",
      "async": true
    }
  ],
  "updated_at": 0,
  "compaction": {
    "async": true
  },
  "experimental": {
    "time_awareness": true
  }
}
```

### Example

```typescript
import OpenAI from "openai";

const client = new OpenAI();
const agentId = "your-agent-id";

// 1. Omit reasoning: keep its current settings while renaming the agent.
await client.beta.agents.update(agentId, { name: "Renamed" });

// 2. Send null: reset reasoning to the model's defaults.
await client.beta.agents.update(agentId, { reasoning: null });

// 3. Send an object: replace the entire reasoning configuration, without merging.
// The agent's model must support the "low" reasoning effort.
await client.beta.agents.update(agentId, { reasoning: { effort: "low" } });
```

## Domain Types

### Agent

- `Agent`

  A reusable agent scoped to the caller's project.

  - `id: string`

    The ID of the reusable agent.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp, in seconds, when the agent was created.

    `format: int64`

  - `instructions: string | null`

    Custom instructions appended to the agent's default base instructions.

    `minLength: 0`

  - `metadata: Record<string, string>`

    Custom string key-value pairs attached to the agent.

  - `model: string`

    The requested model name used for inference.

    `minLength: 0`

  - `multi_agent: MultiAgentConfig`

    The resolved configuration for creating and coordinating subagents.

    - `enabled: boolean`

      Whether subagent tools are enabled. Defaults to false.

    - `max_concurrent_subagents: number | null`

      Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

      `format: int64`, `minimum: 1`, `maximum: 4294967295`

  - `name: string | null`

    A human-readable name for the agent, or null if it is unnamed.

    `minLength: 0`

  - `object: "agent"`

    The object type. Always `agent`.

    - `"agent"`

  - `reasoning: AgentReasoning`

    The resolved reasoning configuration, including the model default for an omitted effort.

    - `effort: "none" | "minimal" | "low" | 4 more | null`

      The requested reasoning effort, or `null` when the model selects its own default.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `summary: "concise" | "detailed" | "auto" | null`

      The requested reasoning summary format, or `null` when summaries are disabled.

      - `"concise"`

        Returns a concise reasoning summary when supported.

      - `"detailed"`

        Returns a detailed reasoning summary when supported.

      - `"auto"`

        Automatically selects the most detailed summary supported by the model.

  - `service_tier: "auto" | "default" | "flex" | 3 more`

    The resolved service-tier policy used for model requests.

    - `"auto"`

    - `"default"`

    - `"flex"`

    - `"priority"`

    - `"fast"`

    - `"ultrafast"`

  - `text: AgentText`

    The resolved configuration for text generated by the agent.

    - `format: TextFormat`

      The effective output format. Defaults to ordinary text.

      - `TextFormatResourceText`

        Generates ordinary text without a structured-output constraint.

        - `type: "text"`

          The type of the object. Always `text`.

          - `"text"`

      - `TextFormatResourceJSONSchema`

        Constrains generated text to a JSON Schema.

        - `schema: Record<string, unknown>`

          The JSON Schema that generated text must match.

        - `type: "json_schema"`

          The type of the object. Always `json_schema`.

          - `"json_schema"`

    - `verbosity: "low" | "medium" | "high"`

      The amount of text produced by the agent. Defaults to `medium`.

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tools: Array<PersistedAgentTool>`

    Tools available to the agent.

    `minItems: 0`, `maxItems: 2000`

    - `PersistedAgentToolResourceFunction`

      A function defined by the application.

      - `defer_loading: boolean`

        Whether the function is deferred and discovered through tool search.

      - `description: string`

        A description of what the function does.

        `minLength: 0`

      - `name: string`

        The name of the function.

        `minLength: 0`

      - `parameters: Record<string, unknown>`

        A JSON Schema object describing the function's arguments.

      - `type: "function"`

        The type of the object. Always `function`.

        - `"function"`

      - `async?: boolean`

        Whether the agent continues without waiting for the function result.

    - `PersistedAgentToolResourceToolSearch`

      Discovers deferred function tools and loads them into the model context.

      - `type: "tool_search"`

        The type of the object. Always `tool_search`.

        - `"tool_search"`

    - `PersistedAgentToolResourceProgrammaticToolCalling`

      Enables calling tools from model-generated code.

      - `enabled: boolean`

        Whether tools can be called from model-generated code.

      - `type: "programmatic_tool_calling"`

        The type of the object. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `PersistedAgentToolResourceMcp`

      Tools provided by a remote MCP server without stored credentials.

      - `allowed_tools: Array<string> | null`

        The MCP tools the agent may call, or null when all server tools are allowed.

        `minItems: 0`, `maxItems: 2000`

      - `connection_origin: "service" | "environment"`

        Where outbound MCP HTTP connections originate.

        - `"service"`

        - `"environment"`

      - `credential_id: string | null`

        The vault credential selected for this MCP server, if any.

        `minLength: 0`

      - `request_metadata: Record<string, unknown>`

        Metadata included with requests to this MCP server.

      - `required: boolean`

        Whether this MCP server must initialize before the first turn.

      - `server_label: string`

        A label used to identify the MCP server in tool calls.

        `minLength: 0`

      - `transport: PersistedMcpTransport`

        The credential-free transport used to connect to the MCP server.

        - `PersistedMcpTransportResourceHTTP`

          Connects to an MCP server over HTTP.

          - `headers: Record<string, string>`

            Non-secret HTTP headers sent to the MCP server.

          - `server_url: string`

            The URL of the MCP server.

            `minLength: 0`

          - `type: "http"`

            The type of the object. Always `http`.

            - `"http"`

        - `PersistedMcpTransportResourceStdio`

          Starts an MCP server as a local process.

          - `args: Array<string>`

            Arguments passed to the MCP server command.

            `minItems: 0`, `maxItems: 2000`

          - `command: string`

            The command used to start the MCP server.

            `minLength: 0`

          - `cwd: string`

            The working directory used to start the MCP server.

            `minLength: 0`

          - `env_vars: Array<string>`

            Environment variable names inherited from the execution environment.

            `minItems: 0`, `maxItems: 2000`

          - `type: "stdio"`

            The type of the object. Always `stdio`.

            - `"stdio"`

      - `type: "mcp"`

        The type of the object. Always `mcp`.

        - `"mcp"`

    - `PersistedAgentToolResourceWebSearch`

      Web search.

      - `allowed_domains: Array<string> | null`

        Allowed search domains, or `null` when the search is unrestricted.

        `minItems: 0`, `maxItems: 2000`

      - `context_size: "low" | "medium" | "high"`

        The amount of search context made available to the model. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

      - `location: Location | null`

        Approximate location used to localize search results, if provided.

        - `city: string | null`

          The city name.

          `minLength: 0`

        - `country: string | null`

          The two-letter ISO country code, such as `US`.

          `minLength: 0`

        - `region: string | null`

          The region or state name.

          `minLength: 0`

        - `timezone: string | null`

          The IANA timezone, such as `America/Los_Angeles`.

          `minLength: 0`

      - `mode: "disabled" | "cached" | "live"`

        The source used for web search results.

        - `"disabled"`

        - `"cached"`

        - `"live"`

      - `type: "web_search"`

        The type of the object. Always `web_search`.

        - `"web_search"`

    - `PersistedAgentToolResourceComputerUse`

      Browser use in an OpenAI-hosted session.

      - `include_screenshots: boolean`

        Whether computer tool outputs include screenshots.

      - `type: "computer_use"`

        The type of the object. Always `computer_use`.

        - `"computer_use"`

    - `PersistedAgentToolResourceAutomations`

      Lets the agent manage its own scheduled wakeups.

      - `type: "automations"`

        The type of the object. Always `automations`.

        - `"automations"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the agent was last updated.

    `format: int64`

  - `compaction?: Compaction`

    The effective context compaction settings.

    - `async: boolean`

      Whether context is compacted in the background. Defaults to true.

  - `experimental?: Experimental`

    The effective experimental settings for the agent.

    - `time_awareness: boolean`

      Whether the model receives periodic current-time reminders.

### Agent Browser Authentication Cancel Param

- `AgentBrowserAuthenticationCancelParam`

  - `action: "cancel"`

    - `"cancel"`

  - `type: "browser_authentication"`

    - `"browser_authentication"`

### Agent Browser Authentication Submit Param

- `AgentBrowserAuthenticationSubmitParam`

  - `action: "submit"`

    - `"submit"`

  - `fields: Array<Field>`

    Values for up to six active fields in the required action. The submitted field-value mapping and selected option must fit within 120 KiB of JSON.

    `minItems: 0`, `maxItems: 6`

    - `field_id: string`

      The field ID from the required action.

      `minLength: 0`, `maxLength: 1048576`

    - `value: string`

      The value to enter into the registered control.

      `minLength: 0`, `maxLength: 16384`

  - `type: "browser_authentication"`

    - `"browser_authentication"`

  - `selected_option?: string | null`

    The chosen method. Required when the required action contains options.

    `minLength: 0`, `maxLength: 1048576`

### Agent Browser Origin Access Param

- `AgentBrowserOriginAccessParam`

  - `decision: "approve" | "deny" | "cancel"`

    Whether to allow, deny, or cancel the requested origin access.

    - `"approve"`

      Allow the browser to access this origin.

    - `"deny"`

      Deny access to this origin.

    - `"cancel"`

      Dismiss this request without approving access.

  - `type: "browser_origin_access"`

    - `"browser_origin_access"`

### Agent Close Subagent Call Item

- `AgentCloseSubagentCallItem`

  A request to close a subagent.

  - `id: string`

    The ID of the tool call item.

    `minLength: 0`

  - `recipient_agent_id: string`

    The ID of the agent to close.

    `minLength: 0`

  - `sender_agent_id: string`

    The ID of the agent requesting the close.

    `minLength: 0`

  - `status: AgentFunctionCallStatus`

    The status of the tool call.

    - `"in_progress"`

      The call is in progress.

    - `"completed"`

      The call completed successfully.

    - `"failed"`

      The call failed.

    - `"incomplete"`

      The call stopped before completing.

  - `turn_id: string`

    The ID of the turn that contains this item.

    `minLength: 0`

  - `type: "close_subagent_call"`

    The item type. Always `close_subagent_call`.

    - `"close_subagent_call"`

### Agent Command Execution Item

- `AgentCommandExecutionItem`

  A command execution produced by the agent.

  - `id: string`

    The ID of the command execution item.

    `minLength: 0`

  - `command: string`

    The command that was executed.

    `minLength: 0`

  - `cwd: string | null`

    The working directory used to execute the command.

    `minLength: 0`

  - `duration_ms: number | null`

    The command duration in milliseconds.

    `format: int64`

  - `exit_code: number | null`

    The process exit code, if the command completed.

    `format: int64`

  - `output: string | null`

    The command output, if available.

    `minLength: 0`

  - `status: AgentFunctionCallStatus`

    The status of the command execution.

    - `"in_progress"`

      The call is in progress.

    - `"completed"`

      The call completed successfully.

    - `"failed"`

      The call failed.

    - `"incomplete"`

      The call stopped before completing.

  - `turn_id: string`

    The ID of the turn that contains this item.

    `minLength: 0`

  - `type: "command_execution"`

    The item type. Always `command_execution`.

    - `"command_execution"`

### Agent Content

- `AgentContent = OutputText | EncryptedContentResource`

  A plaintext or encrypted content part exchanged between agents.

  - `OutputText`

    A text content part produced by the agent.

    - `text: string`

      The text produced by the agent.

      `minLength: 0`

    - `type: "output_text"`

      The content type. Always `output_text`.

      - `"output_text"`

  - `EncryptedContentResource`

    Encrypted content exchanged between agents.

    - `encrypted_content: string`

      The encrypted content payload.

      `minLength: 0`

    - `type: "encrypted_content"`

      The content type. Always `encrypted_content`.

      - `"encrypted_content"`

### Agent Create Subagent Call Item

- `AgentCreateSubagentCallItem`

  A request to spawn a subagent.

  - `id: string`

    The ID of the tool call item.

    `minLength: 0`

  - `agent_id: string`

    The ID of the agent that requested the subagent.

    `minLength: 0`

  - `content: Array<AgentContent>`

    The task given to the spawned agent.

    `minItems: 0`, `maxItems: 2000`

    - `OutputText`

      A text content part produced by the agent.

      - `text: string`

        The text produced by the agent.

        `minLength: 0`

      - `type: "output_text"`

        The content type. Always `output_text`.

        - `"output_text"`

    - `EncryptedContentResource`

      Encrypted content exchanged between agents.

      - `encrypted_content: string`

        The encrypted content payload.

        `minLength: 0`

      - `type: "encrypted_content"`

        The content type. Always `encrypted_content`.

        - `"encrypted_content"`

  - `model: string | null`

    The model requested for the spawned agent.

    `minLength: 0`

  - `reasoning_effort: string | null`

    The reasoning effort requested for the spawned agent.

    `minLength: 0`

  - `status: AgentFunctionCallStatus`

    The status of the tool call.

    - `"in_progress"`

      The call is in progress.

    - `"completed"`

      The call completed successfully.

    - `"failed"`

      The call failed.

    - `"incomplete"`

      The call stopped before completing.

  - `turn_id: string`

    The ID of the turn that contains this item.

    `minLength: 0`

  - `type: "create_subagent_call"`

    The item type. Always `create_subagent_call`.

    - `"create_subagent_call"`

### Agent Deleted

- `AgentDeleted`

  A deleted reusable agent.

  - `id: string`

    The ID of the deleted agent.

    `minLength: 0`

  - `deleted: boolean`

    Whether the agent was deleted. Always `true`.

  - `object: "agent.deleted"`

    The object type. Always `agent.deleted`.

    - `"agent.deleted"`

### Agent Function Call Item

- `AgentFunctionCallItem`

  A function call produced by the agent.

  - `id: string`

    The ID of the function call item.

    `minLength: 0`

  - `arguments: unknown`

    The arguments to pass to the function.

  - `call_id: string`

    The ID used to submit the function result.

    `minLength: 0`

  - `name: string`

    The name of the function to call.

    `minLength: 0`

  - `status: AgentFunctionCallStatus`

    The status of the function call.

    - `"in_progress"`

      The call is in progress.

    - `"completed"`

      The call completed successfully.

    - `"failed"`

      The call failed.

    - `"incomplete"`

      The call stopped before completing.

  - `turn_id: string`

    The ID of the turn that contains this item.

    `minLength: 0`

  - `type: "function_call"`

    The item type. Always `function_call`.

    - `"function_call"`

### Agent Function Call Output

- `AgentFunctionCallOutput = string | Array<InputContent>`

  The text or model-input content supplied as a function result.

  - `string`

  - `Array<InputContent>`

    - `InputContentResourceInputText`

      Text input recorded in a session item.

      - `text: string`

        The text supplied to the agent.

        `minLength: 0`

      - `type: "input_text"`

        The type of the object. Always `input_text`.

        - `"input_text"`

    - `InputContentResourceInputImage`

      Image input recorded in a session item.

      - `image_url: string`

        The URL of the image supplied to the agent, which may be a base64-encoded data URL.

        `minLength: 0`

      - `type: "input_image"`

        The type of the object. Always `input_image`.

        - `"input_image"`

### Agent Function Call Output Param

- `AgentFunctionCallOutputParam = string | Array<InputContentParam>`

  A function result represented as text or supported model-input content.

  - `string`

  - `Array<InputContentParam>`

    - `InputContentParamInputText`

      Text input to the model.

      - `text: string`

        The text sent to the model.

        `minLength: 0`, `maxLength: 1048576`

      - `type: "input_text"`

        The type of the object. Always `input_text`.

        - `"input_text"`

    - `InputContentParamInputImage`

      Image input to the model.

      - `image_url: string`

        The URL of the image sent to the model.

        `minLength: 0`, `maxLength: 1048576`

      - `type: "input_image"`

        The type of the object. Always `input_image`.

        - `"input_image"`

### Agent Function Call Status

- `AgentFunctionCallStatus = "in_progress" | "completed" | "failed" | "incomplete"`

  The status of a tool call.

  - `in_progress` - The call is in progress.
  - `completed` - The call completed successfully.
  - `failed` - The call failed.
  - `incomplete` - The call stopped before completing.

  - `"in_progress"`

    The call is in progress.

  - `"completed"`

    The call completed successfully.

  - `"failed"`

    The call failed.

  - `"incomplete"`

    The call stopped before completing.

### Agent Interrupt Subagent Call Item

- `AgentInterruptSubagentCallItem`

  A request to interrupt a subagent's current turn. The subagent remains available.

  - `id: string`

    The ID of the tool call item.

    `minLength: 0`

  - `recipient_agent_id: string`

    The ID of the agent to interrupt.

    `minLength: 0`

  - `sender_agent_id: string`

    The ID of the agent requesting the interrupt.

    `minLength: 0`

  - `status: AgentFunctionCallStatus`

    The status of the tool call.

    - `"in_progress"`

      The call is in progress.

    - `"completed"`

      The call completed successfully.

    - `"failed"`

      The call failed.

    - `"incomplete"`

      The call stopped before completing.

  - `turn_id: string`

    The ID of the turn that contains this item.

    `minLength: 0`

  - `type: "interrupt_subagent_call"`

    The item type. Always `interrupt_subagent_call`.

    - `"interrupt_subagent_call"`

### Agent Mcp Call Item

- `AgentMcpCallItem`

  A call to a tool on an MCP server.

  - `id: string`

    The ID of the MCP call item.

    `minLength: 0`

  - `arguments: unknown`

    The arguments passed to the MCP tool.

  - `error: unknown`

    The error returned by the MCP tool, if any.

  - `name: string`

    The name of the MCP tool.

    `minLength: 0`

  - `output: unknown`

    The output returned by the MCP tool, if any.

  - `server_label: string`

    The label of the MCP server.

    `minLength: 0`

  - `status: AgentFunctionCallStatus`

    The status of the MCP tool call.

    - `"in_progress"`

      The call is in progress.

    - `"completed"`

      The call completed successfully.

    - `"failed"`

      The call failed.

    - `"incomplete"`

      The call stopped before completing.

  - `turn_id: string`

    The ID of the turn that contains this item.

    `minLength: 0`

  - `type: "mcp_call"`

    The item type. Always `mcp_call`.

    - `"mcp_call"`

### Agent Output Command Execution Output Delta Event

- `AgentOutputCommandExecutionOutputDeltaEvent`

  Emitted when command execution produces an output delta.

  - `delta: string`

    The output text that was appended.

    `minLength: 0`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `item_id: string`

    The ID of the command execution item.

    `minLength: 0`

  - `output_index: number`

    The index of the item in the turn output.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.output.command_execution_output.delta"`

    The type of the object. Always `agent.output.command_execution_output.delta`.

    - `"agent.output.command_execution_output.delta"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Output Item

- `AgentOutputItem = AgentSessionAssistantMessage | AgentReasoningItem | AgentFunctionCallItem | 11 more`

  An output item produced by an agent.

  - `AgentSessionAssistantMessage`

    An assistant message produced by the agent.

    - `id: string`

      The ID of the message.

      `minLength: 0`

    - `content: Array<OutputText>`

      The content of the message.

      `minItems: 0`, `maxItems: 2000`

      - `text: string`

        The text produced by the agent.

        `minLength: 0`

      - `type: "output_text"`

        The content type. Always `output_text`.

        - `"output_text"`

    - `phase: "commentary" | "final_answer" | null`

      The phase of the assistant message.

      - `"commentary"`

        Commentary produced while the agent works.

      - `"final_answer"`

        The agent's final answer.

    - `role: "assistant"`

      The role of the message author. Always `assistant`.

      - `"assistant"`

    - `status: AgentOutputItemStatus`

      The status of the message.

      - `"in_progress"`

        The item is in progress.

      - `"completed"`

        The item is complete.

      - `"incomplete"`

        The item stopped before completing.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "message"`

      The item type. Always `message`.

      - `"message"`

  - `AgentReasoningItem`

    A reasoning item produced by the agent.

    - `id: string`

      The ID of the reasoning item.

      `minLength: 0`

    - `status: AgentOutputItemStatus | null`

      The status of the reasoning item.

    - `summary: Array<SummaryText>`

      The reasoning summaries produced by the agent.

      `minItems: 0`, `maxItems: 2000`

      - `text: string`

        The reasoning summary text.

        `minLength: 0`

      - `type: "summary_text"`

        The content type. Always `summary_text`.

        - `"summary_text"`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "reasoning"`

      The item type. Always `reasoning`.

      - `"reasoning"`

  - `AgentFunctionCallItem`

    A function call produced by the agent.

    - `id: string`

      The ID of the function call item.

      `minLength: 0`

    - `arguments: unknown`

      The arguments to pass to the function.

    - `call_id: string`

      The ID used to submit the function result.

      `minLength: 0`

    - `name: string`

      The name of the function to call.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the function call.

      - `"in_progress"`

        The call is in progress.

      - `"completed"`

        The call completed successfully.

      - `"failed"`

        The call failed.

      - `"incomplete"`

        The call stopped before completing.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "function_call"`

      The item type. Always `function_call`.

      - `"function_call"`

  - `AgentMcpCallItem`

    A call to a tool on an MCP server.

    - `id: string`

      The ID of the MCP call item.

      `minLength: 0`

    - `arguments: unknown`

      The arguments passed to the MCP tool.

    - `error: unknown`

      The error returned by the MCP tool, if any.

    - `name: string`

      The name of the MCP tool.

      `minLength: 0`

    - `output: unknown`

      The output returned by the MCP tool, if any.

    - `server_label: string`

      The label of the MCP server.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the MCP tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "mcp_call"`

      The item type. Always `mcp_call`.

      - `"mcp_call"`

  - `ComputerUseCallItemResource`

    One execution of the platform-provided computer-use capability.

    - `id: string`

      The ID of the activity item.

      `minLength: 0`

    - `output: Output | null`

      The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot.

      - `image_url: string`

        The complete JPEG image as a base64 data URL.

        `minLength: 0`

      - `type: "computer_screenshot"`

        The content type. Always `computer_screenshot`.

        - `"computer_screenshot"`

    - `status: AgentFunctionCallStatus`

      The execution status of the activity.

    - `title: string | null`

      A model-generated description of the activity, when available.

      `minLength: 0`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "computer_use_call"`

      The item type. Always `computer_use_call`.

      - `"computer_use_call"`

  - `BrowserAuthenticationRequestItemResource`

    A credential-free history record of the emitted login request.

    - `id: string`

      The stable history item ID.

      `minLength: 0`

    - `request: Request`

      A registered form awaiting the application's response.

      - `credential_origin: string | null`

        The registered form or frame origin where values will be entered.

        `minLength: 0`

      - `fields: Array<Field>`

        Controls to render. All submitted values are sensitive.

        `minItems: 0`, `maxItems: 2000`

        - `id: string`

          The field ID to submit as field_id in a fields entry.

          `minLength: 0`

        - `label: string`

          The label to display beside the control.

          `minLength: 0`

        - `required: boolean`

          Whether this control requires a nonempty value.

        - `type: string`

          The rendering type, such as email, password, or text.

          `minLength: 0`

      - `options: Array<Option>`

        Sign-in methods. Empty for a plain form.

        `minItems: 0`, `maxItems: 2000`

        - `id: string`

          The option ID to submit as selected_option.

          `minLength: 0`

        - `field_ids: Array<string>`

          IDs from the registered fields that this method accepts.

          `minItems: 0`, `maxItems: 2000`

        - `label: string`

          The method label to display.

          `minLength: 0`

      - `reason: string | null`

        Why the agent needs the user to sign in.

        `minLength: 0`

      - `type: "browser_authentication"`

        The type of the object. Always `browser_authentication`.

        - `"browser_authentication"`

    - `request_id: string`

      `minLength: 0`

    - `turn_id: string`

      `minLength: 0`

    - `type: "computer_use_approval_request"`

      The item type. Always computer_use_approval_request.

      - `"computer_use_approval_request"`

  - `AgentWebSearchCallItem`

    A web search call produced by the agent.

    - `id: string`

      The ID of the web search call.

      `minLength: 0`

    - `action: WebSearchAction | null`

      The action performed by the web search tool.

      - `WebSearchActionResourceSearch`

        A search query or group of search queries.

        - `queries: Array<string> | null`

          The search queries, when multiple queries were used.

          `minItems: 0`, `maxItems: 2000`

        - `query: string | null`

          The search query, when a single query was used.

          `minLength: 0`

        - `type: "search"`

          The type of the object. Always `search`.

          - `"search"`

      - `WebSearchActionResourceOpenPage`

        Opens a web page.

        - `type: "open_page"`

          The type of the object. Always `open_page`.

          - `"open_page"`

        - `url: string | null`

          The URL of the page that was opened.

          `minLength: 0`

      - `WebSearchActionResourceFindInPage`

        Finds text within a web page.

        - `pattern: string | null`

          The text pattern that was searched for.

          `minLength: 0`

        - `type: "find_in_page"`

          The type of the object. Always `find_in_page`.

          - `"find_in_page"`

        - `url: string | null`

          The URL of the page that was searched.

          `minLength: 0`

      - `WebSearchActionResourceOther`

        Another web search action.

        - `type: "other"`

          The type of the object. Always `other`.

          - `"other"`

    - `status: AgentOutputItemStatus`

      The status of the web search call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "web_search_call"`

      The item type. Always `web_search_call`.

      - `"web_search_call"`

  - `AgentCommandExecutionItem`

    A command execution produced by the agent.

    - `id: string`

      The ID of the command execution item.

      `minLength: 0`

    - `command: string`

      The command that was executed.

      `minLength: 0`

    - `cwd: string | null`

      The working directory used to execute the command.

      `minLength: 0`

    - `duration_ms: number | null`

      The command duration in milliseconds.

      `format: int64`

    - `exit_code: number | null`

      The process exit code, if the command completed.

      `format: int64`

    - `output: string | null`

      The command output, if available.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the command execution.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "command_execution"`

      The item type. Always `command_execution`.

      - `"command_execution"`

  - `AgentCreateSubagentCallItem`

    A request to spawn a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `agent_id: string`

      The ID of the agent that requested the subagent.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The task given to the spawned agent.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

          `minLength: 0`

        - `type: "output_text"`

          The content type. Always `output_text`.

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

          `minLength: 0`

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `model: string | null`

      The model requested for the spawned agent.

      `minLength: 0`

    - `reasoning_effort: string | null`

      The reasoning effort requested for the spawned agent.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "create_subagent_call"`

      The item type. Always `create_subagent_call`.

      - `"create_subagent_call"`

  - `AgentSendSubagentInputCallItem`

    A request to send input to another agent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The input sent to the receiving agent.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

    - `recipient_agent_id: string`

      The ID of the agent receiving the input.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent sending the input.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "send_subagent_input_call"`

      The item type. Always `send_subagent_input_call`.

      - `"send_subagent_input_call"`

  - `AgentResumeSubagentCallItem`

    A request to resume a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to resume.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the resume.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "resume_subagent_call"`

      The item type. Always `resume_subagent_call`.

      - `"resume_subagent_call"`

  - `AgentWaitForSubagentsCallItem`

    A request to wait for one or more subagents.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_ids: Array<string>`

      The IDs of the agents to wait for.

      `minItems: 0`, `maxItems: 2000`

    - `sender_agent_id: string`

      The ID of the agent waiting for results.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "wait_for_subagents_call"`

      The item type. Always `wait_for_subagents_call`.

      - `"wait_for_subagents_call"`

  - `AgentInterruptSubagentCallItem`

    A request to interrupt a subagent's current turn. The subagent remains available.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to interrupt.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the interrupt.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "interrupt_subagent_call"`

      The item type. Always `interrupt_subagent_call`.

      - `"interrupt_subagent_call"`

  - `AgentCloseSubagentCallItem`

    A request to close a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to close.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the close.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "close_subagent_call"`

      The item type. Always `close_subagent_call`.

      - `"close_subagent_call"`

### Agent Output Item Status

- `AgentOutputItemStatus = "in_progress" | "completed" | "incomplete"`

  The status of an agent output item.

  - `in_progress` - The item is in progress.
  - `completed` - The item is complete.
  - `incomplete` - The item stopped before completing.

  - `"in_progress"`

    The item is in progress.

  - `"completed"`

    The item is complete.

  - `"incomplete"`

    The item stopped before completing.

### Agent Reasoning

- `AgentReasoning`

  The reasoning configuration used by an agent.

  - `effort: "none" | "minimal" | "low" | 4 more | null`

    The requested reasoning effort, or `null` when the model selects its own default.

    - `"none"`

    - `"minimal"`

    - `"low"`

    - `"medium"`

    - `"high"`

    - `"xhigh"`

    - `"max"`

  - `summary: "concise" | "detailed" | "auto" | null`

    The requested reasoning summary format, or `null` when summaries are disabled.

    - `"concise"`

      Returns a concise reasoning summary when supported.

    - `"detailed"`

      Returns a detailed reasoning summary when supported.

    - `"auto"`

      Automatically selects the most detailed summary supported by the model.

### Agent Reasoning Item

- `AgentReasoningItem`

  A reasoning item produced by the agent.

  - `id: string`

    The ID of the reasoning item.

    `minLength: 0`

  - `status: AgentOutputItemStatus | null`

    The status of the reasoning item.

    - `"in_progress"`

      The item is in progress.

    - `"completed"`

      The item is complete.

    - `"incomplete"`

      The item stopped before completing.

  - `summary: Array<SummaryText>`

    The reasoning summaries produced by the agent.

    `minItems: 0`, `maxItems: 2000`

    - `text: string`

      The reasoning summary text.

      `minLength: 0`

    - `type: "summary_text"`

      The content type. Always `summary_text`.

      - `"summary_text"`

  - `turn_id: string`

    The ID of the turn that contains this item.

    `minLength: 0`

  - `type: "reasoning"`

    The item type. Always `reasoning`.

    - `"reasoning"`

### Agent Reasoning Param

- `AgentReasoningParam`

  Reasoning configuration for the agent.

  - `effort?: "none" | "minimal" | "low" | 4 more | null`

    The amount of reasoning effort the model should use. Omission lets the model select it.

    - `"none"`

    - `"minimal"`

    - `"low"`

    - `"medium"`

    - `"high"`

    - `"xhigh"`

    - `"max"`

  - `summary?: "concise" | "detailed" | "auto" | null`

    Controls whether the response includes a reasoning summary.

    - `"concise"`

      Returns a concise reasoning summary when supported.

    - `"detailed"`

      Returns a detailed reasoning summary when supported.

    - `"auto"`

      Automatically selects the most detailed summary supported by the model.

### Agent Resume Subagent Call Item

- `AgentResumeSubagentCallItem`

  A request to resume a subagent.

  - `id: string`

    The ID of the tool call item.

    `minLength: 0`

  - `recipient_agent_id: string`

    The ID of the agent to resume.

    `minLength: 0`

  - `sender_agent_id: string`

    The ID of the agent requesting the resume.

    `minLength: 0`

  - `status: AgentFunctionCallStatus`

    The status of the tool call.

    - `"in_progress"`

      The call is in progress.

    - `"completed"`

      The call completed successfully.

    - `"failed"`

      The call failed.

    - `"incomplete"`

      The call stopped before completing.

  - `turn_id: string`

    The ID of the turn that contains this item.

    `minLength: 0`

  - `type: "resume_subagent_call"`

    The item type. Always `resume_subagent_call`.

    - `"resume_subagent_call"`

### Agent Send Subagent Input Call Item

- `AgentSendSubagentInputCallItem`

  A request to send input to another agent.

  - `id: string`

    The ID of the tool call item.

    `minLength: 0`

  - `content: Array<AgentContent>`

    The input sent to the receiving agent.

    `minItems: 0`, `maxItems: 2000`

    - `OutputText`

      A text content part produced by the agent.

      - `text: string`

        The text produced by the agent.

        `minLength: 0`

      - `type: "output_text"`

        The content type. Always `output_text`.

        - `"output_text"`

    - `EncryptedContentResource`

      Encrypted content exchanged between agents.

      - `encrypted_content: string`

        The encrypted content payload.

        `minLength: 0`

      - `type: "encrypted_content"`

        The content type. Always `encrypted_content`.

        - `"encrypted_content"`

  - `recipient_agent_id: string`

    The ID of the agent receiving the input.

    `minLength: 0`

  - `sender_agent_id: string`

    The ID of the agent sending the input.

    `minLength: 0`

  - `status: AgentFunctionCallStatus`

    The status of the tool call.

    - `"in_progress"`

      The call is in progress.

    - `"completed"`

      The call completed successfully.

    - `"failed"`

      The call failed.

    - `"incomplete"`

      The call stopped before completing.

  - `turn_id: string`

    The ID of the turn that contains this item.

    `minLength: 0`

  - `type: "send_subagent_input_call"`

    The item type. Always `send_subagent_input_call`.

    - `"send_subagent_input_call"`

### Agent Session

- `AgentSession`

  A Managed Agents session.

  - `id: string`

    The ID of the session.

    `minLength: 0`

  - `agent: Agent`

    The agent running in the session.

    - `id: string`

      The ID of the agent.

      `minLength: 0`

    - `instructions: string | null`

      Custom instructions appended to the agent's default base instructions.

      `minLength: 0`

    - `model: string`

      The model used by the agent.

      `minLength: 0`

    - `multi_agent: MultiAgentConfig`

      Configuration for creating and coordinating subagents.

      - `enabled: boolean`

        Whether subagent tools are enabled. Defaults to false.

      - `max_concurrent_subagents: number | null`

        Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

        `format: int64`, `minimum: 1`, `maximum: 4294967295`

    - `name: string | null`

      The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

      `minLength: 0`

    - `reasoning: AgentReasoning`

      The agent's reasoning configuration.

      - `effort: "none" | "minimal" | "low" | 4 more | null`

        The requested reasoning effort, or `null` when the model selects its own default.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `summary: "concise" | "detailed" | "auto" | null`

        The requested reasoning summary format, or `null` when summaries are disabled.

        - `"concise"`

          Returns a concise reasoning summary when supported.

        - `"detailed"`

          Returns a detailed reasoning summary when supported.

        - `"auto"`

          Automatically selects the most detailed summary supported by the model.

    - `service_tier: "auto" | "default" | "flex" | 3 more`

      The effective service-tier policy for model requests. Defaults to `auto`.

      - `"auto"`

      - `"default"`

      - `"flex"`

      - `"priority"`

      - `"fast"`

      - `"ultrafast"`

    - `text: AgentText`

      Configuration for text generated by the agent.

      - `format: TextFormat`

        The effective output format. Defaults to ordinary text.

        - `TextFormatResourceText`

          Generates ordinary text without a structured-output constraint.

          - `type: "text"`

            The type of the object. Always `text`.

            - `"text"`

        - `TextFormatResourceJSONSchema`

          Constrains generated text to a JSON Schema.

          - `schema: Record<string, unknown>`

            The JSON Schema that generated text must match.

          - `type: "json_schema"`

            The type of the object. Always `json_schema`.

            - `"json_schema"`

      - `verbosity: "low" | "medium" | "high"`

        The amount of text produced by the agent. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tools: Array<AgentTool>`

      Tools available to the agent.

      `minItems: 0`, `maxItems: 2000`

      - `AgentToolResourceFunction`

        A function defined by the application.

        - `defer_loading: boolean`

          Whether the function is deferred and discovered through tool search.

        - `description: string`

          A description of what the function does.

          `minLength: 0`

        - `name: string`

          The name of the function.

          `minLength: 0`

        - `parameters: Record<string, unknown>`

          A JSON Schema object describing the function's arguments.

        - `type: "function"`

          The type of the object. Always `function`.

          - `"function"`

        - `async?: boolean`

          Whether the agent continues without waiting for the function result.

      - `AgentToolResourceProgrammaticToolCalling`

        Enables calling tools from model-generated code.

        - `enabled: boolean`

          Whether tools can be called from model-generated code.

        - `type: "programmatic_tool_calling"`

          The type of the object. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `AgentToolResourceMcp`

        Tools provided by a remote MCP server.

        - `allowed_tools: Array<string> | null`

          The MCP tools the agent may call.

          `minItems: 0`, `maxItems: 2000`

        - `connection_origin: "service" | "environment"`

          Where outbound MCP HTTP connections originate.

          - `"service"`

          - `"environment"`

        - `credential_id: string | null`

          The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

          `minLength: 0`

        - `request_metadata: Record<string, unknown>`

          Metadata included with requests to this MCP server.

        - `required: boolean`

          Whether this MCP server must initialize before the first turn.

        - `server_label: string`

          A label used to identify the MCP server in tool calls.

          `minLength: 0`

        - `transport: McpTransport`

          The transport used to connect to the MCP server.

          - `McpTransportResourceHTTP`

            Connects to an MCP server over HTTP.

            - `server_url: string`

              The URL of the MCP server.

              `minLength: 0`

            - `type: "http"`

              The type of the object. Always `http`.

              - `"http"`

          - `McpTransportResourceStdio`

            Starts an MCP server as a local process.

            - `args: Array<string>`

              Arguments passed to the MCP server command.

              `minItems: 0`, `maxItems: 2000`

            - `command: string`

              The command used to start the MCP server.

              `minLength: 0`

            - `cwd: string`

              The working directory used to start the MCP server.

              `minLength: 0`

            - `env_vars: Array<string>`

              Environment variable names inherited from the execution environment.

              `minItems: 0`, `maxItems: 2000`

            - `type: "stdio"`

              The type of the object. Always `stdio`.

              - `"stdio"`

        - `type: "mcp"`

          The type of the object. Always `mcp`.

          - `"mcp"`

      - `AgentToolResourceWebSearch`

        Web search.

        - `allowed_domains: Array<string> | null`

          Allowed search domains, or `null` when the search is unrestricted.

          `minItems: 0`, `maxItems: 2000`

        - `context_size: "low" | "medium" | "high"`

          The amount of search context made available to the model. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `location: Location | null`

          Approximate location used to localize search results, if provided.

          - `city: string | null`

            The city name.

            `minLength: 0`

          - `country: string | null`

            The two-letter ISO country code, such as `US`.

            `minLength: 0`

          - `region: string | null`

            The region or state name.

            `minLength: 0`

          - `timezone: string | null`

            The IANA timezone, such as `America/Los_Angeles`.

            `minLength: 0`

        - `mode: "disabled" | "cached" | "live"`

          The source used for web search results.

          - `"disabled"`

          - `"cached"`

          - `"live"`

        - `type: "web_search"`

          The type of the object. Always `web_search`.

          - `"web_search"`

      - `AgentToolResourceComputerUse`

        Browser use in an OpenAI-hosted session.

        - `include_screenshots: boolean`

          Whether computer tool outputs include screenshots.

        - `type: "computer_use"`

          The type of the object. Always `computer_use`.

          - `"computer_use"`

      - `AgentToolResourceAutomations`

        Lets the agent manage its own scheduled wakeups.

        - `type: "automations"`

          The type of the object. Always `automations`.

          - `"automations"`

    - `compaction?: Compaction`

      The effective context compaction settings.

      - `async: boolean`

        Whether context is compacted in the background. Defaults to true.

    - `experimental?: Experimental`

      The effective experimental settings for the agent.

      - `time_awareness: boolean`

        Whether the model receives periodic current-time reminders.

  - `created_at: number`

    The Unix timestamp, in seconds, when the session was created.

    `format: int64`

  - `environment: Environment`

    The execution environment for the session.

    - `EnvironmentResourceNone`

      The session talks to CCA without selecting or provisioning an execution environment.

      - `type: "none"`

        The type of the object. Always `none`.

        - `"none"`

    - `EnvironmentResourceOpenAIHosted`

      An environment hosted by OpenAI.

      - `id: string`

        The public ID of the environment.

        `minLength: 0`

      - `capability_directories: Array<string>`

        Directories that contain capabilities exposed to the agent.

        `minItems: 0`, `maxItems: 2000`

      - `files: Array<HostedEnvironmentFile>`

        Files available in the environment, excluding their contents.

        `minItems: 0`, `maxItems: 50`

        - `HostedEnvironmentFileID`

          A file copied from the OpenAI Files API.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

            `minLength: 0`

          - `file_id: string`

            The ID of the uploaded file.

            `minLength: 0`

          - `path: string`

            The file's absolute path inside the environment.

            `minLength: 0`

          - `size_bytes: number`

            The decoded file size in bytes.

            `format: int64`, `minimum: 0`

          - `type: "file_id"`

            The type of the object. Always `file_id`.

            - `"file_id"`

        - `HostedEnvironmentFileResourceInline`

          A file supplied inline when the session was created.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

            `minLength: 0`

          - `path: string`

            The file's absolute path inside the environment.

            `minLength: 0`

          - `size_bytes: number`

            The decoded file size in bytes.

            `format: int64`, `minimum: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `network: Network`

        The effective network access policy for the environment.

        - `access: "enabled" | "disabled" | "restricted"`

          The environment's network access mode.

          - `"enabled"`

            Allows unrestricted network access.

          - `"disabled"`

            Disables network access.

          - `"restricted"`

            Applies the configured domain restrictions.

        - `allowed_domains: Array<string>`

          Domains the environment may access when network access is restricted.

          `minItems: 0`, `maxItems: 2000`

      - `packages: Packages`

        Packages installed in the environment.

        - `npm: Array<string>`

          npm packages installed globally in the environment.

          `minItems: 0`, `maxItems: 16384`

        - `python: Array<string>`

          Python packages installed in the environment.

          `minItems: 0`, `maxItems: 16384`

        - `system: Array<string>`

          System packages installed in the environment.

          `minItems: 0`, `maxItems: 16384`

      - `plugins: Array<HostedPlugin>`

        Plugins installed in the environment, excluding their archive contents.

        `minItems: 0`, `maxItems: 2000`

        - `description: string`

          The installed plugin description.

          `minLength: 0`

        - `name: string`

          The installed plugin name.

          `minLength: 0`

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

      - `skills: Array<HostedSkill>`

        Skills installed in the environment, excluding their archive contents.

        `minItems: 0`, `maxItems: 2000`

        - `HostedSkillReference`

          A skill installed from the Skills API.

          - `description: string`

            The installed skill description.

            `minLength: 0`

          - `name: string`

            The installed skill name.

            `minLength: 0`

          - `skill_id: string`

            The referenced skill ID.

            `minLength: 0`

          - `type: "skill_reference"`

            The type of the object. Always `skill_reference`.

            - `"skill_reference"`

          - `version: string`

            The concrete skill version installed for this session.

            `minLength: 0`

        - `HostedSkillResourceInline`

          A skill installed from an inline ZIP archive.

          - `description: string`

            The installed skill description.

            `minLength: 0`

          - `name: string`

            The installed skill name.

            `minLength: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `type: "openai_hosted"`

        The type of the object. Always `openai_hosted`.

        - `"openai_hosted"`

      - `container_size?: "small" | "medium" | "large" | null`

        The effective CPU and memory tier, or null when unknown or outside the public tiers.

        - `"small"`

        - `"medium"`

        - `"large"`

      - `desktop?: Desktop`

        The effective desktop configuration.

        - `enabled: boolean`

          Whether the environment provisions a desktop and browser proxy.

    - `EnvironmentResourceSelfHosted`

      An environment hosted by the application.

      - `id: string`

        The public ID of the environment.

        `minLength: 0`

      - `capability_directories: Array<string>`

        Directories that contain capabilities exposed to the agent.

        `minItems: 0`, `maxItems: 2000`

      - `remote_url: string`

        Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

        `minLength: 0`

      - `type: "self_hosted"`

        The type of the object. Always `self_hosted`.

        - `"self_hosted"`

      - `workspace_directory: string`

        The absolute project directory inside the environment. Defaults to `/workspace`.

        `minLength: 0`

  - `error: string | null`

    The error that caused the session to fail, if any.

    `minLength: 0`

  - `last_active_at: number`

    The Unix timestamp, in seconds, when the session was last active.

    `format: int64`

  - `metadata: Record<string, string>`

    Custom string key-value pairs attached to the session.

  - `object: "agent.session"`

    The object type. Always `agent.session`.

    - `"agent.session"`

  - `required_actions: Array<SessionRequiredActionResourceComputerUseApprovalRequest | SessionRequiredActionResourceFunctionCall | SessionRequiredActionResourceEnvironmentConnection>`

    Actions that must be completed before the session can continue.

    `minItems: 0`, `maxItems: 2000`

    - `SessionRequiredActionResourceComputerUseApprovalRequest`

      Respond to a computer-use request.

      - `request: ComputerUseApprovalRequestKindResourceBrowserAuthentication | ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

        The information needed to render the request.

        - `ComputerUseApprovalRequestKindResourceBrowserAuthentication`

          A registered form awaiting the application's response.

          - `credential_origin: string | null`

            The registered form or frame origin where values will be entered.

            `minLength: 0`

          - `fields: Array<Field>`

            Controls to render. All submitted values are sensitive.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The field ID to submit as field_id in a fields entry.

              `minLength: 0`

            - `label: string`

              The label to display beside the control.

              `minLength: 0`

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

              `minLength: 0`

          - `options: Array<Option>`

            Sign-in methods. Empty for a plain form.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The option ID to submit as selected_option.

              `minLength: 0`

            - `field_ids: Array<string>`

              IDs from the registered fields that this method accepts.

              `minItems: 0`, `maxItems: 2000`

            - `label: string`

              The method label to display.

              `minLength: 0`

          - `reason: string | null`

            Why the agent needs the user to sign in.

            `minLength: 0`

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

          A browser origin awaiting the application's approval decision.

          - `origin: string`

            The origin the browser needs permission to access.

            `minLength: 0`

          - `reason: string | null`

            The browser's explanation for this request, or null when unavailable.

            `minLength: 0`

          - `type: "browser_origin_access"`

            The type of the object. Always `browser_origin_access`.

            - `"browser_origin_access"`

      - `request_id: string`

        The registered request ID to echo when responding.

        `minLength: 0`

      - `turn_id: string`

        The turn that requested approval.

        `minLength: 0`

      - `type: "computer_use_approval_request"`

        The type of the object. Always `computer_use_approval_request`.

        - `"computer_use_approval_request"`

    - `SessionRequiredActionResourceFunctionCall`

      Run a function tool and submit its result.

      - `arguments: unknown`

        The arguments supplied by the model.

      - `call_id: string`

        The ID to include when submitting the function result.

        `minLength: 0`

      - `name: string`

        The function name.

        `minLength: 0`

      - `turn_id: string`

        The ID of the turn that requested the function call.

        `minLength: 0`

      - `type: "function_call"`

        The type of the object. Always `function_call`.

        - `"function_call"`

    - `SessionRequiredActionResourceEnvironmentConnection`

      Reconnect a session environment.

      - `environment_id: string`

        The ID of the environment to reconnect.

        `minLength: 0`

      - `type: "environment_connection"`

        The type of the object. Always `environment_connection`.

        - `"environment_connection"`

  - `status: "idle" | "in_progress" | "requires_action" | "failed"`

    The current status of the session.

    - `"idle"`

      The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

    - `"in_progress"`

      The session is processing a turn.

    - `"requires_action"`

      The session is waiting for one or more required actions.

    - `"failed"`

      The session failed.

  - `usage: TokenUsage | null`

    Best-effort token usage for the session, or null if unknown. Recorded usage may change.

    - `input_tokens: number`

      The number of input tokens used by the agent.

      `format: int64`

    - `input_tokens_details: InputTokensDetails`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

        `format: int64`

    - `output_tokens: number`

      The number of output tokens generated by the agent.

      `format: int64`

    - `output_tokens_details: OutputTokensDetails`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

        `format: int64`

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

      `format: int64`

  - `vault_ids: Array<string>`

    The IDs of vaults made available to the session.

    `minItems: 0`, `maxItems: 2000`

  - `prompt_cache_options?: PromptCacheOptions | null`

    Default prompt cache lifetime for turns in this session, when configured.

    - `ttl: "30m" | "12h"`

      - `"30m"`

      - `"12h"`

  - `review?: "none" | "auto_review"`

    Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none.

    - `"none"`

    - `"auto_review"`

  - `spend_control?: SpendControl`

    Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object.

    - `consumed: number | null`

      Best-effort recorded spend floored to whole USD cents, or null when unavailable.

      `minimum: 0`

    - `limit: number`

      The configured positive limit in USD cents.

      `format: int64`, `minimum: 1`, `maximum: 4503599627370495`

### Agent Session Assistant Message

- `AgentSessionAssistantMessage`

  An assistant message produced by the agent.

  - `id: string`

    The ID of the message.

    `minLength: 0`

  - `content: Array<OutputText>`

    The content of the message.

    `minItems: 0`, `maxItems: 2000`

    - `text: string`

      The text produced by the agent.

      `minLength: 0`

    - `type: "output_text"`

      The content type. Always `output_text`.

      - `"output_text"`

  - `phase: "commentary" | "final_answer" | null`

    The phase of the assistant message.

    - `"commentary"`

      Commentary produced while the agent works.

    - `"final_answer"`

      The agent's final answer.

  - `role: "assistant"`

    The role of the message author. Always `assistant`.

    - `"assistant"`

  - `status: AgentOutputItemStatus`

    The status of the message.

    - `"in_progress"`

      The item is in progress.

    - `"completed"`

      The item is complete.

    - `"incomplete"`

      The item stopped before completing.

  - `turn_id: string`

    The ID of the turn that contains this item.

    `minLength: 0`

  - `type: "message"`

    The item type. Always `message`.

    - `"message"`

### Agent Session Created Event

- `AgentSessionCreatedEvent`

  Emitted when a session is created.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session: AgentSession`

    The session that was created.

    - `id: string`

      The ID of the session.

      `minLength: 0`

    - `agent: Agent`

      The agent running in the session.

      - `id: string`

        The ID of the agent.

        `minLength: 0`

      - `instructions: string | null`

        Custom instructions appended to the agent's default base instructions.

        `minLength: 0`

      - `model: string`

        The model used by the agent.

        `minLength: 0`

      - `multi_agent: MultiAgentConfig`

        Configuration for creating and coordinating subagents.

        - `enabled: boolean`

          Whether subagent tools are enabled. Defaults to false.

        - `max_concurrent_subagents: number | null`

          Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

          `format: int64`, `minimum: 1`, `maximum: 4294967295`

      - `name: string | null`

        The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

        `minLength: 0`

      - `reasoning: AgentReasoning`

        The agent's reasoning configuration.

        - `effort: "none" | "minimal" | "low" | 4 more | null`

          The requested reasoning effort, or `null` when the model selects its own default.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

        - `summary: "concise" | "detailed" | "auto" | null`

          The requested reasoning summary format, or `null` when summaries are disabled.

          - `"concise"`

            Returns a concise reasoning summary when supported.

          - `"detailed"`

            Returns a detailed reasoning summary when supported.

          - `"auto"`

            Automatically selects the most detailed summary supported by the model.

      - `service_tier: "auto" | "default" | "flex" | 3 more`

        The effective service-tier policy for model requests. Defaults to `auto`.

        - `"auto"`

        - `"default"`

        - `"flex"`

        - `"priority"`

        - `"fast"`

        - `"ultrafast"`

      - `text: AgentText`

        Configuration for text generated by the agent.

        - `format: TextFormat`

          The effective output format. Defaults to ordinary text.

          - `TextFormatResourceText`

            Generates ordinary text without a structured-output constraint.

            - `type: "text"`

              The type of the object. Always `text`.

              - `"text"`

          - `TextFormatResourceJSONSchema`

            Constrains generated text to a JSON Schema.

            - `schema: Record<string, unknown>`

              The JSON Schema that generated text must match.

            - `type: "json_schema"`

              The type of the object. Always `json_schema`.

              - `"json_schema"`

        - `verbosity: "low" | "medium" | "high"`

          The amount of text produced by the agent. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

      - `tools: Array<AgentTool>`

        Tools available to the agent.

        `minItems: 0`, `maxItems: 2000`

        - `AgentToolResourceFunction`

          A function defined by the application.

          - `defer_loading: boolean`

            Whether the function is deferred and discovered through tool search.

          - `description: string`

            A description of what the function does.

            `minLength: 0`

          - `name: string`

            The name of the function.

            `minLength: 0`

          - `parameters: Record<string, unknown>`

            A JSON Schema object describing the function's arguments.

          - `type: "function"`

            The type of the object. Always `function`.

            - `"function"`

          - `async?: boolean`

            Whether the agent continues without waiting for the function result.

        - `AgentToolResourceProgrammaticToolCalling`

          Enables calling tools from model-generated code.

          - `enabled: boolean`

            Whether tools can be called from model-generated code.

          - `type: "programmatic_tool_calling"`

            The type of the object. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `AgentToolResourceMcp`

          Tools provided by a remote MCP server.

          - `allowed_tools: Array<string> | null`

            The MCP tools the agent may call.

            `minItems: 0`, `maxItems: 2000`

          - `connection_origin: "service" | "environment"`

            Where outbound MCP HTTP connections originate.

            - `"service"`

            - `"environment"`

          - `credential_id: string | null`

            The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

            `minLength: 0`

          - `request_metadata: Record<string, unknown>`

            Metadata included with requests to this MCP server.

          - `required: boolean`

            Whether this MCP server must initialize before the first turn.

          - `server_label: string`

            A label used to identify the MCP server in tool calls.

            `minLength: 0`

          - `transport: McpTransport`

            The transport used to connect to the MCP server.

            - `McpTransportResourceHTTP`

              Connects to an MCP server over HTTP.

              - `server_url: string`

                The URL of the MCP server.

                `minLength: 0`

              - `type: "http"`

                The type of the object. Always `http`.

                - `"http"`

            - `McpTransportResourceStdio`

              Starts an MCP server as a local process.

              - `args: Array<string>`

                Arguments passed to the MCP server command.

                `minItems: 0`, `maxItems: 2000`

              - `command: string`

                The command used to start the MCP server.

                `minLength: 0`

              - `cwd: string`

                The working directory used to start the MCP server.

                `minLength: 0`

              - `env_vars: Array<string>`

                Environment variable names inherited from the execution environment.

                `minItems: 0`, `maxItems: 2000`

              - `type: "stdio"`

                The type of the object. Always `stdio`.

                - `"stdio"`

          - `type: "mcp"`

            The type of the object. Always `mcp`.

            - `"mcp"`

        - `AgentToolResourceWebSearch`

          Web search.

          - `allowed_domains: Array<string> | null`

            Allowed search domains, or `null` when the search is unrestricted.

            `minItems: 0`, `maxItems: 2000`

          - `context_size: "low" | "medium" | "high"`

            The amount of search context made available to the model. Defaults to `medium`.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `location: Location | null`

            Approximate location used to localize search results, if provided.

            - `city: string | null`

              The city name.

              `minLength: 0`

            - `country: string | null`

              The two-letter ISO country code, such as `US`.

              `minLength: 0`

            - `region: string | null`

              The region or state name.

              `minLength: 0`

            - `timezone: string | null`

              The IANA timezone, such as `America/Los_Angeles`.

              `minLength: 0`

          - `mode: "disabled" | "cached" | "live"`

            The source used for web search results.

            - `"disabled"`

            - `"cached"`

            - `"live"`

          - `type: "web_search"`

            The type of the object. Always `web_search`.

            - `"web_search"`

        - `AgentToolResourceComputerUse`

          Browser use in an OpenAI-hosted session.

          - `include_screenshots: boolean`

            Whether computer tool outputs include screenshots.

          - `type: "computer_use"`

            The type of the object. Always `computer_use`.

            - `"computer_use"`

        - `AgentToolResourceAutomations`

          Lets the agent manage its own scheduled wakeups.

          - `type: "automations"`

            The type of the object. Always `automations`.

            - `"automations"`

      - `compaction?: Compaction`

        The effective context compaction settings.

        - `async: boolean`

          Whether context is compacted in the background. Defaults to true.

      - `experimental?: Experimental`

        The effective experimental settings for the agent.

        - `time_awareness: boolean`

          Whether the model receives periodic current-time reminders.

    - `created_at: number`

      The Unix timestamp, in seconds, when the session was created.

      `format: int64`

    - `environment: Environment`

      The execution environment for the session.

      - `EnvironmentResourceNone`

        The session talks to CCA without selecting or provisioning an execution environment.

        - `type: "none"`

          The type of the object. Always `none`.

          - `"none"`

      - `EnvironmentResourceOpenAIHosted`

        An environment hosted by OpenAI.

        - `id: string`

          The public ID of the environment.

          `minLength: 0`

        - `capability_directories: Array<string>`

          Directories that contain capabilities exposed to the agent.

          `minItems: 0`, `maxItems: 2000`

        - `files: Array<HostedEnvironmentFile>`

          Files available in the environment, excluding their contents.

          `minItems: 0`, `maxItems: 50`

          - `HostedEnvironmentFileID`

            A file copied from the OpenAI Files API.

            - `id: string`

              The session-scoped ID of the file in the execution environment.

              `minLength: 0`

            - `file_id: string`

              The ID of the uploaded file.

              `minLength: 0`

            - `path: string`

              The file's absolute path inside the environment.

              `minLength: 0`

            - `size_bytes: number`

              The decoded file size in bytes.

              `format: int64`, `minimum: 0`

            - `type: "file_id"`

              The type of the object. Always `file_id`.

              - `"file_id"`

          - `HostedEnvironmentFileResourceInline`

            A file supplied inline when the session was created.

            - `id: string`

              The session-scoped ID of the file in the execution environment.

              `minLength: 0`

            - `path: string`

              The file's absolute path inside the environment.

              `minLength: 0`

            - `size_bytes: number`

              The decoded file size in bytes.

              `format: int64`, `minimum: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `network: Network`

          The effective network access policy for the environment.

          - `access: "enabled" | "disabled" | "restricted"`

            The environment's network access mode.

            - `"enabled"`

              Allows unrestricted network access.

            - `"disabled"`

              Disables network access.

            - `"restricted"`

              Applies the configured domain restrictions.

          - `allowed_domains: Array<string>`

            Domains the environment may access when network access is restricted.

            `minItems: 0`, `maxItems: 2000`

        - `packages: Packages`

          Packages installed in the environment.

          - `npm: Array<string>`

            npm packages installed globally in the environment.

            `minItems: 0`, `maxItems: 16384`

          - `python: Array<string>`

            Python packages installed in the environment.

            `minItems: 0`, `maxItems: 16384`

          - `system: Array<string>`

            System packages installed in the environment.

            `minItems: 0`, `maxItems: 16384`

        - `plugins: Array<HostedPlugin>`

          Plugins installed in the environment, excluding their archive contents.

          `minItems: 0`, `maxItems: 2000`

          - `description: string`

            The installed plugin description.

            `minLength: 0`

          - `name: string`

            The installed plugin name.

            `minLength: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

        - `skills: Array<HostedSkill>`

          Skills installed in the environment, excluding their archive contents.

          `minItems: 0`, `maxItems: 2000`

          - `HostedSkillReference`

            A skill installed from the Skills API.

            - `description: string`

              The installed skill description.

              `minLength: 0`

            - `name: string`

              The installed skill name.

              `minLength: 0`

            - `skill_id: string`

              The referenced skill ID.

              `minLength: 0`

            - `type: "skill_reference"`

              The type of the object. Always `skill_reference`.

              - `"skill_reference"`

            - `version: string`

              The concrete skill version installed for this session.

              `minLength: 0`

          - `HostedSkillResourceInline`

            A skill installed from an inline ZIP archive.

            - `description: string`

              The installed skill description.

              `minLength: 0`

            - `name: string`

              The installed skill name.

              `minLength: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `type: "openai_hosted"`

          The type of the object. Always `openai_hosted`.

          - `"openai_hosted"`

        - `container_size?: "small" | "medium" | "large" | null`

          The effective CPU and memory tier, or null when unknown or outside the public tiers.

          - `"small"`

          - `"medium"`

          - `"large"`

        - `desktop?: Desktop`

          The effective desktop configuration.

          - `enabled: boolean`

            Whether the environment provisions a desktop and browser proxy.

      - `EnvironmentResourceSelfHosted`

        An environment hosted by the application.

        - `id: string`

          The public ID of the environment.

          `minLength: 0`

        - `capability_directories: Array<string>`

          Directories that contain capabilities exposed to the agent.

          `minItems: 0`, `maxItems: 2000`

        - `remote_url: string`

          Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

          `minLength: 0`

        - `type: "self_hosted"`

          The type of the object. Always `self_hosted`.

          - `"self_hosted"`

        - `workspace_directory: string`

          The absolute project directory inside the environment. Defaults to `/workspace`.

          `minLength: 0`

    - `error: string | null`

      The error that caused the session to fail, if any.

      `minLength: 0`

    - `last_active_at: number`

      The Unix timestamp, in seconds, when the session was last active.

      `format: int64`

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the session.

    - `object: "agent.session"`

      The object type. Always `agent.session`.

      - `"agent.session"`

    - `required_actions: Array<SessionRequiredActionResourceComputerUseApprovalRequest | SessionRequiredActionResourceFunctionCall | SessionRequiredActionResourceEnvironmentConnection>`

      Actions that must be completed before the session can continue.

      `minItems: 0`, `maxItems: 2000`

      - `SessionRequiredActionResourceComputerUseApprovalRequest`

        Respond to a computer-use request.

        - `request: ComputerUseApprovalRequestKindResourceBrowserAuthentication | ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

          The information needed to render the request.

          - `ComputerUseApprovalRequestKindResourceBrowserAuthentication`

            A registered form awaiting the application's response.

            - `credential_origin: string | null`

              The registered form or frame origin where values will be entered.

              `minLength: 0`

            - `fields: Array<Field>`

              Controls to render. All submitted values are sensitive.

              `minItems: 0`, `maxItems: 2000`

              - `id: string`

                The field ID to submit as field_id in a fields entry.

                `minLength: 0`

              - `label: string`

                The label to display beside the control.

                `minLength: 0`

              - `required: boolean`

                Whether this control requires a nonempty value.

              - `type: string`

                The rendering type, such as email, password, or text.

                `minLength: 0`

            - `options: Array<Option>`

              Sign-in methods. Empty for a plain form.

              `minItems: 0`, `maxItems: 2000`

              - `id: string`

                The option ID to submit as selected_option.

                `minLength: 0`

              - `field_ids: Array<string>`

                IDs from the registered fields that this method accepts.

                `minItems: 0`, `maxItems: 2000`

              - `label: string`

                The method label to display.

                `minLength: 0`

            - `reason: string | null`

              Why the agent needs the user to sign in.

              `minLength: 0`

            - `type: "browser_authentication"`

              The type of the object. Always `browser_authentication`.

              - `"browser_authentication"`

          - `ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

            A browser origin awaiting the application's approval decision.

            - `origin: string`

              The origin the browser needs permission to access.

              `minLength: 0`

            - `reason: string | null`

              The browser's explanation for this request, or null when unavailable.

              `minLength: 0`

            - `type: "browser_origin_access"`

              The type of the object. Always `browser_origin_access`.

              - `"browser_origin_access"`

        - `request_id: string`

          The registered request ID to echo when responding.

          `minLength: 0`

        - `turn_id: string`

          The turn that requested approval.

          `minLength: 0`

        - `type: "computer_use_approval_request"`

          The type of the object. Always `computer_use_approval_request`.

          - `"computer_use_approval_request"`

      - `SessionRequiredActionResourceFunctionCall`

        Run a function tool and submit its result.

        - `arguments: unknown`

          The arguments supplied by the model.

        - `call_id: string`

          The ID to include when submitting the function result.

          `minLength: 0`

        - `name: string`

          The function name.

          `minLength: 0`

        - `turn_id: string`

          The ID of the turn that requested the function call.

          `minLength: 0`

        - `type: "function_call"`

          The type of the object. Always `function_call`.

          - `"function_call"`

      - `SessionRequiredActionResourceEnvironmentConnection`

        Reconnect a session environment.

        - `environment_id: string`

          The ID of the environment to reconnect.

          `minLength: 0`

        - `type: "environment_connection"`

          The type of the object. Always `environment_connection`.

          - `"environment_connection"`

    - `status: "idle" | "in_progress" | "requires_action" | "failed"`

      The current status of the session.

      - `"idle"`

        The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

      - `"in_progress"`

        The session is processing a turn.

      - `"requires_action"`

        The session is waiting for one or more required actions.

      - `"failed"`

        The session failed.

    - `usage: TokenUsage | null`

      Best-effort token usage for the session, or null if unknown. Recorded usage may change.

      - `input_tokens: number`

        The number of input tokens used by the agent.

        `format: int64`

      - `input_tokens_details: InputTokensDetails`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

          `format: int64`

      - `output_tokens: number`

        The number of output tokens generated by the agent.

        `format: int64`

      - `output_tokens_details: OutputTokensDetails`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

          `format: int64`

      - `total_tokens: number`

        The total number of input and output tokens used by the agent.

        `format: int64`

    - `vault_ids: Array<string>`

      The IDs of vaults made available to the session.

      `minItems: 0`, `maxItems: 2000`

    - `prompt_cache_options?: PromptCacheOptions | null`

      Default prompt cache lifetime for turns in this session, when configured.

      - `ttl: "30m" | "12h"`

        - `"30m"`

        - `"12h"`

    - `review?: "none" | "auto_review"`

      Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none.

      - `"none"`

      - `"auto_review"`

    - `spend_control?: SpendControl`

      Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object.

      - `consumed: number | null`

        Best-effort recorded spend floored to whole USD cents, or null when unavailable.

        `minimum: 0`

      - `limit: number`

        The configured positive limit in USD cents.

        `format: int64`, `minimum: 1`, `maximum: 4503599627370495`

  - `type: "agent.session.created"`

    The type of the object. Always `agent.session.created`.

    - `"agent.session.created"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Deleted

- `AgentSessionDeleted`

  A Managed Agents session removed from the public API. Physical cleanup may continue asynchronously.

  - `id: string`

    The ID of the deleted session.

    `minLength: 0`

  - `deleted: boolean`

    Whether the session has been removed from the public API. Always `true`. Physical cleanup may still be in progress.

  - `object: "agent.session.deleted"`

    The object type. Always `agent.session.deleted`.

    - `"agent.session.deleted"`

### Agent Session Environment Connected Event

- `AgentSessionEnvironmentConnectedEvent`

  Emitted when a session environment connects.

  - `environment: AgentSessionEnvironmentState`

    The current environment state.

    - `id: string`

      The public ID of the environment.

      `minLength: 0`

    - `error: Error | null`

      The error reported while preparing the environment, if any.

      - `code: string`

        A machine-readable error code.

        `minLength: 0`

      - `message: string`

        A human-readable error message.

        `minLength: 0`

      - `type: string`

        The error type.

        `minLength: 0`

    - `status: "pending" | "ready" | "connected" | 4 more`

      The environment's connection status.

      - `"pending"`

        The environment is being prepared.

      - `"ready"`

        The environment is ready to connect.

      - `"connected"`

        The environment is connected.

      - `"disconnected"`

        The environment is disconnected.

      - `"suspended"`

        The environment is stopped and can be resumed from its private checkpoint.

      - `"expired"`

        The environment and its private checkpoint have expired.

      - `"failed"`

        The environment failed to connect.

    - `type: string`

      The environment type.

      `minLength: 0`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.environment.connected"`

    The type of the object. Always `agent.session.environment.connected`.

    - `"agent.session.environment.connected"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Environment Disconnected Event

- `AgentSessionEnvironmentDisconnectedEvent`

  Emitted when a session environment disconnects.

  - `environment: AgentSessionEnvironmentState`

    The current environment state.

    - `id: string`

      The public ID of the environment.

      `minLength: 0`

    - `error: Error | null`

      The error reported while preparing the environment, if any.

      - `code: string`

        A machine-readable error code.

        `minLength: 0`

      - `message: string`

        A human-readable error message.

        `minLength: 0`

      - `type: string`

        The error type.

        `minLength: 0`

    - `status: "pending" | "ready" | "connected" | 4 more`

      The environment's connection status.

      - `"pending"`

        The environment is being prepared.

      - `"ready"`

        The environment is ready to connect.

      - `"connected"`

        The environment is connected.

      - `"disconnected"`

        The environment is disconnected.

      - `"suspended"`

        The environment is stopped and can be resumed from its private checkpoint.

      - `"expired"`

        The environment and its private checkpoint have expired.

      - `"failed"`

        The environment failed to connect.

    - `type: string`

      The environment type.

      `minLength: 0`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.environment.disconnected"`

    The type of the object. Always `agent.session.environment.disconnected`.

    - `"agent.session.environment.disconnected"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Environment Expired Event

- `AgentSessionEnvironmentExpiredEvent`

  Emitted after a suspended hosted session environment and its checkpoint expire.

  - `environment: AgentSessionEnvironmentState`

    The current environment state.

    - `id: string`

      The public ID of the environment.

      `minLength: 0`

    - `error: Error | null`

      The error reported while preparing the environment, if any.

      - `code: string`

        A machine-readable error code.

        `minLength: 0`

      - `message: string`

        A human-readable error message.

        `minLength: 0`

      - `type: string`

        The error type.

        `minLength: 0`

    - `status: "pending" | "ready" | "connected" | 4 more`

      The environment's connection status.

      - `"pending"`

        The environment is being prepared.

      - `"ready"`

        The environment is ready to connect.

      - `"connected"`

        The environment is connected.

      - `"disconnected"`

        The environment is disconnected.

      - `"suspended"`

        The environment is stopped and can be resumed from its private checkpoint.

      - `"expired"`

        The environment and its private checkpoint have expired.

      - `"failed"`

        The environment failed to connect.

    - `type: string`

      The environment type.

      `minLength: 0`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.environment.expired"`

    The type of the object. Always `agent.session.environment.expired`.

    - `"agent.session.environment.expired"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Environment Failed Event

- `AgentSessionEnvironmentFailedEvent`

  Emitted when a session environment fails.

  - `environment: AgentSessionEnvironmentState`

    The current environment state.

    - `id: string`

      The public ID of the environment.

      `minLength: 0`

    - `error: Error | null`

      The error reported while preparing the environment, if any.

      - `code: string`

        A machine-readable error code.

        `minLength: 0`

      - `message: string`

        A human-readable error message.

        `minLength: 0`

      - `type: string`

        The error type.

        `minLength: 0`

    - `status: "pending" | "ready" | "connected" | 4 more`

      The environment's connection status.

      - `"pending"`

        The environment is being prepared.

      - `"ready"`

        The environment is ready to connect.

      - `"connected"`

        The environment is connected.

      - `"disconnected"`

        The environment is disconnected.

      - `"suspended"`

        The environment is stopped and can be resumed from its private checkpoint.

      - `"expired"`

        The environment and its private checkpoint have expired.

      - `"failed"`

        The environment failed to connect.

    - `type: string`

      The environment type.

      `minLength: 0`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.environment.failed"`

    The type of the object. Always `agent.session.environment.failed`.

    - `"agent.session.environment.failed"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Environment Pending Event

- `AgentSessionEnvironmentPendingEvent`

  Emitted while a session environment is being prepared.

  - `environment: AgentSessionEnvironmentState`

    The current environment state.

    - `id: string`

      The public ID of the environment.

      `minLength: 0`

    - `error: Error | null`

      The error reported while preparing the environment, if any.

      - `code: string`

        A machine-readable error code.

        `minLength: 0`

      - `message: string`

        A human-readable error message.

        `minLength: 0`

      - `type: string`

        The error type.

        `minLength: 0`

    - `status: "pending" | "ready" | "connected" | 4 more`

      The environment's connection status.

      - `"pending"`

        The environment is being prepared.

      - `"ready"`

        The environment is ready to connect.

      - `"connected"`

        The environment is connected.

      - `"disconnected"`

        The environment is disconnected.

      - `"suspended"`

        The environment is stopped and can be resumed from its private checkpoint.

      - `"expired"`

        The environment and its private checkpoint have expired.

      - `"failed"`

        The environment failed to connect.

    - `type: string`

      The environment type.

      `minLength: 0`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.environment.pending"`

    The type of the object. Always `agent.session.environment.pending`.

    - `"agent.session.environment.pending"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Environment Ready Event

- `AgentSessionEnvironmentReadyEvent`

  Emitted when a hosted session environment is ready to connect.

  - `environment: AgentSessionEnvironmentState`

    The current environment state.

    - `id: string`

      The public ID of the environment.

      `minLength: 0`

    - `error: Error | null`

      The error reported while preparing the environment, if any.

      - `code: string`

        A machine-readable error code.

        `minLength: 0`

      - `message: string`

        A human-readable error message.

        `minLength: 0`

      - `type: string`

        The error type.

        `minLength: 0`

    - `status: "pending" | "ready" | "connected" | 4 more`

      The environment's connection status.

      - `"pending"`

        The environment is being prepared.

      - `"ready"`

        The environment is ready to connect.

      - `"connected"`

        The environment is connected.

      - `"disconnected"`

        The environment is disconnected.

      - `"suspended"`

        The environment is stopped and can be resumed from its private checkpoint.

      - `"expired"`

        The environment and its private checkpoint have expired.

      - `"failed"`

        The environment failed to connect.

    - `type: string`

      The environment type.

      `minLength: 0`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.environment.ready"`

    The type of the object. Always `agent.session.environment.ready`.

    - `"agent.session.environment.ready"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Environment Reset Event

- `AgentSessionEnvironmentResetEvent`

  Emitted after a hosted sandbox is replaced. Conversation history survives; changes to the previous sandbox's files and processes do not.

  - `environment_id: string`

    The stable environment ID, retained across sandbox replacements.

    `minLength: 0`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `reset_count: number`

    Monotonically increasing reset number. Repeated notifications share this number.

    `format: int64`, `minimum: 0`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn_id: string | null`

    The associated turn, when applicable.

    `minLength: 0`

  - `type: "agent.session.environment.reset"`

    The type of the object. Always `agent.session.environment.reset`.

    - `"agent.session.environment.reset"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Environment State

- `AgentSessionEnvironmentState`

  The current state of a session environment.

  - `id: string`

    The public ID of the environment.

    `minLength: 0`

  - `error: Error | null`

    The error reported while preparing the environment, if any.

    - `code: string`

      A machine-readable error code.

      `minLength: 0`

    - `message: string`

      A human-readable error message.

      `minLength: 0`

    - `type: string`

      The error type.

      `minLength: 0`

  - `status: "pending" | "ready" | "connected" | 4 more`

    The environment's connection status.

    - `"pending"`

      The environment is being prepared.

    - `"ready"`

      The environment is ready to connect.

    - `"connected"`

      The environment is connected.

    - `"disconnected"`

      The environment is disconnected.

    - `"suspended"`

      The environment is stopped and can be resumed from its private checkpoint.

    - `"expired"`

      The environment and its private checkpoint have expired.

    - `"failed"`

      The environment failed to connect.

  - `type: string`

    The environment type.

    `minLength: 0`

### Agent Session Environment Suspended Event

- `AgentSessionEnvironmentSuspendedEvent`

  Emitted after an idle hosted session environment is checkpointed and stopped.

  - `environment: AgentSessionEnvironmentState`

    The current environment state.

    - `id: string`

      The public ID of the environment.

      `minLength: 0`

    - `error: Error | null`

      The error reported while preparing the environment, if any.

      - `code: string`

        A machine-readable error code.

        `minLength: 0`

      - `message: string`

        A human-readable error message.

        `minLength: 0`

      - `type: string`

        The error type.

        `minLength: 0`

    - `status: "pending" | "ready" | "connected" | 4 more`

      The environment's connection status.

      - `"pending"`

        The environment is being prepared.

      - `"ready"`

        The environment is ready to connect.

      - `"connected"`

        The environment is connected.

      - `"disconnected"`

        The environment is disconnected.

      - `"suspended"`

        The environment is stopped and can be resumed from its private checkpoint.

      - `"expired"`

        The environment and its private checkpoint have expired.

      - `"failed"`

        The environment failed to connect.

    - `type: string`

      The environment type.

      `minLength: 0`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.environment.suspended"`

    The type of the object. Always `agent.session.environment.suspended`.

    - `"agent.session.environment.suspended"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Error Event

- `AgentSessionErrorEvent`

  Emitted when a turn or session fails.

  - `error: SessionError`

    The error that occurred.

    - `code: string | null`

      The machine-readable error code, if any.

      `minLength: 0`

    - `message: string`

      A customer-safe explanation of the error.

      `minLength: 0`

    - `param: string | null`

      The request parameter associated with the error, if any.

      `minLength: 0`

    - `type: string`

      The error type.

      `minLength: 0`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `type: "error"`

    The type of the object. Always `error`.

    - `"error"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Event

- `AgentSessionEvent = AgentSessionErrorEvent | AgentSessionEnvironmentReadyEvent | AgentSessionEnvironmentSuspendedEvent | 30 more`

  An event emitted by a Managed Agents session.

  - `AgentSessionErrorEvent`

    Emitted when a turn or session fails.

    - `error: SessionError`

      The error that occurred.

      - `code: string | null`

        The machine-readable error code, if any.

        `minLength: 0`

      - `message: string`

        A customer-safe explanation of the error.

        `minLength: 0`

      - `param: string | null`

        The request parameter associated with the error, if any.

        `minLength: 0`

      - `type: string`

        The error type.

        `minLength: 0`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `type: "error"`

      The type of the object. Always `error`.

      - `"error"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentReadyEvent`

    Emitted when a hosted session environment is ready to connect.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

      - `id: string`

        The public ID of the environment.

        `minLength: 0`

      - `error: Error | null`

        The error reported while preparing the environment, if any.

        - `code: string`

          A machine-readable error code.

          `minLength: 0`

        - `message: string`

          A human-readable error message.

          `minLength: 0`

        - `type: string`

          The error type.

          `minLength: 0`

      - `status: "pending" | "ready" | "connected" | 4 more`

        The environment's connection status.

        - `"pending"`

          The environment is being prepared.

        - `"ready"`

          The environment is ready to connect.

        - `"connected"`

          The environment is connected.

        - `"disconnected"`

          The environment is disconnected.

        - `"suspended"`

          The environment is stopped and can be resumed from its private checkpoint.

        - `"expired"`

          The environment and its private checkpoint have expired.

        - `"failed"`

          The environment failed to connect.

      - `type: string`

        The environment type.

        `minLength: 0`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.ready"`

      The type of the object. Always `agent.session.environment.ready`.

      - `"agent.session.environment.ready"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentSuspendedEvent`

    Emitted after an idle hosted session environment is checkpointed and stopped.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.suspended"`

      The type of the object. Always `agent.session.environment.suspended`.

      - `"agent.session.environment.suspended"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentExpiredEvent`

    Emitted after a suspended hosted session environment and its checkpoint expire.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.expired"`

      The type of the object. Always `agent.session.environment.expired`.

      - `"agent.session.environment.expired"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentResetEvent`

    Emitted after a hosted sandbox is replaced. Conversation history survives; changes to the previous sandbox's files and processes do not.

    - `environment_id: string`

      The stable environment ID, retained across sandbox replacements.

      `minLength: 0`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `reset_count: number`

      Monotonically increasing reset number. Repeated notifications share this number.

      `format: int64`, `minimum: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The associated turn, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.reset"`

      The type of the object. Always `agent.session.environment.reset`.

      - `"agent.session.environment.reset"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentOutputCommandExecutionOutputDeltaEvent`

    Emitted when command execution produces an output delta.

    - `delta: string`

      The output text that was appended.

      `minLength: 0`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the command execution item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.output.command_execution_output.delta"`

      The type of the object. Always `agent.output.command_execution_output.delta`.

      - `"agent.output.command_execution_output.delta"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionCreatedEvent`

    Emitted when a session is created.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session: AgentSession`

      The session that was created.

      - `id: string`

        The ID of the session.

        `minLength: 0`

      - `agent: Agent`

        The agent running in the session.

        - `id: string`

          The ID of the agent.

          `minLength: 0`

        - `instructions: string | null`

          Custom instructions appended to the agent's default base instructions.

          `minLength: 0`

        - `model: string`

          The model used by the agent.

          `minLength: 0`

        - `multi_agent: MultiAgentConfig`

          Configuration for creating and coordinating subagents.

          - `enabled: boolean`

            Whether subagent tools are enabled. Defaults to false.

          - `max_concurrent_subagents: number | null`

            Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

            `format: int64`, `minimum: 1`, `maximum: 4294967295`

        - `name: string | null`

          The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

          `minLength: 0`

        - `reasoning: AgentReasoning`

          The agent's reasoning configuration.

          - `effort: "none" | "minimal" | "low" | 4 more | null`

            The requested reasoning effort, or `null` when the model selects its own default.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

          - `summary: "concise" | "detailed" | "auto" | null`

            The requested reasoning summary format, or `null` when summaries are disabled.

            - `"concise"`

              Returns a concise reasoning summary when supported.

            - `"detailed"`

              Returns a detailed reasoning summary when supported.

            - `"auto"`

              Automatically selects the most detailed summary supported by the model.

        - `service_tier: "auto" | "default" | "flex" | 3 more`

          The effective service-tier policy for model requests. Defaults to `auto`.

          - `"auto"`

          - `"default"`

          - `"flex"`

          - `"priority"`

          - `"fast"`

          - `"ultrafast"`

        - `text: AgentText`

          Configuration for text generated by the agent.

          - `format: TextFormat`

            The effective output format. Defaults to ordinary text.

            - `TextFormatResourceText`

              Generates ordinary text without a structured-output constraint.

              - `type: "text"`

                The type of the object. Always `text`.

                - `"text"`

            - `TextFormatResourceJSONSchema`

              Constrains generated text to a JSON Schema.

              - `schema: Record<string, unknown>`

                The JSON Schema that generated text must match.

              - `type: "json_schema"`

                The type of the object. Always `json_schema`.

                - `"json_schema"`

          - `verbosity: "low" | "medium" | "high"`

            The amount of text produced by the agent. Defaults to `medium`.

            - `"low"`

            - `"medium"`

            - `"high"`

        - `tools: Array<AgentTool>`

          Tools available to the agent.

          `minItems: 0`, `maxItems: 2000`

          - `AgentToolResourceFunction`

            A function defined by the application.

            - `defer_loading: boolean`

              Whether the function is deferred and discovered through tool search.

            - `description: string`

              A description of what the function does.

              `minLength: 0`

            - `name: string`

              The name of the function.

              `minLength: 0`

            - `parameters: Record<string, unknown>`

              A JSON Schema object describing the function's arguments.

            - `type: "function"`

              The type of the object. Always `function`.

              - `"function"`

            - `async?: boolean`

              Whether the agent continues without waiting for the function result.

          - `AgentToolResourceProgrammaticToolCalling`

            Enables calling tools from model-generated code.

            - `enabled: boolean`

              Whether tools can be called from model-generated code.

            - `type: "programmatic_tool_calling"`

              The type of the object. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `AgentToolResourceMcp`

            Tools provided by a remote MCP server.

            - `allowed_tools: Array<string> | null`

              The MCP tools the agent may call.

              `minItems: 0`, `maxItems: 2000`

            - `connection_origin: "service" | "environment"`

              Where outbound MCP HTTP connections originate.

              - `"service"`

              - `"environment"`

            - `credential_id: string | null`

              The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

              `minLength: 0`

            - `request_metadata: Record<string, unknown>`

              Metadata included with requests to this MCP server.

            - `required: boolean`

              Whether this MCP server must initialize before the first turn.

            - `server_label: string`

              A label used to identify the MCP server in tool calls.

              `minLength: 0`

            - `transport: McpTransport`

              The transport used to connect to the MCP server.

              - `McpTransportResourceHTTP`

                Connects to an MCP server over HTTP.

                - `server_url: string`

                  The URL of the MCP server.

                  `minLength: 0`

                - `type: "http"`

                  The type of the object. Always `http`.

                  - `"http"`

              - `McpTransportResourceStdio`

                Starts an MCP server as a local process.

                - `args: Array<string>`

                  Arguments passed to the MCP server command.

                  `minItems: 0`, `maxItems: 2000`

                - `command: string`

                  The command used to start the MCP server.

                  `minLength: 0`

                - `cwd: string`

                  The working directory used to start the MCP server.

                  `minLength: 0`

                - `env_vars: Array<string>`

                  Environment variable names inherited from the execution environment.

                  `minItems: 0`, `maxItems: 2000`

                - `type: "stdio"`

                  The type of the object. Always `stdio`.

                  - `"stdio"`

            - `type: "mcp"`

              The type of the object. Always `mcp`.

              - `"mcp"`

          - `AgentToolResourceWebSearch`

            Web search.

            - `allowed_domains: Array<string> | null`

              Allowed search domains, or `null` when the search is unrestricted.

              `minItems: 0`, `maxItems: 2000`

            - `context_size: "low" | "medium" | "high"`

              The amount of search context made available to the model. Defaults to `medium`.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `location: Location | null`

              Approximate location used to localize search results, if provided.

              - `city: string | null`

                The city name.

                `minLength: 0`

              - `country: string | null`

                The two-letter ISO country code, such as `US`.

                `minLength: 0`

              - `region: string | null`

                The region or state name.

                `minLength: 0`

              - `timezone: string | null`

                The IANA timezone, such as `America/Los_Angeles`.

                `minLength: 0`

            - `mode: "disabled" | "cached" | "live"`

              The source used for web search results.

              - `"disabled"`

              - `"cached"`

              - `"live"`

            - `type: "web_search"`

              The type of the object. Always `web_search`.

              - `"web_search"`

          - `AgentToolResourceComputerUse`

            Browser use in an OpenAI-hosted session.

            - `include_screenshots: boolean`

              Whether computer tool outputs include screenshots.

            - `type: "computer_use"`

              The type of the object. Always `computer_use`.

              - `"computer_use"`

          - `AgentToolResourceAutomations`

            Lets the agent manage its own scheduled wakeups.

            - `type: "automations"`

              The type of the object. Always `automations`.

              - `"automations"`

        - `compaction?: Compaction`

          The effective context compaction settings.

          - `async: boolean`

            Whether context is compacted in the background. Defaults to true.

        - `experimental?: Experimental`

          The effective experimental settings for the agent.

          - `time_awareness: boolean`

            Whether the model receives periodic current-time reminders.

      - `created_at: number`

        The Unix timestamp, in seconds, when the session was created.

        `format: int64`

      - `environment: Environment`

        The execution environment for the session.

        - `EnvironmentResourceNone`

          The session talks to CCA without selecting or provisioning an execution environment.

          - `type: "none"`

            The type of the object. Always `none`.

            - `"none"`

        - `EnvironmentResourceOpenAIHosted`

          An environment hosted by OpenAI.

          - `id: string`

            The public ID of the environment.

            `minLength: 0`

          - `capability_directories: Array<string>`

            Directories that contain capabilities exposed to the agent.

            `minItems: 0`, `maxItems: 2000`

          - `files: Array<HostedEnvironmentFile>`

            Files available in the environment, excluding their contents.

            `minItems: 0`, `maxItems: 50`

            - `HostedEnvironmentFileID`

              A file copied from the OpenAI Files API.

              - `id: string`

                The session-scoped ID of the file in the execution environment.

                `minLength: 0`

              - `file_id: string`

                The ID of the uploaded file.

                `minLength: 0`

              - `path: string`

                The file's absolute path inside the environment.

                `minLength: 0`

              - `size_bytes: number`

                The decoded file size in bytes.

                `format: int64`, `minimum: 0`

              - `type: "file_id"`

                The type of the object. Always `file_id`.

                - `"file_id"`

            - `HostedEnvironmentFileResourceInline`

              A file supplied inline when the session was created.

              - `id: string`

                The session-scoped ID of the file in the execution environment.

                `minLength: 0`

              - `path: string`

                The file's absolute path inside the environment.

                `minLength: 0`

              - `size_bytes: number`

                The decoded file size in bytes.

                `format: int64`, `minimum: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

          - `network: Network`

            The effective network access policy for the environment.

            - `access: "enabled" | "disabled" | "restricted"`

              The environment's network access mode.

              - `"enabled"`

                Allows unrestricted network access.

              - `"disabled"`

                Disables network access.

              - `"restricted"`

                Applies the configured domain restrictions.

            - `allowed_domains: Array<string>`

              Domains the environment may access when network access is restricted.

              `minItems: 0`, `maxItems: 2000`

          - `packages: Packages`

            Packages installed in the environment.

            - `npm: Array<string>`

              npm packages installed globally in the environment.

              `minItems: 0`, `maxItems: 16384`

            - `python: Array<string>`

              Python packages installed in the environment.

              `minItems: 0`, `maxItems: 16384`

            - `system: Array<string>`

              System packages installed in the environment.

              `minItems: 0`, `maxItems: 16384`

          - `plugins: Array<HostedPlugin>`

            Plugins installed in the environment, excluding their archive contents.

            `minItems: 0`, `maxItems: 2000`

            - `description: string`

              The installed plugin description.

              `minLength: 0`

            - `name: string`

              The installed plugin name.

              `minLength: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

          - `skills: Array<HostedSkill>`

            Skills installed in the environment, excluding their archive contents.

            `minItems: 0`, `maxItems: 2000`

            - `HostedSkillReference`

              A skill installed from the Skills API.

              - `description: string`

                The installed skill description.

                `minLength: 0`

              - `name: string`

                The installed skill name.

                `minLength: 0`

              - `skill_id: string`

                The referenced skill ID.

                `minLength: 0`

              - `type: "skill_reference"`

                The type of the object. Always `skill_reference`.

                - `"skill_reference"`

              - `version: string`

                The concrete skill version installed for this session.

                `minLength: 0`

            - `HostedSkillResourceInline`

              A skill installed from an inline ZIP archive.

              - `description: string`

                The installed skill description.

                `minLength: 0`

              - `name: string`

                The installed skill name.

                `minLength: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

          - `type: "openai_hosted"`

            The type of the object. Always `openai_hosted`.

            - `"openai_hosted"`

          - `container_size?: "small" | "medium" | "large" | null`

            The effective CPU and memory tier, or null when unknown or outside the public tiers.

            - `"small"`

            - `"medium"`

            - `"large"`

          - `desktop?: Desktop`

            The effective desktop configuration.

            - `enabled: boolean`

              Whether the environment provisions a desktop and browser proxy.

        - `EnvironmentResourceSelfHosted`

          An environment hosted by the application.

          - `id: string`

            The public ID of the environment.

            `minLength: 0`

          - `capability_directories: Array<string>`

            Directories that contain capabilities exposed to the agent.

            `minItems: 0`, `maxItems: 2000`

          - `remote_url: string`

            Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

            `minLength: 0`

          - `type: "self_hosted"`

            The type of the object. Always `self_hosted`.

            - `"self_hosted"`

          - `workspace_directory: string`

            The absolute project directory inside the environment. Defaults to `/workspace`.

            `minLength: 0`

      - `error: string | null`

        The error that caused the session to fail, if any.

        `minLength: 0`

      - `last_active_at: number`

        The Unix timestamp, in seconds, when the session was last active.

        `format: int64`

      - `metadata: Record<string, string>`

        Custom string key-value pairs attached to the session.

      - `object: "agent.session"`

        The object type. Always `agent.session`.

        - `"agent.session"`

      - `required_actions: Array<SessionRequiredActionResourceComputerUseApprovalRequest | SessionRequiredActionResourceFunctionCall | SessionRequiredActionResourceEnvironmentConnection>`

        Actions that must be completed before the session can continue.

        `minItems: 0`, `maxItems: 2000`

        - `SessionRequiredActionResourceComputerUseApprovalRequest`

          Respond to a computer-use request.

          - `request: ComputerUseApprovalRequestKindResourceBrowserAuthentication | ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

            The information needed to render the request.

            - `ComputerUseApprovalRequestKindResourceBrowserAuthentication`

              A registered form awaiting the application's response.

              - `credential_origin: string | null`

                The registered form or frame origin where values will be entered.

                `minLength: 0`

              - `fields: Array<Field>`

                Controls to render. All submitted values are sensitive.

                `minItems: 0`, `maxItems: 2000`

                - `id: string`

                  The field ID to submit as field_id in a fields entry.

                  `minLength: 0`

                - `label: string`

                  The label to display beside the control.

                  `minLength: 0`

                - `required: boolean`

                  Whether this control requires a nonempty value.

                - `type: string`

                  The rendering type, such as email, password, or text.

                  `minLength: 0`

              - `options: Array<Option>`

                Sign-in methods. Empty for a plain form.

                `minItems: 0`, `maxItems: 2000`

                - `id: string`

                  The option ID to submit as selected_option.

                  `minLength: 0`

                - `field_ids: Array<string>`

                  IDs from the registered fields that this method accepts.

                  `minItems: 0`, `maxItems: 2000`

                - `label: string`

                  The method label to display.

                  `minLength: 0`

              - `reason: string | null`

                Why the agent needs the user to sign in.

                `minLength: 0`

              - `type: "browser_authentication"`

                The type of the object. Always `browser_authentication`.

                - `"browser_authentication"`

            - `ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

              A browser origin awaiting the application's approval decision.

              - `origin: string`

                The origin the browser needs permission to access.

                `minLength: 0`

              - `reason: string | null`

                The browser's explanation for this request, or null when unavailable.

                `minLength: 0`

              - `type: "browser_origin_access"`

                The type of the object. Always `browser_origin_access`.

                - `"browser_origin_access"`

          - `request_id: string`

            The registered request ID to echo when responding.

            `minLength: 0`

          - `turn_id: string`

            The turn that requested approval.

            `minLength: 0`

          - `type: "computer_use_approval_request"`

            The type of the object. Always `computer_use_approval_request`.

            - `"computer_use_approval_request"`

        - `SessionRequiredActionResourceFunctionCall`

          Run a function tool and submit its result.

          - `arguments: unknown`

            The arguments supplied by the model.

          - `call_id: string`

            The ID to include when submitting the function result.

            `minLength: 0`

          - `name: string`

            The function name.

            `minLength: 0`

          - `turn_id: string`

            The ID of the turn that requested the function call.

            `minLength: 0`

          - `type: "function_call"`

            The type of the object. Always `function_call`.

            - `"function_call"`

        - `SessionRequiredActionResourceEnvironmentConnection`

          Reconnect a session environment.

          - `environment_id: string`

            The ID of the environment to reconnect.

            `minLength: 0`

          - `type: "environment_connection"`

            The type of the object. Always `environment_connection`.

            - `"environment_connection"`

      - `status: "idle" | "in_progress" | "requires_action" | "failed"`

        The current status of the session.

        - `"idle"`

          The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

        - `"in_progress"`

          The session is processing a turn.

        - `"requires_action"`

          The session is waiting for one or more required actions.

        - `"failed"`

          The session failed.

      - `usage: TokenUsage | null`

        Best-effort token usage for the session, or null if unknown. Recorded usage may change.

        - `input_tokens: number`

          The number of input tokens used by the agent.

          `format: int64`

        - `input_tokens_details: InputTokensDetails`

          A breakdown of the agent's input token usage.

          - `cached_tokens: number`

            The number of input tokens retrieved from the prompt cache.

            `format: int64`

        - `output_tokens: number`

          The number of output tokens generated by the agent.

          `format: int64`

        - `output_tokens_details: OutputTokensDetails`

          A breakdown of the agent's output token usage.

          - `reasoning_tokens: number`

            The number of output tokens used for reasoning.

            `format: int64`

        - `total_tokens: number`

          The total number of input and output tokens used by the agent.

          `format: int64`

      - `vault_ids: Array<string>`

        The IDs of vaults made available to the session.

        `minItems: 0`, `maxItems: 2000`

      - `prompt_cache_options?: PromptCacheOptions | null`

        Default prompt cache lifetime for turns in this session, when configured.

        - `ttl: "30m" | "12h"`

          - `"30m"`

          - `"12h"`

      - `review?: "none" | "auto_review"`

        Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none.

        - `"none"`

        - `"auto_review"`

      - `spend_control?: SpendControl`

        Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object.

        - `consumed: number | null`

          Best-effort recorded spend floored to whole USD cents, or null when unavailable.

          `minimum: 0`

        - `limit: number`

          The configured positive limit in USD cents.

          `format: int64`, `minimum: 1`, `maximum: 4503599627370495`

    - `type: "agent.session.created"`

      The type of the object. Always `agent.session.created`.

      - `"agent.session.created"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnCreatedEvent`

    Emitted when a turn is created.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn: Turn`

      The turn at the time it was created.

      - `id: string`

        The ID of the turn.

        `minLength: 0`

      - `agent_id: string`

        The ID of the agent that ran the turn.

        `minLength: 0`

      - `completed_at: number | null`

        The Unix timestamp, in seconds, when the turn reached a terminal state.

        `format: int64`

      - `created_at: number`

        The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

        `format: int64`

      - `error: SessionTurnError | null`

        A customer-safe error. Non-null only for a failed turn.

        - `code: "context_length_exceeded" | "max_output_tokens" | "session_budget_exceeded" | 21 more`

          A stable, machine-readable failure category.

          - `"context_length_exceeded"`

            The request exceeds the model's context window.

          - `"max_output_tokens"`

            The model reached its output token limit before finishing the response.

          - `"session_budget_exceeded"`

            The session has reached its usage budget.

          - `"usage_limit_exceeded"`

            The organization has reached a usage, plan, or billing limit.

          - `"project_spend_limit_exceeded"`

            The project has reached its enforced spend limit.

          - `"organization_spend_limit_exceeded"`

            The organization has reached its enforced spend limit.

          - `"organization_usage_limit_exceeded"`

            The organization has reached its OpenAI-assigned usage limit.

          - `"billing_not_active"`

            Billing is not active for the account.

          - `"credit_balance_exhausted"`

            The organization has no API credits remaining.

          - `"rate_limit_exceeded"`

            The request exceeds the available rate limit.

          - `"flex_unavailable"`

            Flex processing is temporarily unavailable.

          - `"server_overloaded"`

            The model service is temporarily overloaded.

          - `"cyber_policy"`

            The request was rejected by a safety policy.

          - `"misalignment_policy_violation"`

            The request was blocked by the safety systems.

          - `"connection_failed"`

            The request could not connect to the model service.

          - `"server_error"`

            The model service encountered an unexpected error.

          - `"authentication_error"`

            The API credentials are invalid or lack the required access.

          - `"invalid_request"`

            The request contains invalid input or configuration.

          - `"resource_not_found"`

            The requested model or resource is unavailable.

          - `"sandbox_error"`

            The request could not complete in its execution environment.

          - `"executor_version_incompatible"`

            The executor must be upgraded before it can run this turn.

          - `"active_turn_not_steerable"`

            The session cannot accept additional input while a request is running.

          - `"request_timeout"`

            The request timed out before the model service responded.

          - `"internal_error"`

            An unexpected internal error prevented the session request from completing.

        - `message: string`

          A customer-safe explanation of the failure.

          `minLength: 0`

      - `object: "agent.session.turn"`

        The object type. Always `agent.session.turn`.

        - `"agent.session.turn"`

      - `session_id: string`

        The ID of the session that owns the turn.

        `minLength: 0`

      - `started_at: number | null`

        The Unix timestamp, in seconds, when the turn started.

        `format: int64`

      - `status: "queued" | "in_progress" | "waiting" | 3 more`

        The current status of the turn.

        - `"queued"`

          The turn is waiting to start.

        - `"in_progress"`

          The turn is in progress.

        - `"waiting"`

          The turn is waiting for external input.

        - `"completed"`

          The turn completed successfully.

        - `"failed"`

          The turn failed.

        - `"cancelled"`

          The turn was cancelled.

      - `subagent_id: string | null`

        The ID of the subagent that ran the turn, if applicable.

        `minLength: 0`

      - `usage: TokenUsage | null`

        Best-effort token usage for the turn, or null if unknown. Recorded usage may change.

      - `prompt_cache_options?: PromptCacheOptions | null`

        Prompt cache lifetime selected when this turn started, including an inherited session TTL. Null when the turn used the model default or no TTL was recorded.

        - `ttl: "30m" | "12h"`

          - `"30m"`

          - `"12h"`

    - `turn_id: string`

      The ID of the turn associated with the event.

      `minLength: 0`

    - `type: "agent.session.turn.created"`

      The type of the object. Always `agent.session.turn.created`.

      - `"agent.session.turn.created"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnInProgressEvent`

    Emitted when a turn starts running.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn: Turn`

      The turn at the time it started running.

    - `turn_id: string`

      The ID of the turn associated with the event.

      `minLength: 0`

    - `type: "agent.session.turn.in_progress"`

      The type of the object. Always `agent.session.turn.in_progress`.

      - `"agent.session.turn.in_progress"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnCompletedEvent`

    Emitted when a turn completes.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn: Turn`

      The completed turn.

    - `turn_id: string`

      The ID of the turn associated with the event.

      `minLength: 0`

    - `type: "agent.session.turn.completed"`

      The type of the object. Always `agent.session.turn.completed`.

      - `"agent.session.turn.completed"`

    - `usage: TokenUsage | null`

      Token usage by the root agent during the turn, when available.

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnFailedEvent`

    Emitted when a turn fails.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn: Turn`

      The failed turn.

    - `turn_id: string`

      The ID of the turn associated with the event.

      `minLength: 0`

    - `type: "agent.session.turn.failed"`

      The type of the object. Always `agent.session.turn.failed`.

      - `"agent.session.turn.failed"`

    - `usage: TokenUsage | null`

      Token usage by the root agent during the turn, when available.

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnCancelledEvent`

    Emitted when a turn is cancelled.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn: Turn`

      The cancelled turn.

    - `turn_id: string`

      The ID of the turn associated with the event.

      `minLength: 0`

    - `type: "agent.session.turn.cancelled"`

      The type of the object. Always `agent.session.turn.cancelled`.

      - `"agent.session.turn.cancelled"`

    - `usage: TokenUsage | null`

      Token usage by the root agent during the turn, when available.

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnItemAddedEvent`

    Emitted when an item is added to a turn.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item: AgentSessionItem`

      The item that was added.

      - `AgentSessionMessage`

        A user or assistant message recorded in a session.

        - `id: string | null`

          The ID of this item, or null for legacy user messages whose ID was not recorded.

          `minLength: 0`

        - `content: Array<AgentSessionMessageContent>`

          The content of the message. User messages contain input text or images; assistant messages contain output text.

          `minItems: 0`, `maxItems: 2000`

          - `MessageContentResourceInputText`

            Text supplied by the user.

            - `text: string`

              The text supplied by the user.

              `minLength: 0`

            - `type: "input_text"`

              The type of the object. Always `input_text`.

              - `"input_text"`

          - `MessageContentResourceInputImage`

            An image supplied by the user.

            - `image_url: string`

              The URL of the image supplied by the user, which may be a base64-encoded data URL.

              `minLength: 0`

            - `type: "input_image"`

              The type of the object. Always `input_image`.

              - `"input_image"`

          - `MessageContentResourceOutputText`

            Text produced by the assistant.

            - `text: string`

              The text produced by the assistant.

              `minLength: 0`

            - `type: "output_text"`

              The type of the object. Always `output_text`.

              - `"output_text"`

        - `phase: "commentary" | "final_answer" | null`

          The phase of an assistant message. Null for user messages.

          - `"commentary"`

            Commentary produced while the agent works.

          - `"final_answer"`

            The agent's final answer.

        - `role: "user" | "assistant"`

          The role of the message author.

          - `"user"`

          - `"assistant"`

        - `status: AgentOutputItemStatus`

          The status of the message. User messages are always `completed`.

          - `"in_progress"`

            The item is in progress.

          - `"completed"`

            The item is complete.

          - `"incomplete"`

            The item stopped before completing.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "message"`

          The item type. Always `message`.

          - `"message"`

      - `AgentReasoningItem`

        A reasoning item produced by the agent.

        - `id: string`

          The ID of the reasoning item.

          `minLength: 0`

        - `status: AgentOutputItemStatus | null`

          The status of the reasoning item.

        - `summary: Array<SummaryText>`

          The reasoning summaries produced by the agent.

          `minItems: 0`, `maxItems: 2000`

          - `text: string`

            The reasoning summary text.

            `minLength: 0`

          - `type: "summary_text"`

            The content type. Always `summary_text`.

            - `"summary_text"`

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "reasoning"`

          The item type. Always `reasoning`.

          - `"reasoning"`

      - `AgentFunctionCallItem`

        A function call produced by the agent.

        - `id: string`

          The ID of the function call item.

          `minLength: 0`

        - `arguments: unknown`

          The arguments to pass to the function.

        - `call_id: string`

          The ID used to submit the function result.

          `minLength: 0`

        - `name: string`

          The name of the function to call.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the function call.

          - `"in_progress"`

            The call is in progress.

          - `"completed"`

            The call completed successfully.

          - `"failed"`

            The call failed.

          - `"incomplete"`

            The call stopped before completing.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "function_call"`

          The item type. Always `function_call`.

          - `"function_call"`

      - `FunctionCallOutputItemResource`

        The result supplied for a function call.

        - `id: string`

          The ID of the function call output item.

          `minLength: 0`

        - `call_id: string`

          The ID of the function call that produced this output.

          `minLength: 0`

        - `error: string | null`

          The error message, if the call failed.

          `minLength: 0`

        - `output: AgentFunctionCallOutput | null`

          The function result, if the call succeeded.

          - `string`

          - `Array<InputContent>`

            - `InputContentResourceInputText`

              Text input recorded in a session item.

              - `text: string`

                The text supplied to the agent.

                `minLength: 0`

              - `type: "input_text"`

                The type of the object. Always `input_text`.

                - `"input_text"`

            - `InputContentResourceInputImage`

              Image input recorded in a session item.

              - `image_url: string`

                The URL of the image supplied to the agent, which may be a base64-encoded data URL.

                `minLength: 0`

              - `type: "input_image"`

                The type of the object. Always `input_image`.

                - `"input_image"`

        - `status: AgentFunctionCallStatus`

          The status of the function call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "function_call_output"`

          The item type. Always `function_call_output`.

          - `"function_call_output"`

      - `AgentMessageItemResource`

        A message exchanged between agent threads.

        - `id: string`

          The ID of the message.

          `minLength: 0`

        - `content: Array<AgentContent>`

          The content exchanged between the agents.

          `minItems: 0`, `maxItems: 2000`

          - `OutputText`

            A text content part produced by the agent.

            - `text: string`

              The text produced by the agent.

              `minLength: 0`

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

          - `EncryptedContentResource`

            Encrypted content exchanged between agents.

            - `encrypted_content: string`

              The encrypted content payload.

              `minLength: 0`

            - `type: "encrypted_content"`

              The content type. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient_agent_id: string`

          The ID or name of the receiving agent.

          `minLength: 0`

        - `sender_agent_id: string`

          The ID or name of the sending agent.

          `minLength: 0`

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

      - `AgentMcpCallItem`

        A call to a tool on an MCP server.

        - `id: string`

          The ID of the MCP call item.

          `minLength: 0`

        - `arguments: unknown`

          The arguments passed to the MCP tool.

        - `error: unknown`

          The error returned by the MCP tool, if any.

        - `name: string`

          The name of the MCP tool.

          `minLength: 0`

        - `output: unknown`

          The output returned by the MCP tool, if any.

        - `server_label: string`

          The label of the MCP server.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the MCP tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "mcp_call"`

          The item type. Always `mcp_call`.

          - `"mcp_call"`

      - `ComputerUseCallItemResource`

        One execution of the platform-provided computer-use capability.

        - `id: string`

          The ID of the activity item.

          `minLength: 0`

        - `output: Output | null`

          The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot.

          - `image_url: string`

            The complete JPEG image as a base64 data URL.

            `minLength: 0`

          - `type: "computer_screenshot"`

            The content type. Always `computer_screenshot`.

            - `"computer_screenshot"`

        - `status: AgentFunctionCallStatus`

          The execution status of the activity.

        - `title: string | null`

          A model-generated description of the activity, when available.

          `minLength: 0`

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "computer_use_call"`

          The item type. Always `computer_use_call`.

          - `"computer_use_call"`

      - `BrowserAuthenticationRequestItemResource`

        A credential-free history record of the emitted login request.

        - `id: string`

          The stable history item ID.

          `minLength: 0`

        - `request: Request`

          A registered form awaiting the application's response.

          - `credential_origin: string | null`

            The registered form or frame origin where values will be entered.

            `minLength: 0`

          - `fields: Array<Field>`

            Controls to render. All submitted values are sensitive.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The field ID to submit as field_id in a fields entry.

              `minLength: 0`

            - `label: string`

              The label to display beside the control.

              `minLength: 0`

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

              `minLength: 0`

          - `options: Array<Option>`

            Sign-in methods. Empty for a plain form.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The option ID to submit as selected_option.

              `minLength: 0`

            - `field_ids: Array<string>`

              IDs from the registered fields that this method accepts.

              `minItems: 0`, `maxItems: 2000`

            - `label: string`

              The method label to display.

              `minLength: 0`

          - `reason: string | null`

            Why the agent needs the user to sign in.

            `minLength: 0`

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `request_id: string`

          `minLength: 0`

        - `turn_id: string`

          `minLength: 0`

        - `type: "computer_use_approval_request"`

          The item type. Always computer_use_approval_request.

          - `"computer_use_approval_request"`

      - `ComputerUseApprovalRequestResultItemResource`

        A credential-free record of an admitted response, not proof of completion.

        - `id: string`

          The stable history item ID.

          `minLength: 0`

        - `request_id: string`

          The registered request answered by this item.

          `minLength: 0`

        - `response: ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource | ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

          The admitted response, without submitted credential values.

          - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource`

            - `action: "submit"`

              - `"submit"`

            - `selected_option: string | null`

              The chosen sign-in method, or null when no options were offered.

              `minLength: 0`

            - `type: "browser_authentication"`

              - `"browser_authentication"`

          - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

            - `action: "cancel"`

              - `"cancel"`

            - `type: "browser_authentication"`

              - `"browser_authentication"`

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "computer_use_approval_request_result"`

          - `"computer_use_approval_request_result"`

      - `AgentWebSearchCallItem`

        A web search call produced by the agent.

        - `id: string`

          The ID of the web search call.

          `minLength: 0`

        - `action: WebSearchAction | null`

          The action performed by the web search tool.

          - `WebSearchActionResourceSearch`

            A search query or group of search queries.

            - `queries: Array<string> | null`

              The search queries, when multiple queries were used.

              `minItems: 0`, `maxItems: 2000`

            - `query: string | null`

              The search query, when a single query was used.

              `minLength: 0`

            - `type: "search"`

              The type of the object. Always `search`.

              - `"search"`

          - `WebSearchActionResourceOpenPage`

            Opens a web page.

            - `type: "open_page"`

              The type of the object. Always `open_page`.

              - `"open_page"`

            - `url: string | null`

              The URL of the page that was opened.

              `minLength: 0`

          - `WebSearchActionResourceFindInPage`

            Finds text within a web page.

            - `pattern: string | null`

              The text pattern that was searched for.

              `minLength: 0`

            - `type: "find_in_page"`

              The type of the object. Always `find_in_page`.

              - `"find_in_page"`

            - `url: string | null`

              The URL of the page that was searched.

              `minLength: 0`

          - `WebSearchActionResourceOther`

            Another web search action.

            - `type: "other"`

              The type of the object. Always `other`.

              - `"other"`

        - `status: AgentOutputItemStatus`

          The status of the web search call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "web_search_call"`

          The item type. Always `web_search_call`.

          - `"web_search_call"`

      - `AgentCommandExecutionItem`

        A command execution produced by the agent.

        - `id: string`

          The ID of the command execution item.

          `minLength: 0`

        - `command: string`

          The command that was executed.

          `minLength: 0`

        - `cwd: string | null`

          The working directory used to execute the command.

          `minLength: 0`

        - `duration_ms: number | null`

          The command duration in milliseconds.

          `format: int64`

        - `exit_code: number | null`

          The process exit code, if the command completed.

          `format: int64`

        - `output: string | null`

          The command output, if available.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the command execution.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "command_execution"`

          The item type. Always `command_execution`.

          - `"command_execution"`

      - `AgentCreateSubagentCallItem`

        A request to spawn a subagent.

        - `id: string`

          The ID of the tool call item.

          `minLength: 0`

        - `agent_id: string`

          The ID of the agent that requested the subagent.

          `minLength: 0`

        - `content: Array<AgentContent>`

          The task given to the spawned agent.

          `minItems: 0`, `maxItems: 2000`

          - `OutputText`

            A text content part produced by the agent.

          - `EncryptedContentResource`

            Encrypted content exchanged between agents.

        - `model: string | null`

          The model requested for the spawned agent.

          `minLength: 0`

        - `reasoning_effort: string | null`

          The reasoning effort requested for the spawned agent.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "create_subagent_call"`

          The item type. Always `create_subagent_call`.

          - `"create_subagent_call"`

      - `AgentSendSubagentInputCallItem`

        A request to send input to another agent.

        - `id: string`

          The ID of the tool call item.

          `minLength: 0`

        - `content: Array<AgentContent>`

          The input sent to the receiving agent.

          `minItems: 0`, `maxItems: 2000`

          - `OutputText`

            A text content part produced by the agent.

          - `EncryptedContentResource`

            Encrypted content exchanged between agents.

        - `recipient_agent_id: string`

          The ID of the agent receiving the input.

          `minLength: 0`

        - `sender_agent_id: string`

          The ID of the agent sending the input.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "send_subagent_input_call"`

          The item type. Always `send_subagent_input_call`.

          - `"send_subagent_input_call"`

      - `AgentResumeSubagentCallItem`

        A request to resume a subagent.

        - `id: string`

          The ID of the tool call item.

          `minLength: 0`

        - `recipient_agent_id: string`

          The ID of the agent to resume.

          `minLength: 0`

        - `sender_agent_id: string`

          The ID of the agent requesting the resume.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "resume_subagent_call"`

          The item type. Always `resume_subagent_call`.

          - `"resume_subagent_call"`

      - `AgentWaitForSubagentsCallItem`

        A request to wait for one or more subagents.

        - `id: string`

          The ID of the tool call item.

          `minLength: 0`

        - `recipient_agent_ids: Array<string>`

          The IDs of the agents to wait for.

          `minItems: 0`, `maxItems: 2000`

        - `sender_agent_id: string`

          The ID of the agent waiting for results.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "wait_for_subagents_call"`

          The item type. Always `wait_for_subagents_call`.

          - `"wait_for_subagents_call"`

      - `AgentInterruptSubagentCallItem`

        A request to interrupt a subagent's current turn. The subagent remains available.

        - `id: string`

          The ID of the tool call item.

          `minLength: 0`

        - `recipient_agent_id: string`

          The ID of the agent to interrupt.

          `minLength: 0`

        - `sender_agent_id: string`

          The ID of the agent requesting the interrupt.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "interrupt_subagent_call"`

          The item type. Always `interrupt_subagent_call`.

          - `"interrupt_subagent_call"`

      - `AgentCloseSubagentCallItem`

        A request to close a subagent.

        - `id: string`

          The ID of the tool call item.

          `minLength: 0`

        - `recipient_agent_id: string`

          The ID of the agent to close.

          `minLength: 0`

        - `sender_agent_id: string`

          The ID of the agent requesting the close.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "close_subagent_call"`

          The item type. Always `close_subagent_call`.

          - `"close_subagent_call"`

    - `output_index: number | null`

      The index of the item in the turn output, when the item is agent output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.item.added"`

      The type of the object. Always `agent.session.turn.item.added`.

      - `"agent.session.turn.item.added"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionIdleEvent`

    Emitted when a session becomes idle.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session: AgentSession`

      The session that became idle.

    - `type: "agent.session.idle"`

      The type of the object. Always `agent.session.idle`.

      - `"agent.session.idle"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionInProgressEvent`

    Emitted when a session starts processing a turn.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session: AgentSession`

      The session that started processing.

    - `type: "agent.session.in_progress"`

      The type of the object. Always `agent.session.in_progress`.

      - `"agent.session.in_progress"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionRequiresActionEvent`

    Emitted when a session is waiting for one or more required actions.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session: AgentSession`

      The session and its current required actions.

    - `type: "agent.session.requires_action"`

      The type of the object. Always `agent.session.requires_action`.

      - `"agent.session.requires_action"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionFailedEvent`

    Emitted when a session fails.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session: AgentSession`

      The failed session.

    - `type: "agent.session.failed"`

      The type of the object. Always `agent.session.failed`.

      - `"agent.session.failed"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentPendingEvent`

    Emitted while a session environment is being prepared.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.pending"`

      The type of the object. Always `agent.session.environment.pending`.

      - `"agent.session.environment.pending"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentConnectedEvent`

    Emitted when a session environment connects.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.connected"`

      The type of the object. Always `agent.session.environment.connected`.

      - `"agent.session.environment.connected"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentDisconnectedEvent`

    Emitted when a session environment disconnects.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.disconnected"`

      The type of the object. Always `agent.session.environment.disconnected`.

      - `"agent.session.environment.disconnected"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentFailedEvent`

    Emitted when a session environment fails.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.failed"`

      The type of the object. Always `agent.session.environment.failed`.

      - `"agent.session.environment.failed"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionSubagentCreatedEvent`

    Emitted when a subagent is created.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `subagent: Subagent`

      The subagent that was created.

      - `id: string`

        The ID of the subagent.

        `minLength: 0`

      - `closed_at: number | null`

        The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume.

        `format: int64`

      - `instructions: Array<AgentContent> | null`

        Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available.

        `minItems: 0`, `maxItems: 2000`

        - `OutputText`

          A text content part produced by the agent.

        - `EncryptedContentResource`

          Encrypted content exchanged between agents.

      - `name: string | null`

        The runner-assigned nickname, or null when unavailable.

        `minLength: 0`

      - `object: "agent.session.subagent"`

        The object type. Always `agent.session.subagent`.

        - `"agent.session.subagent"`

      - `opened_at: number`

        The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it.

        `format: int64`

      - `parent_agent_id: string`

        The ID of the agent that created this subagent.

        `minLength: 0`

      - `session_id: string`

        The ID of the session that owns the subagent.

        `minLength: 0`

      - `status: "active" | "closed"`

        The current status of the subagent.

        - `"active"`

          The subagent remains available, including while idle between turns.

        - `"closed"`

          The subagent is closed.

    - `type: "agent.session.subagent.created"`

      The type of the object. Always `agent.session.subagent.created`.

      - `"agent.session.subagent.created"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionSubagentActiveEvent`

    Emitted when a closed subagent successfully resumes.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `subagent: Subagent`

      The subagent that resumed.

    - `type: "agent.session.subagent.active"`

      The type of the object. Always `agent.session.subagent.active`.

      - `"agent.session.subagent.active"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionSubagentClosedEvent`

    Emitted when a subagent is closed.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `subagent: Subagent`

      The subagent that was closed.

    - `type: "agent.session.subagent.closed"`

      The type of the object. Always `agent.session.subagent.closed`.

      - `"agent.session.subagent.closed"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnItemDoneEvent`

    Emitted when an output item is complete.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item: AgentOutputItem`

      The completed output item.

      - `AgentSessionAssistantMessage`

        An assistant message produced by the agent.

        - `id: string`

          The ID of the message.

          `minLength: 0`

        - `content: Array<OutputText>`

          The content of the message.

          `minItems: 0`, `maxItems: 2000`

          - `text: string`

            The text produced by the agent.

            `minLength: 0`

          - `type: "output_text"`

            The content type. Always `output_text`.

        - `phase: "commentary" | "final_answer" | null`

          The phase of the assistant message.

          - `"commentary"`

            Commentary produced while the agent works.

          - `"final_answer"`

            The agent's final answer.

        - `role: "assistant"`

          The role of the message author. Always `assistant`.

          - `"assistant"`

        - `status: AgentOutputItemStatus`

          The status of the message.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "message"`

          The item type. Always `message`.

          - `"message"`

      - `AgentReasoningItem`

        A reasoning item produced by the agent.

      - `AgentFunctionCallItem`

        A function call produced by the agent.

      - `AgentMcpCallItem`

        A call to a tool on an MCP server.

      - `ComputerUseCallItemResource`

        One execution of the platform-provided computer-use capability.

        - `id: string`

          The ID of the activity item.

          `minLength: 0`

        - `output: Output | null`

          The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot.

          - `image_url: string`

            The complete JPEG image as a base64 data URL.

            `minLength: 0`

          - `type: "computer_screenshot"`

            The content type. Always `computer_screenshot`.

            - `"computer_screenshot"`

        - `status: AgentFunctionCallStatus`

          The execution status of the activity.

        - `title: string | null`

          A model-generated description of the activity, when available.

          `minLength: 0`

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "computer_use_call"`

          The item type. Always `computer_use_call`.

          - `"computer_use_call"`

      - `BrowserAuthenticationRequestItemResource`

        A credential-free history record of the emitted login request.

        - `id: string`

          The stable history item ID.

          `minLength: 0`

        - `request: Request`

          A registered form awaiting the application's response.

          - `credential_origin: string | null`

            The registered form or frame origin where values will be entered.

            `minLength: 0`

          - `fields: Array<Field>`

            Controls to render. All submitted values are sensitive.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The field ID to submit as field_id in a fields entry.

              `minLength: 0`

            - `label: string`

              The label to display beside the control.

              `minLength: 0`

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

              `minLength: 0`

          - `options: Array<Option>`

            Sign-in methods. Empty for a plain form.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The option ID to submit as selected_option.

              `minLength: 0`

            - `field_ids: Array<string>`

              IDs from the registered fields that this method accepts.

              `minItems: 0`, `maxItems: 2000`

            - `label: string`

              The method label to display.

              `minLength: 0`

          - `reason: string | null`

            Why the agent needs the user to sign in.

            `minLength: 0`

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `request_id: string`

          `minLength: 0`

        - `turn_id: string`

          `minLength: 0`

        - `type: "computer_use_approval_request"`

          The item type. Always computer_use_approval_request.

          - `"computer_use_approval_request"`

      - `AgentWebSearchCallItem`

        A web search call produced by the agent.

      - `AgentCommandExecutionItem`

        A command execution produced by the agent.

      - `AgentCreateSubagentCallItem`

        A request to spawn a subagent.

      - `AgentSendSubagentInputCallItem`

        A request to send input to another agent.

      - `AgentResumeSubagentCallItem`

        A request to resume a subagent.

      - `AgentWaitForSubagentsCallItem`

        A request to wait for one or more subagents.

      - `AgentInterruptSubagentCallItem`

        A request to interrupt a subagent's current turn. The subagent remains available.

      - `AgentCloseSubagentCallItem`

        A request to close a subagent.

    - `output_index: number`

      The index of the output item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.item.done"`

      The type of the object. Always `agent.session.turn.item.done`.

      - `"agent.session.turn.item.done"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnContentPartAddedEvent`

    Emitted when an output text content part is added.

    - `content_index: number`

      The index of the content part in the message.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the message item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `part: OutputText`

      The initial content part.

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.content_part.added"`

      The type of the object. Always `agent.session.turn.content_part.added`.

      - `"agent.session.turn.content_part.added"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnContentPartDoneEvent`

    Emitted when an output content part is complete.

    - `content_index: number`

      The index of the content part in the message.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the message item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `part: OutputText`

      The completed content part.

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.content_part.done"`

      The type of the object. Always `agent.session.turn.content_part.done`.

      - `"agent.session.turn.content_part.done"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnOutputTextDeltaEvent`

    Emitted when text is appended to an output text content part.

    - `content_index: number`

      The index of the content part in the message.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `delta: string`

      The text that was appended.

      `minLength: 0`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the message item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.output_text.delta"`

      The type of the object. Always `agent.session.turn.output_text.delta`.

      - `"agent.session.turn.output_text.delta"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnOutputTextDoneEvent`

    Emitted when an output text content part is complete.

    - `content_index: number`

      The index of the content part in the message.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the message item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `text: string`

      The complete output text.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.output_text.done"`

      The type of the object. Always `agent.session.turn.output_text.done`.

      - `"agent.session.turn.output_text.done"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnReasoningSummaryPartAddedEvent`

    Emitted when a reasoning summary content part is added.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the reasoning item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `part: SummaryText`

      The initial summary part.

      - `text: string`

        The reasoning summary text.

        `minLength: 0`

      - `type: "summary_text"`

        The content type. Always `summary_text`.

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `summary_index: number`

      The index of the summary content part.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.reasoning_summary_part.added"`

      The type of the object. Always `agent.session.turn.reasoning_summary_part.added`.

      - `"agent.session.turn.reasoning_summary_part.added"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnReasoningSummaryPartDoneEvent`

    Emitted when a reasoning summary part is complete.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the reasoning item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `part: SummaryText`

      The completed summary part.

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `status: "incomplete" | null`

      Present as `incomplete` when summary generation was interrupted.

      - `"incomplete"`

    - `summary_index: number`

      The index of the summary part.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.reasoning_summary_part.done"`

      The type of the object. Always `agent.session.turn.reasoning_summary_part.done`.

      - `"agent.session.turn.reasoning_summary_part.done"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnReasoningSummaryTextDeltaEvent`

    Emitted when text is appended to a reasoning summary.

    - `delta: string`

      The summary text that was appended.

      `minLength: 0`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the reasoning item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `summary_index: number`

      The index of the summary content part.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.reasoning_summary_text.delta"`

      The type of the object. Always `agent.session.turn.reasoning_summary_text.delta`.

      - `"agent.session.turn.reasoning_summary_text.delta"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnReasoningSummaryTextDoneEvent`

    Emitted when a reasoning summary content part is complete.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the reasoning item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `summary_index: number`

      The index of the summary content part.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `text: string`

      The complete reasoning summary text.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.reasoning_summary_text.done"`

      The type of the object. Always `agent.session.turn.reasoning_summary_text.done`.

      - `"agent.session.turn.reasoning_summary_text.done"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

### Agent Session Failed Event

- `AgentSessionFailedEvent`

  Emitted when a session fails.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session: AgentSession`

    The failed session.

    - `id: string`

      The ID of the session.

      `minLength: 0`

    - `agent: Agent`

      The agent running in the session.

      - `id: string`

        The ID of the agent.

        `minLength: 0`

      - `instructions: string | null`

        Custom instructions appended to the agent's default base instructions.

        `minLength: 0`

      - `model: string`

        The model used by the agent.

        `minLength: 0`

      - `multi_agent: MultiAgentConfig`

        Configuration for creating and coordinating subagents.

        - `enabled: boolean`

          Whether subagent tools are enabled. Defaults to false.

        - `max_concurrent_subagents: number | null`

          Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

          `format: int64`, `minimum: 1`, `maximum: 4294967295`

      - `name: string | null`

        The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

        `minLength: 0`

      - `reasoning: AgentReasoning`

        The agent's reasoning configuration.

        - `effort: "none" | "minimal" | "low" | 4 more | null`

          The requested reasoning effort, or `null` when the model selects its own default.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

        - `summary: "concise" | "detailed" | "auto" | null`

          The requested reasoning summary format, or `null` when summaries are disabled.

          - `"concise"`

            Returns a concise reasoning summary when supported.

          - `"detailed"`

            Returns a detailed reasoning summary when supported.

          - `"auto"`

            Automatically selects the most detailed summary supported by the model.

      - `service_tier: "auto" | "default" | "flex" | 3 more`

        The effective service-tier policy for model requests. Defaults to `auto`.

        - `"auto"`

        - `"default"`

        - `"flex"`

        - `"priority"`

        - `"fast"`

        - `"ultrafast"`

      - `text: AgentText`

        Configuration for text generated by the agent.

        - `format: TextFormat`

          The effective output format. Defaults to ordinary text.

          - `TextFormatResourceText`

            Generates ordinary text without a structured-output constraint.

            - `type: "text"`

              The type of the object. Always `text`.

              - `"text"`

          - `TextFormatResourceJSONSchema`

            Constrains generated text to a JSON Schema.

            - `schema: Record<string, unknown>`

              The JSON Schema that generated text must match.

            - `type: "json_schema"`

              The type of the object. Always `json_schema`.

              - `"json_schema"`

        - `verbosity: "low" | "medium" | "high"`

          The amount of text produced by the agent. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

      - `tools: Array<AgentTool>`

        Tools available to the agent.

        `minItems: 0`, `maxItems: 2000`

        - `AgentToolResourceFunction`

          A function defined by the application.

          - `defer_loading: boolean`

            Whether the function is deferred and discovered through tool search.

          - `description: string`

            A description of what the function does.

            `minLength: 0`

          - `name: string`

            The name of the function.

            `minLength: 0`

          - `parameters: Record<string, unknown>`

            A JSON Schema object describing the function's arguments.

          - `type: "function"`

            The type of the object. Always `function`.

            - `"function"`

          - `async?: boolean`

            Whether the agent continues without waiting for the function result.

        - `AgentToolResourceProgrammaticToolCalling`

          Enables calling tools from model-generated code.

          - `enabled: boolean`

            Whether tools can be called from model-generated code.

          - `type: "programmatic_tool_calling"`

            The type of the object. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `AgentToolResourceMcp`

          Tools provided by a remote MCP server.

          - `allowed_tools: Array<string> | null`

            The MCP tools the agent may call.

            `minItems: 0`, `maxItems: 2000`

          - `connection_origin: "service" | "environment"`

            Where outbound MCP HTTP connections originate.

            - `"service"`

            - `"environment"`

          - `credential_id: string | null`

            The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

            `minLength: 0`

          - `request_metadata: Record<string, unknown>`

            Metadata included with requests to this MCP server.

          - `required: boolean`

            Whether this MCP server must initialize before the first turn.

          - `server_label: string`

            A label used to identify the MCP server in tool calls.

            `minLength: 0`

          - `transport: McpTransport`

            The transport used to connect to the MCP server.

            - `McpTransportResourceHTTP`

              Connects to an MCP server over HTTP.

              - `server_url: string`

                The URL of the MCP server.

                `minLength: 0`

              - `type: "http"`

                The type of the object. Always `http`.

                - `"http"`

            - `McpTransportResourceStdio`

              Starts an MCP server as a local process.

              - `args: Array<string>`

                Arguments passed to the MCP server command.

                `minItems: 0`, `maxItems: 2000`

              - `command: string`

                The command used to start the MCP server.

                `minLength: 0`

              - `cwd: string`

                The working directory used to start the MCP server.

                `minLength: 0`

              - `env_vars: Array<string>`

                Environment variable names inherited from the execution environment.

                `minItems: 0`, `maxItems: 2000`

              - `type: "stdio"`

                The type of the object. Always `stdio`.

                - `"stdio"`

          - `type: "mcp"`

            The type of the object. Always `mcp`.

            - `"mcp"`

        - `AgentToolResourceWebSearch`

          Web search.

          - `allowed_domains: Array<string> | null`

            Allowed search domains, or `null` when the search is unrestricted.

            `minItems: 0`, `maxItems: 2000`

          - `context_size: "low" | "medium" | "high"`

            The amount of search context made available to the model. Defaults to `medium`.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `location: Location | null`

            Approximate location used to localize search results, if provided.

            - `city: string | null`

              The city name.

              `minLength: 0`

            - `country: string | null`

              The two-letter ISO country code, such as `US`.

              `minLength: 0`

            - `region: string | null`

              The region or state name.

              `minLength: 0`

            - `timezone: string | null`

              The IANA timezone, such as `America/Los_Angeles`.

              `minLength: 0`

          - `mode: "disabled" | "cached" | "live"`

            The source used for web search results.

            - `"disabled"`

            - `"cached"`

            - `"live"`

          - `type: "web_search"`

            The type of the object. Always `web_search`.

            - `"web_search"`

        - `AgentToolResourceComputerUse`

          Browser use in an OpenAI-hosted session.

          - `include_screenshots: boolean`

            Whether computer tool outputs include screenshots.

          - `type: "computer_use"`

            The type of the object. Always `computer_use`.

            - `"computer_use"`

        - `AgentToolResourceAutomations`

          Lets the agent manage its own scheduled wakeups.

          - `type: "automations"`

            The type of the object. Always `automations`.

            - `"automations"`

      - `compaction?: Compaction`

        The effective context compaction settings.

        - `async: boolean`

          Whether context is compacted in the background. Defaults to true.

      - `experimental?: Experimental`

        The effective experimental settings for the agent.

        - `time_awareness: boolean`

          Whether the model receives periodic current-time reminders.

    - `created_at: number`

      The Unix timestamp, in seconds, when the session was created.

      `format: int64`

    - `environment: Environment`

      The execution environment for the session.

      - `EnvironmentResourceNone`

        The session talks to CCA without selecting or provisioning an execution environment.

        - `type: "none"`

          The type of the object. Always `none`.

          - `"none"`

      - `EnvironmentResourceOpenAIHosted`

        An environment hosted by OpenAI.

        - `id: string`

          The public ID of the environment.

          `minLength: 0`

        - `capability_directories: Array<string>`

          Directories that contain capabilities exposed to the agent.

          `minItems: 0`, `maxItems: 2000`

        - `files: Array<HostedEnvironmentFile>`

          Files available in the environment, excluding their contents.

          `minItems: 0`, `maxItems: 50`

          - `HostedEnvironmentFileID`

            A file copied from the OpenAI Files API.

            - `id: string`

              The session-scoped ID of the file in the execution environment.

              `minLength: 0`

            - `file_id: string`

              The ID of the uploaded file.

              `minLength: 0`

            - `path: string`

              The file's absolute path inside the environment.

              `minLength: 0`

            - `size_bytes: number`

              The decoded file size in bytes.

              `format: int64`, `minimum: 0`

            - `type: "file_id"`

              The type of the object. Always `file_id`.

              - `"file_id"`

          - `HostedEnvironmentFileResourceInline`

            A file supplied inline when the session was created.

            - `id: string`

              The session-scoped ID of the file in the execution environment.

              `minLength: 0`

            - `path: string`

              The file's absolute path inside the environment.

              `minLength: 0`

            - `size_bytes: number`

              The decoded file size in bytes.

              `format: int64`, `minimum: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `network: Network`

          The effective network access policy for the environment.

          - `access: "enabled" | "disabled" | "restricted"`

            The environment's network access mode.

            - `"enabled"`

              Allows unrestricted network access.

            - `"disabled"`

              Disables network access.

            - `"restricted"`

              Applies the configured domain restrictions.

          - `allowed_domains: Array<string>`

            Domains the environment may access when network access is restricted.

            `minItems: 0`, `maxItems: 2000`

        - `packages: Packages`

          Packages installed in the environment.

          - `npm: Array<string>`

            npm packages installed globally in the environment.

            `minItems: 0`, `maxItems: 16384`

          - `python: Array<string>`

            Python packages installed in the environment.

            `minItems: 0`, `maxItems: 16384`

          - `system: Array<string>`

            System packages installed in the environment.

            `minItems: 0`, `maxItems: 16384`

        - `plugins: Array<HostedPlugin>`

          Plugins installed in the environment, excluding their archive contents.

          `minItems: 0`, `maxItems: 2000`

          - `description: string`

            The installed plugin description.

            `minLength: 0`

          - `name: string`

            The installed plugin name.

            `minLength: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

        - `skills: Array<HostedSkill>`

          Skills installed in the environment, excluding their archive contents.

          `minItems: 0`, `maxItems: 2000`

          - `HostedSkillReference`

            A skill installed from the Skills API.

            - `description: string`

              The installed skill description.

              `minLength: 0`

            - `name: string`

              The installed skill name.

              `minLength: 0`

            - `skill_id: string`

              The referenced skill ID.

              `minLength: 0`

            - `type: "skill_reference"`

              The type of the object. Always `skill_reference`.

              - `"skill_reference"`

            - `version: string`

              The concrete skill version installed for this session.

              `minLength: 0`

          - `HostedSkillResourceInline`

            A skill installed from an inline ZIP archive.

            - `description: string`

              The installed skill description.

              `minLength: 0`

            - `name: string`

              The installed skill name.

              `minLength: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `type: "openai_hosted"`

          The type of the object. Always `openai_hosted`.

          - `"openai_hosted"`

        - `container_size?: "small" | "medium" | "large" | null`

          The effective CPU and memory tier, or null when unknown or outside the public tiers.

          - `"small"`

          - `"medium"`

          - `"large"`

        - `desktop?: Desktop`

          The effective desktop configuration.

          - `enabled: boolean`

            Whether the environment provisions a desktop and browser proxy.

      - `EnvironmentResourceSelfHosted`

        An environment hosted by the application.

        - `id: string`

          The public ID of the environment.

          `minLength: 0`

        - `capability_directories: Array<string>`

          Directories that contain capabilities exposed to the agent.

          `minItems: 0`, `maxItems: 2000`

        - `remote_url: string`

          Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

          `minLength: 0`

        - `type: "self_hosted"`

          The type of the object. Always `self_hosted`.

          - `"self_hosted"`

        - `workspace_directory: string`

          The absolute project directory inside the environment. Defaults to `/workspace`.

          `minLength: 0`

    - `error: string | null`

      The error that caused the session to fail, if any.

      `minLength: 0`

    - `last_active_at: number`

      The Unix timestamp, in seconds, when the session was last active.

      `format: int64`

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the session.

    - `object: "agent.session"`

      The object type. Always `agent.session`.

      - `"agent.session"`

    - `required_actions: Array<SessionRequiredActionResourceComputerUseApprovalRequest | SessionRequiredActionResourceFunctionCall | SessionRequiredActionResourceEnvironmentConnection>`

      Actions that must be completed before the session can continue.

      `minItems: 0`, `maxItems: 2000`

      - `SessionRequiredActionResourceComputerUseApprovalRequest`

        Respond to a computer-use request.

        - `request: ComputerUseApprovalRequestKindResourceBrowserAuthentication | ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

          The information needed to render the request.

          - `ComputerUseApprovalRequestKindResourceBrowserAuthentication`

            A registered form awaiting the application's response.

            - `credential_origin: string | null`

              The registered form or frame origin where values will be entered.

              `minLength: 0`

            - `fields: Array<Field>`

              Controls to render. All submitted values are sensitive.

              `minItems: 0`, `maxItems: 2000`

              - `id: string`

                The field ID to submit as field_id in a fields entry.

                `minLength: 0`

              - `label: string`

                The label to display beside the control.

                `minLength: 0`

              - `required: boolean`

                Whether this control requires a nonempty value.

              - `type: string`

                The rendering type, such as email, password, or text.

                `minLength: 0`

            - `options: Array<Option>`

              Sign-in methods. Empty for a plain form.

              `minItems: 0`, `maxItems: 2000`

              - `id: string`

                The option ID to submit as selected_option.

                `minLength: 0`

              - `field_ids: Array<string>`

                IDs from the registered fields that this method accepts.

                `minItems: 0`, `maxItems: 2000`

              - `label: string`

                The method label to display.

                `minLength: 0`

            - `reason: string | null`

              Why the agent needs the user to sign in.

              `minLength: 0`

            - `type: "browser_authentication"`

              The type of the object. Always `browser_authentication`.

              - `"browser_authentication"`

          - `ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

            A browser origin awaiting the application's approval decision.

            - `origin: string`

              The origin the browser needs permission to access.

              `minLength: 0`

            - `reason: string | null`

              The browser's explanation for this request, or null when unavailable.

              `minLength: 0`

            - `type: "browser_origin_access"`

              The type of the object. Always `browser_origin_access`.

              - `"browser_origin_access"`

        - `request_id: string`

          The registered request ID to echo when responding.

          `minLength: 0`

        - `turn_id: string`

          The turn that requested approval.

          `minLength: 0`

        - `type: "computer_use_approval_request"`

          The type of the object. Always `computer_use_approval_request`.

          - `"computer_use_approval_request"`

      - `SessionRequiredActionResourceFunctionCall`

        Run a function tool and submit its result.

        - `arguments: unknown`

          The arguments supplied by the model.

        - `call_id: string`

          The ID to include when submitting the function result.

          `minLength: 0`

        - `name: string`

          The function name.

          `minLength: 0`

        - `turn_id: string`

          The ID of the turn that requested the function call.

          `minLength: 0`

        - `type: "function_call"`

          The type of the object. Always `function_call`.

          - `"function_call"`

      - `SessionRequiredActionResourceEnvironmentConnection`

        Reconnect a session environment.

        - `environment_id: string`

          The ID of the environment to reconnect.

          `minLength: 0`

        - `type: "environment_connection"`

          The type of the object. Always `environment_connection`.

          - `"environment_connection"`

    - `status: "idle" | "in_progress" | "requires_action" | "failed"`

      The current status of the session.

      - `"idle"`

        The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

      - `"in_progress"`

        The session is processing a turn.

      - `"requires_action"`

        The session is waiting for one or more required actions.

      - `"failed"`

        The session failed.

    - `usage: TokenUsage | null`

      Best-effort token usage for the session, or null if unknown. Recorded usage may change.

      - `input_tokens: number`

        The number of input tokens used by the agent.

        `format: int64`

      - `input_tokens_details: InputTokensDetails`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

          `format: int64`

      - `output_tokens: number`

        The number of output tokens generated by the agent.

        `format: int64`

      - `output_tokens_details: OutputTokensDetails`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

          `format: int64`

      - `total_tokens: number`

        The total number of input and output tokens used by the agent.

        `format: int64`

    - `vault_ids: Array<string>`

      The IDs of vaults made available to the session.

      `minItems: 0`, `maxItems: 2000`

    - `prompt_cache_options?: PromptCacheOptions | null`

      Default prompt cache lifetime for turns in this session, when configured.

      - `ttl: "30m" | "12h"`

        - `"30m"`

        - `"12h"`

    - `review?: "none" | "auto_review"`

      Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none.

      - `"none"`

      - `"auto_review"`

    - `spend_control?: SpendControl`

      Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object.

      - `consumed: number | null`

        Best-effort recorded spend floored to whole USD cents, or null when unavailable.

        `minimum: 0`

      - `limit: number`

        The configured positive limit in USD cents.

        `format: int64`, `minimum: 1`, `maximum: 4503599627370495`

  - `type: "agent.session.failed"`

    The type of the object. Always `agent.session.failed`.

    - `"agent.session.failed"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Idle Event

- `AgentSessionIdleEvent`

  Emitted when a session becomes idle.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session: AgentSession`

    The session that became idle.

    - `id: string`

      The ID of the session.

      `minLength: 0`

    - `agent: Agent`

      The agent running in the session.

      - `id: string`

        The ID of the agent.

        `minLength: 0`

      - `instructions: string | null`

        Custom instructions appended to the agent's default base instructions.

        `minLength: 0`

      - `model: string`

        The model used by the agent.

        `minLength: 0`

      - `multi_agent: MultiAgentConfig`

        Configuration for creating and coordinating subagents.

        - `enabled: boolean`

          Whether subagent tools are enabled. Defaults to false.

        - `max_concurrent_subagents: number | null`

          Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

          `format: int64`, `minimum: 1`, `maximum: 4294967295`

      - `name: string | null`

        The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

        `minLength: 0`

      - `reasoning: AgentReasoning`

        The agent's reasoning configuration.

        - `effort: "none" | "minimal" | "low" | 4 more | null`

          The requested reasoning effort, or `null` when the model selects its own default.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

        - `summary: "concise" | "detailed" | "auto" | null`

          The requested reasoning summary format, or `null` when summaries are disabled.

          - `"concise"`

            Returns a concise reasoning summary when supported.

          - `"detailed"`

            Returns a detailed reasoning summary when supported.

          - `"auto"`

            Automatically selects the most detailed summary supported by the model.

      - `service_tier: "auto" | "default" | "flex" | 3 more`

        The effective service-tier policy for model requests. Defaults to `auto`.

        - `"auto"`

        - `"default"`

        - `"flex"`

        - `"priority"`

        - `"fast"`

        - `"ultrafast"`

      - `text: AgentText`

        Configuration for text generated by the agent.

        - `format: TextFormat`

          The effective output format. Defaults to ordinary text.

          - `TextFormatResourceText`

            Generates ordinary text without a structured-output constraint.

            - `type: "text"`

              The type of the object. Always `text`.

              - `"text"`

          - `TextFormatResourceJSONSchema`

            Constrains generated text to a JSON Schema.

            - `schema: Record<string, unknown>`

              The JSON Schema that generated text must match.

            - `type: "json_schema"`

              The type of the object. Always `json_schema`.

              - `"json_schema"`

        - `verbosity: "low" | "medium" | "high"`

          The amount of text produced by the agent. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

      - `tools: Array<AgentTool>`

        Tools available to the agent.

        `minItems: 0`, `maxItems: 2000`

        - `AgentToolResourceFunction`

          A function defined by the application.

          - `defer_loading: boolean`

            Whether the function is deferred and discovered through tool search.

          - `description: string`

            A description of what the function does.

            `minLength: 0`

          - `name: string`

            The name of the function.

            `minLength: 0`

          - `parameters: Record<string, unknown>`

            A JSON Schema object describing the function's arguments.

          - `type: "function"`

            The type of the object. Always `function`.

            - `"function"`

          - `async?: boolean`

            Whether the agent continues without waiting for the function result.

        - `AgentToolResourceProgrammaticToolCalling`

          Enables calling tools from model-generated code.

          - `enabled: boolean`

            Whether tools can be called from model-generated code.

          - `type: "programmatic_tool_calling"`

            The type of the object. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `AgentToolResourceMcp`

          Tools provided by a remote MCP server.

          - `allowed_tools: Array<string> | null`

            The MCP tools the agent may call.

            `minItems: 0`, `maxItems: 2000`

          - `connection_origin: "service" | "environment"`

            Where outbound MCP HTTP connections originate.

            - `"service"`

            - `"environment"`

          - `credential_id: string | null`

            The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

            `minLength: 0`

          - `request_metadata: Record<string, unknown>`

            Metadata included with requests to this MCP server.

          - `required: boolean`

            Whether this MCP server must initialize before the first turn.

          - `server_label: string`

            A label used to identify the MCP server in tool calls.

            `minLength: 0`

          - `transport: McpTransport`

            The transport used to connect to the MCP server.

            - `McpTransportResourceHTTP`

              Connects to an MCP server over HTTP.

              - `server_url: string`

                The URL of the MCP server.

                `minLength: 0`

              - `type: "http"`

                The type of the object. Always `http`.

                - `"http"`

            - `McpTransportResourceStdio`

              Starts an MCP server as a local process.

              - `args: Array<string>`

                Arguments passed to the MCP server command.

                `minItems: 0`, `maxItems: 2000`

              - `command: string`

                The command used to start the MCP server.

                `minLength: 0`

              - `cwd: string`

                The working directory used to start the MCP server.

                `minLength: 0`

              - `env_vars: Array<string>`

                Environment variable names inherited from the execution environment.

                `minItems: 0`, `maxItems: 2000`

              - `type: "stdio"`

                The type of the object. Always `stdio`.

                - `"stdio"`

          - `type: "mcp"`

            The type of the object. Always `mcp`.

            - `"mcp"`

        - `AgentToolResourceWebSearch`

          Web search.

          - `allowed_domains: Array<string> | null`

            Allowed search domains, or `null` when the search is unrestricted.

            `minItems: 0`, `maxItems: 2000`

          - `context_size: "low" | "medium" | "high"`

            The amount of search context made available to the model. Defaults to `medium`.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `location: Location | null`

            Approximate location used to localize search results, if provided.

            - `city: string | null`

              The city name.

              `minLength: 0`

            - `country: string | null`

              The two-letter ISO country code, such as `US`.

              `minLength: 0`

            - `region: string | null`

              The region or state name.

              `minLength: 0`

            - `timezone: string | null`

              The IANA timezone, such as `America/Los_Angeles`.

              `minLength: 0`

          - `mode: "disabled" | "cached" | "live"`

            The source used for web search results.

            - `"disabled"`

            - `"cached"`

            - `"live"`

          - `type: "web_search"`

            The type of the object. Always `web_search`.

            - `"web_search"`

        - `AgentToolResourceComputerUse`

          Browser use in an OpenAI-hosted session.

          - `include_screenshots: boolean`

            Whether computer tool outputs include screenshots.

          - `type: "computer_use"`

            The type of the object. Always `computer_use`.

            - `"computer_use"`

        - `AgentToolResourceAutomations`

          Lets the agent manage its own scheduled wakeups.

          - `type: "automations"`

            The type of the object. Always `automations`.

            - `"automations"`

      - `compaction?: Compaction`

        The effective context compaction settings.

        - `async: boolean`

          Whether context is compacted in the background. Defaults to true.

      - `experimental?: Experimental`

        The effective experimental settings for the agent.

        - `time_awareness: boolean`

          Whether the model receives periodic current-time reminders.

    - `created_at: number`

      The Unix timestamp, in seconds, when the session was created.

      `format: int64`

    - `environment: Environment`

      The execution environment for the session.

      - `EnvironmentResourceNone`

        The session talks to CCA without selecting or provisioning an execution environment.

        - `type: "none"`

          The type of the object. Always `none`.

          - `"none"`

      - `EnvironmentResourceOpenAIHosted`

        An environment hosted by OpenAI.

        - `id: string`

          The public ID of the environment.

          `minLength: 0`

        - `capability_directories: Array<string>`

          Directories that contain capabilities exposed to the agent.

          `minItems: 0`, `maxItems: 2000`

        - `files: Array<HostedEnvironmentFile>`

          Files available in the environment, excluding their contents.

          `minItems: 0`, `maxItems: 50`

          - `HostedEnvironmentFileID`

            A file copied from the OpenAI Files API.

            - `id: string`

              The session-scoped ID of the file in the execution environment.

              `minLength: 0`

            - `file_id: string`

              The ID of the uploaded file.

              `minLength: 0`

            - `path: string`

              The file's absolute path inside the environment.

              `minLength: 0`

            - `size_bytes: number`

              The decoded file size in bytes.

              `format: int64`, `minimum: 0`

            - `type: "file_id"`

              The type of the object. Always `file_id`.

              - `"file_id"`

          - `HostedEnvironmentFileResourceInline`

            A file supplied inline when the session was created.

            - `id: string`

              The session-scoped ID of the file in the execution environment.

              `minLength: 0`

            - `path: string`

              The file's absolute path inside the environment.

              `minLength: 0`

            - `size_bytes: number`

              The decoded file size in bytes.

              `format: int64`, `minimum: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `network: Network`

          The effective network access policy for the environment.

          - `access: "enabled" | "disabled" | "restricted"`

            The environment's network access mode.

            - `"enabled"`

              Allows unrestricted network access.

            - `"disabled"`

              Disables network access.

            - `"restricted"`

              Applies the configured domain restrictions.

          - `allowed_domains: Array<string>`

            Domains the environment may access when network access is restricted.

            `minItems: 0`, `maxItems: 2000`

        - `packages: Packages`

          Packages installed in the environment.

          - `npm: Array<string>`

            npm packages installed globally in the environment.

            `minItems: 0`, `maxItems: 16384`

          - `python: Array<string>`

            Python packages installed in the environment.

            `minItems: 0`, `maxItems: 16384`

          - `system: Array<string>`

            System packages installed in the environment.

            `minItems: 0`, `maxItems: 16384`

        - `plugins: Array<HostedPlugin>`

          Plugins installed in the environment, excluding their archive contents.

          `minItems: 0`, `maxItems: 2000`

          - `description: string`

            The installed plugin description.

            `minLength: 0`

          - `name: string`

            The installed plugin name.

            `minLength: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

        - `skills: Array<HostedSkill>`

          Skills installed in the environment, excluding their archive contents.

          `minItems: 0`, `maxItems: 2000`

          - `HostedSkillReference`

            A skill installed from the Skills API.

            - `description: string`

              The installed skill description.

              `minLength: 0`

            - `name: string`

              The installed skill name.

              `minLength: 0`

            - `skill_id: string`

              The referenced skill ID.

              `minLength: 0`

            - `type: "skill_reference"`

              The type of the object. Always `skill_reference`.

              - `"skill_reference"`

            - `version: string`

              The concrete skill version installed for this session.

              `minLength: 0`

          - `HostedSkillResourceInline`

            A skill installed from an inline ZIP archive.

            - `description: string`

              The installed skill description.

              `minLength: 0`

            - `name: string`

              The installed skill name.

              `minLength: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `type: "openai_hosted"`

          The type of the object. Always `openai_hosted`.

          - `"openai_hosted"`

        - `container_size?: "small" | "medium" | "large" | null`

          The effective CPU and memory tier, or null when unknown or outside the public tiers.

          - `"small"`

          - `"medium"`

          - `"large"`

        - `desktop?: Desktop`

          The effective desktop configuration.

          - `enabled: boolean`

            Whether the environment provisions a desktop and browser proxy.

      - `EnvironmentResourceSelfHosted`

        An environment hosted by the application.

        - `id: string`

          The public ID of the environment.

          `minLength: 0`

        - `capability_directories: Array<string>`

          Directories that contain capabilities exposed to the agent.

          `minItems: 0`, `maxItems: 2000`

        - `remote_url: string`

          Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

          `minLength: 0`

        - `type: "self_hosted"`

          The type of the object. Always `self_hosted`.

          - `"self_hosted"`

        - `workspace_directory: string`

          The absolute project directory inside the environment. Defaults to `/workspace`.

          `minLength: 0`

    - `error: string | null`

      The error that caused the session to fail, if any.

      `minLength: 0`

    - `last_active_at: number`

      The Unix timestamp, in seconds, when the session was last active.

      `format: int64`

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the session.

    - `object: "agent.session"`

      The object type. Always `agent.session`.

      - `"agent.session"`

    - `required_actions: Array<SessionRequiredActionResourceComputerUseApprovalRequest | SessionRequiredActionResourceFunctionCall | SessionRequiredActionResourceEnvironmentConnection>`

      Actions that must be completed before the session can continue.

      `minItems: 0`, `maxItems: 2000`

      - `SessionRequiredActionResourceComputerUseApprovalRequest`

        Respond to a computer-use request.

        - `request: ComputerUseApprovalRequestKindResourceBrowserAuthentication | ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

          The information needed to render the request.

          - `ComputerUseApprovalRequestKindResourceBrowserAuthentication`

            A registered form awaiting the application's response.

            - `credential_origin: string | null`

              The registered form or frame origin where values will be entered.

              `minLength: 0`

            - `fields: Array<Field>`

              Controls to render. All submitted values are sensitive.

              `minItems: 0`, `maxItems: 2000`

              - `id: string`

                The field ID to submit as field_id in a fields entry.

                `minLength: 0`

              - `label: string`

                The label to display beside the control.

                `minLength: 0`

              - `required: boolean`

                Whether this control requires a nonempty value.

              - `type: string`

                The rendering type, such as email, password, or text.

                `minLength: 0`

            - `options: Array<Option>`

              Sign-in methods. Empty for a plain form.

              `minItems: 0`, `maxItems: 2000`

              - `id: string`

                The option ID to submit as selected_option.

                `minLength: 0`

              - `field_ids: Array<string>`

                IDs from the registered fields that this method accepts.

                `minItems: 0`, `maxItems: 2000`

              - `label: string`

                The method label to display.

                `minLength: 0`

            - `reason: string | null`

              Why the agent needs the user to sign in.

              `minLength: 0`

            - `type: "browser_authentication"`

              The type of the object. Always `browser_authentication`.

              - `"browser_authentication"`

          - `ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

            A browser origin awaiting the application's approval decision.

            - `origin: string`

              The origin the browser needs permission to access.

              `minLength: 0`

            - `reason: string | null`

              The browser's explanation for this request, or null when unavailable.

              `minLength: 0`

            - `type: "browser_origin_access"`

              The type of the object. Always `browser_origin_access`.

              - `"browser_origin_access"`

        - `request_id: string`

          The registered request ID to echo when responding.

          `minLength: 0`

        - `turn_id: string`

          The turn that requested approval.

          `minLength: 0`

        - `type: "computer_use_approval_request"`

          The type of the object. Always `computer_use_approval_request`.

          - `"computer_use_approval_request"`

      - `SessionRequiredActionResourceFunctionCall`

        Run a function tool and submit its result.

        - `arguments: unknown`

          The arguments supplied by the model.

        - `call_id: string`

          The ID to include when submitting the function result.

          `minLength: 0`

        - `name: string`

          The function name.

          `minLength: 0`

        - `turn_id: string`

          The ID of the turn that requested the function call.

          `minLength: 0`

        - `type: "function_call"`

          The type of the object. Always `function_call`.

          - `"function_call"`

      - `SessionRequiredActionResourceEnvironmentConnection`

        Reconnect a session environment.

        - `environment_id: string`

          The ID of the environment to reconnect.

          `minLength: 0`

        - `type: "environment_connection"`

          The type of the object. Always `environment_connection`.

          - `"environment_connection"`

    - `status: "idle" | "in_progress" | "requires_action" | "failed"`

      The current status of the session.

      - `"idle"`

        The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

      - `"in_progress"`

        The session is processing a turn.

      - `"requires_action"`

        The session is waiting for one or more required actions.

      - `"failed"`

        The session failed.

    - `usage: TokenUsage | null`

      Best-effort token usage for the session, or null if unknown. Recorded usage may change.

      - `input_tokens: number`

        The number of input tokens used by the agent.

        `format: int64`

      - `input_tokens_details: InputTokensDetails`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

          `format: int64`

      - `output_tokens: number`

        The number of output tokens generated by the agent.

        `format: int64`

      - `output_tokens_details: OutputTokensDetails`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

          `format: int64`

      - `total_tokens: number`

        The total number of input and output tokens used by the agent.

        `format: int64`

    - `vault_ids: Array<string>`

      The IDs of vaults made available to the session.

      `minItems: 0`, `maxItems: 2000`

    - `prompt_cache_options?: PromptCacheOptions | null`

      Default prompt cache lifetime for turns in this session, when configured.

      - `ttl: "30m" | "12h"`

        - `"30m"`

        - `"12h"`

    - `review?: "none" | "auto_review"`

      Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none.

      - `"none"`

      - `"auto_review"`

    - `spend_control?: SpendControl`

      Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object.

      - `consumed: number | null`

        Best-effort recorded spend floored to whole USD cents, or null when unavailable.

        `minimum: 0`

      - `limit: number`

        The configured positive limit in USD cents.

        `format: int64`, `minimum: 1`, `maximum: 4503599627370495`

  - `type: "agent.session.idle"`

    The type of the object. Always `agent.session.idle`.

    - `"agent.session.idle"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session In Progress Event

- `AgentSessionInProgressEvent`

  Emitted when a session starts processing a turn.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session: AgentSession`

    The session that started processing.

    - `id: string`

      The ID of the session.

      `minLength: 0`

    - `agent: Agent`

      The agent running in the session.

      - `id: string`

        The ID of the agent.

        `minLength: 0`

      - `instructions: string | null`

        Custom instructions appended to the agent's default base instructions.

        `minLength: 0`

      - `model: string`

        The model used by the agent.

        `minLength: 0`

      - `multi_agent: MultiAgentConfig`

        Configuration for creating and coordinating subagents.

        - `enabled: boolean`

          Whether subagent tools are enabled. Defaults to false.

        - `max_concurrent_subagents: number | null`

          Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

          `format: int64`, `minimum: 1`, `maximum: 4294967295`

      - `name: string | null`

        The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

        `minLength: 0`

      - `reasoning: AgentReasoning`

        The agent's reasoning configuration.

        - `effort: "none" | "minimal" | "low" | 4 more | null`

          The requested reasoning effort, or `null` when the model selects its own default.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

        - `summary: "concise" | "detailed" | "auto" | null`

          The requested reasoning summary format, or `null` when summaries are disabled.

          - `"concise"`

            Returns a concise reasoning summary when supported.

          - `"detailed"`

            Returns a detailed reasoning summary when supported.

          - `"auto"`

            Automatically selects the most detailed summary supported by the model.

      - `service_tier: "auto" | "default" | "flex" | 3 more`

        The effective service-tier policy for model requests. Defaults to `auto`.

        - `"auto"`

        - `"default"`

        - `"flex"`

        - `"priority"`

        - `"fast"`

        - `"ultrafast"`

      - `text: AgentText`

        Configuration for text generated by the agent.

        - `format: TextFormat`

          The effective output format. Defaults to ordinary text.

          - `TextFormatResourceText`

            Generates ordinary text without a structured-output constraint.

            - `type: "text"`

              The type of the object. Always `text`.

              - `"text"`

          - `TextFormatResourceJSONSchema`

            Constrains generated text to a JSON Schema.

            - `schema: Record<string, unknown>`

              The JSON Schema that generated text must match.

            - `type: "json_schema"`

              The type of the object. Always `json_schema`.

              - `"json_schema"`

        - `verbosity: "low" | "medium" | "high"`

          The amount of text produced by the agent. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

      - `tools: Array<AgentTool>`

        Tools available to the agent.

        `minItems: 0`, `maxItems: 2000`

        - `AgentToolResourceFunction`

          A function defined by the application.

          - `defer_loading: boolean`

            Whether the function is deferred and discovered through tool search.

          - `description: string`

            A description of what the function does.

            `minLength: 0`

          - `name: string`

            The name of the function.

            `minLength: 0`

          - `parameters: Record<string, unknown>`

            A JSON Schema object describing the function's arguments.

          - `type: "function"`

            The type of the object. Always `function`.

            - `"function"`

          - `async?: boolean`

            Whether the agent continues without waiting for the function result.

        - `AgentToolResourceProgrammaticToolCalling`

          Enables calling tools from model-generated code.

          - `enabled: boolean`

            Whether tools can be called from model-generated code.

          - `type: "programmatic_tool_calling"`

            The type of the object. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `AgentToolResourceMcp`

          Tools provided by a remote MCP server.

          - `allowed_tools: Array<string> | null`

            The MCP tools the agent may call.

            `minItems: 0`, `maxItems: 2000`

          - `connection_origin: "service" | "environment"`

            Where outbound MCP HTTP connections originate.

            - `"service"`

            - `"environment"`

          - `credential_id: string | null`

            The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

            `minLength: 0`

          - `request_metadata: Record<string, unknown>`

            Metadata included with requests to this MCP server.

          - `required: boolean`

            Whether this MCP server must initialize before the first turn.

          - `server_label: string`

            A label used to identify the MCP server in tool calls.

            `minLength: 0`

          - `transport: McpTransport`

            The transport used to connect to the MCP server.

            - `McpTransportResourceHTTP`

              Connects to an MCP server over HTTP.

              - `server_url: string`

                The URL of the MCP server.

                `minLength: 0`

              - `type: "http"`

                The type of the object. Always `http`.

                - `"http"`

            - `McpTransportResourceStdio`

              Starts an MCP server as a local process.

              - `args: Array<string>`

                Arguments passed to the MCP server command.

                `minItems: 0`, `maxItems: 2000`

              - `command: string`

                The command used to start the MCP server.

                `minLength: 0`

              - `cwd: string`

                The working directory used to start the MCP server.

                `minLength: 0`

              - `env_vars: Array<string>`

                Environment variable names inherited from the execution environment.

                `minItems: 0`, `maxItems: 2000`

              - `type: "stdio"`

                The type of the object. Always `stdio`.

                - `"stdio"`

          - `type: "mcp"`

            The type of the object. Always `mcp`.

            - `"mcp"`

        - `AgentToolResourceWebSearch`

          Web search.

          - `allowed_domains: Array<string> | null`

            Allowed search domains, or `null` when the search is unrestricted.

            `minItems: 0`, `maxItems: 2000`

          - `context_size: "low" | "medium" | "high"`

            The amount of search context made available to the model. Defaults to `medium`.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `location: Location | null`

            Approximate location used to localize search results, if provided.

            - `city: string | null`

              The city name.

              `minLength: 0`

            - `country: string | null`

              The two-letter ISO country code, such as `US`.

              `minLength: 0`

            - `region: string | null`

              The region or state name.

              `minLength: 0`

            - `timezone: string | null`

              The IANA timezone, such as `America/Los_Angeles`.

              `minLength: 0`

          - `mode: "disabled" | "cached" | "live"`

            The source used for web search results.

            - `"disabled"`

            - `"cached"`

            - `"live"`

          - `type: "web_search"`

            The type of the object. Always `web_search`.

            - `"web_search"`

        - `AgentToolResourceComputerUse`

          Browser use in an OpenAI-hosted session.

          - `include_screenshots: boolean`

            Whether computer tool outputs include screenshots.

          - `type: "computer_use"`

            The type of the object. Always `computer_use`.

            - `"computer_use"`

        - `AgentToolResourceAutomations`

          Lets the agent manage its own scheduled wakeups.

          - `type: "automations"`

            The type of the object. Always `automations`.

            - `"automations"`

      - `compaction?: Compaction`

        The effective context compaction settings.

        - `async: boolean`

          Whether context is compacted in the background. Defaults to true.

      - `experimental?: Experimental`

        The effective experimental settings for the agent.

        - `time_awareness: boolean`

          Whether the model receives periodic current-time reminders.

    - `created_at: number`

      The Unix timestamp, in seconds, when the session was created.

      `format: int64`

    - `environment: Environment`

      The execution environment for the session.

      - `EnvironmentResourceNone`

        The session talks to CCA without selecting or provisioning an execution environment.

        - `type: "none"`

          The type of the object. Always `none`.

          - `"none"`

      - `EnvironmentResourceOpenAIHosted`

        An environment hosted by OpenAI.

        - `id: string`

          The public ID of the environment.

          `minLength: 0`

        - `capability_directories: Array<string>`

          Directories that contain capabilities exposed to the agent.

          `minItems: 0`, `maxItems: 2000`

        - `files: Array<HostedEnvironmentFile>`

          Files available in the environment, excluding their contents.

          `minItems: 0`, `maxItems: 50`

          - `HostedEnvironmentFileID`

            A file copied from the OpenAI Files API.

            - `id: string`

              The session-scoped ID of the file in the execution environment.

              `minLength: 0`

            - `file_id: string`

              The ID of the uploaded file.

              `minLength: 0`

            - `path: string`

              The file's absolute path inside the environment.

              `minLength: 0`

            - `size_bytes: number`

              The decoded file size in bytes.

              `format: int64`, `minimum: 0`

            - `type: "file_id"`

              The type of the object. Always `file_id`.

              - `"file_id"`

          - `HostedEnvironmentFileResourceInline`

            A file supplied inline when the session was created.

            - `id: string`

              The session-scoped ID of the file in the execution environment.

              `minLength: 0`

            - `path: string`

              The file's absolute path inside the environment.

              `minLength: 0`

            - `size_bytes: number`

              The decoded file size in bytes.

              `format: int64`, `minimum: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `network: Network`

          The effective network access policy for the environment.

          - `access: "enabled" | "disabled" | "restricted"`

            The environment's network access mode.

            - `"enabled"`

              Allows unrestricted network access.

            - `"disabled"`

              Disables network access.

            - `"restricted"`

              Applies the configured domain restrictions.

          - `allowed_domains: Array<string>`

            Domains the environment may access when network access is restricted.

            `minItems: 0`, `maxItems: 2000`

        - `packages: Packages`

          Packages installed in the environment.

          - `npm: Array<string>`

            npm packages installed globally in the environment.

            `minItems: 0`, `maxItems: 16384`

          - `python: Array<string>`

            Python packages installed in the environment.

            `minItems: 0`, `maxItems: 16384`

          - `system: Array<string>`

            System packages installed in the environment.

            `minItems: 0`, `maxItems: 16384`

        - `plugins: Array<HostedPlugin>`

          Plugins installed in the environment, excluding their archive contents.

          `minItems: 0`, `maxItems: 2000`

          - `description: string`

            The installed plugin description.

            `minLength: 0`

          - `name: string`

            The installed plugin name.

            `minLength: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

        - `skills: Array<HostedSkill>`

          Skills installed in the environment, excluding their archive contents.

          `minItems: 0`, `maxItems: 2000`

          - `HostedSkillReference`

            A skill installed from the Skills API.

            - `description: string`

              The installed skill description.

              `minLength: 0`

            - `name: string`

              The installed skill name.

              `minLength: 0`

            - `skill_id: string`

              The referenced skill ID.

              `minLength: 0`

            - `type: "skill_reference"`

              The type of the object. Always `skill_reference`.

              - `"skill_reference"`

            - `version: string`

              The concrete skill version installed for this session.

              `minLength: 0`

          - `HostedSkillResourceInline`

            A skill installed from an inline ZIP archive.

            - `description: string`

              The installed skill description.

              `minLength: 0`

            - `name: string`

              The installed skill name.

              `minLength: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `type: "openai_hosted"`

          The type of the object. Always `openai_hosted`.

          - `"openai_hosted"`

        - `container_size?: "small" | "medium" | "large" | null`

          The effective CPU and memory tier, or null when unknown or outside the public tiers.

          - `"small"`

          - `"medium"`

          - `"large"`

        - `desktop?: Desktop`

          The effective desktop configuration.

          - `enabled: boolean`

            Whether the environment provisions a desktop and browser proxy.

      - `EnvironmentResourceSelfHosted`

        An environment hosted by the application.

        - `id: string`

          The public ID of the environment.

          `minLength: 0`

        - `capability_directories: Array<string>`

          Directories that contain capabilities exposed to the agent.

          `minItems: 0`, `maxItems: 2000`

        - `remote_url: string`

          Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

          `minLength: 0`

        - `type: "self_hosted"`

          The type of the object. Always `self_hosted`.

          - `"self_hosted"`

        - `workspace_directory: string`

          The absolute project directory inside the environment. Defaults to `/workspace`.

          `minLength: 0`

    - `error: string | null`

      The error that caused the session to fail, if any.

      `minLength: 0`

    - `last_active_at: number`

      The Unix timestamp, in seconds, when the session was last active.

      `format: int64`

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the session.

    - `object: "agent.session"`

      The object type. Always `agent.session`.

      - `"agent.session"`

    - `required_actions: Array<SessionRequiredActionResourceComputerUseApprovalRequest | SessionRequiredActionResourceFunctionCall | SessionRequiredActionResourceEnvironmentConnection>`

      Actions that must be completed before the session can continue.

      `minItems: 0`, `maxItems: 2000`

      - `SessionRequiredActionResourceComputerUseApprovalRequest`

        Respond to a computer-use request.

        - `request: ComputerUseApprovalRequestKindResourceBrowserAuthentication | ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

          The information needed to render the request.

          - `ComputerUseApprovalRequestKindResourceBrowserAuthentication`

            A registered form awaiting the application's response.

            - `credential_origin: string | null`

              The registered form or frame origin where values will be entered.

              `minLength: 0`

            - `fields: Array<Field>`

              Controls to render. All submitted values are sensitive.

              `minItems: 0`, `maxItems: 2000`

              - `id: string`

                The field ID to submit as field_id in a fields entry.

                `minLength: 0`

              - `label: string`

                The label to display beside the control.

                `minLength: 0`

              - `required: boolean`

                Whether this control requires a nonempty value.

              - `type: string`

                The rendering type, such as email, password, or text.

                `minLength: 0`

            - `options: Array<Option>`

              Sign-in methods. Empty for a plain form.

              `minItems: 0`, `maxItems: 2000`

              - `id: string`

                The option ID to submit as selected_option.

                `minLength: 0`

              - `field_ids: Array<string>`

                IDs from the registered fields that this method accepts.

                `minItems: 0`, `maxItems: 2000`

              - `label: string`

                The method label to display.

                `minLength: 0`

            - `reason: string | null`

              Why the agent needs the user to sign in.

              `minLength: 0`

            - `type: "browser_authentication"`

              The type of the object. Always `browser_authentication`.

              - `"browser_authentication"`

          - `ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

            A browser origin awaiting the application's approval decision.

            - `origin: string`

              The origin the browser needs permission to access.

              `minLength: 0`

            - `reason: string | null`

              The browser's explanation for this request, or null when unavailable.

              `minLength: 0`

            - `type: "browser_origin_access"`

              The type of the object. Always `browser_origin_access`.

              - `"browser_origin_access"`

        - `request_id: string`

          The registered request ID to echo when responding.

          `minLength: 0`

        - `turn_id: string`

          The turn that requested approval.

          `minLength: 0`

        - `type: "computer_use_approval_request"`

          The type of the object. Always `computer_use_approval_request`.

          - `"computer_use_approval_request"`

      - `SessionRequiredActionResourceFunctionCall`

        Run a function tool and submit its result.

        - `arguments: unknown`

          The arguments supplied by the model.

        - `call_id: string`

          The ID to include when submitting the function result.

          `minLength: 0`

        - `name: string`

          The function name.

          `minLength: 0`

        - `turn_id: string`

          The ID of the turn that requested the function call.

          `minLength: 0`

        - `type: "function_call"`

          The type of the object. Always `function_call`.

          - `"function_call"`

      - `SessionRequiredActionResourceEnvironmentConnection`

        Reconnect a session environment.

        - `environment_id: string`

          The ID of the environment to reconnect.

          `minLength: 0`

        - `type: "environment_connection"`

          The type of the object. Always `environment_connection`.

          - `"environment_connection"`

    - `status: "idle" | "in_progress" | "requires_action" | "failed"`

      The current status of the session.

      - `"idle"`

        The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

      - `"in_progress"`

        The session is processing a turn.

      - `"requires_action"`

        The session is waiting for one or more required actions.

      - `"failed"`

        The session failed.

    - `usage: TokenUsage | null`

      Best-effort token usage for the session, or null if unknown. Recorded usage may change.

      - `input_tokens: number`

        The number of input tokens used by the agent.

        `format: int64`

      - `input_tokens_details: InputTokensDetails`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

          `format: int64`

      - `output_tokens: number`

        The number of output tokens generated by the agent.

        `format: int64`

      - `output_tokens_details: OutputTokensDetails`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

          `format: int64`

      - `total_tokens: number`

        The total number of input and output tokens used by the agent.

        `format: int64`

    - `vault_ids: Array<string>`

      The IDs of vaults made available to the session.

      `minItems: 0`, `maxItems: 2000`

    - `prompt_cache_options?: PromptCacheOptions | null`

      Default prompt cache lifetime for turns in this session, when configured.

      - `ttl: "30m" | "12h"`

        - `"30m"`

        - `"12h"`

    - `review?: "none" | "auto_review"`

      Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none.

      - `"none"`

      - `"auto_review"`

    - `spend_control?: SpendControl`

      Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object.

      - `consumed: number | null`

        Best-effort recorded spend floored to whole USD cents, or null when unavailable.

        `minimum: 0`

      - `limit: number`

        The configured positive limit in USD cents.

        `format: int64`, `minimum: 1`, `maximum: 4503599627370495`

  - `type: "agent.session.in_progress"`

    The type of the object. Always `agent.session.in_progress`.

    - `"agent.session.in_progress"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Input Message Param

- `AgentSessionInputMessageParam`

  A user message submitted to a session.

  - `content: Array<InputContentParam>`

    The content of the message.

    `minItems: 0`, `maxItems: 16384`

    - `InputContentParamInputText`

      Text input to the model.

      - `text: string`

        The text sent to the model.

        `minLength: 0`, `maxLength: 1048576`

      - `type: "input_text"`

        The type of the object. Always `input_text`.

        - `"input_text"`

    - `InputContentParamInputImage`

      Image input to the model.

      - `image_url: string`

        The URL of the image sent to the model.

        `minLength: 0`, `maxLength: 1048576`

      - `type: "input_image"`

        The type of the object. Always `input_image`.

        - `"input_image"`

  - `role: "user"`

    The role of the message author. Always `user`.

    - `"user"`

  - `type?: "message"`

    The type of the input item. Always `message`.

    - `"message"`

### Agent Session Input Param

- `AgentSessionInputParam = SessionInputParamAgentSessionInputComputerUseApprovalRequestResult | SessionInputParamAgentSessionInputMessage | SessionInputParamAgentSessionInputCancel | SessionInputParamAgentSessionInputToolResult`

  Input submitted to an existing session.

  - `SessionInputParamAgentSessionInputComputerUseApprovalRequestResult`

    Responds to a pending Computer Use approval request.

    - `request_id: string`

      The registered request ID from the required action.

      `minLength: 0`, `maxLength: 1048576`

    - `response: AgentBrowserAuthenticationSubmitParam | AgentBrowserAuthenticationCancelParam | AgentBrowserOriginAccessParam`

      The response for this request type.

      - `AgentBrowserAuthenticationSubmitParam`

        - `action: "submit"`

          - `"submit"`

        - `fields: Array<Field>`

          Values for up to six active fields in the required action. The submitted field-value mapping and selected option must fit within 120 KiB of JSON.

          `minItems: 0`, `maxItems: 6`

          - `field_id: string`

            The field ID from the required action.

            `minLength: 0`, `maxLength: 1048576`

          - `value: string`

            The value to enter into the registered control.

            `minLength: 0`, `maxLength: 16384`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

        - `selected_option?: string | null`

          The chosen method. Required when the required action contains options.

          `minLength: 0`, `maxLength: 1048576`

      - `AgentBrowserAuthenticationCancelParam`

        - `action: "cancel"`

          - `"cancel"`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

      - `AgentBrowserOriginAccessParam`

        - `decision: "approve" | "deny" | "cancel"`

          Whether to allow, deny, or cancel the requested origin access.

          - `"approve"`

            Allow the browser to access this origin.

          - `"deny"`

            Deny access to this origin.

          - `"cancel"`

            Dismiss this request without approving access.

        - `type: "browser_origin_access"`

          - `"browser_origin_access"`

    - `type: "agent.session.input.computer_use_approval_request_result"`

      The type of the object. Always `agent.session.input.computer_use_approval_request_result`.

      - `"agent.session.input.computer_use_approval_request_result"`

  - `SessionInputParamAgentSessionInputMessage`

    Adds one or more user messages and starts a turn.

    - `input: Array<AgentSessionInputMessageParam>`

      The user messages to add to the session.

      `minItems: 0`, `maxItems: 16384`

      - `content: Array<InputContentParam>`

        The content of the message.

        `minItems: 0`, `maxItems: 16384`

        - `InputContentParamInputText`

          Text input to the model.

          - `text: string`

            The text sent to the model.

            `minLength: 0`, `maxLength: 1048576`

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputContentParamInputImage`

          Image input to the model.

          - `image_url: string`

            The URL of the image sent to the model.

            `minLength: 0`, `maxLength: 1048576`

          - `type: "input_image"`

            The type of the object. Always `input_image`.

            - `"input_image"`

      - `role: "user"`

        The role of the message author. Always `user`.

        - `"user"`

      - `type?: "message"`

        The type of the input item. Always `message`.

        - `"message"`

    - `type: "agent.session.input.message"`

      The type of the object. Always `agent.session.input.message`.

      - `"agent.session.input.message"`

  - `SessionInputParamAgentSessionInputCancel`

    Cancels the session's active turn.

    - `type: "agent.session.input.cancel"`

      The type of the object. Always `agent.session.input.cancel`.

      - `"agent.session.input.cancel"`

  - `SessionInputParamAgentSessionInputToolResult`

    Submits the result of a function call.

    - `call_id: string`

      The ID of the function call.

      `minLength: 0`, `maxLength: 1048576`

    - `success: boolean`

      Whether the function call succeeded.

    - `turn_id: string`

      The ID of the turn that requested the function call.

      `minLength: 0`, `maxLength: 1048576`

    - `type: "agent.session.input.tool_result"`

      The type of the object. Always `agent.session.input.tool_result`.

      - `"agent.session.input.tool_result"`

    - `error?: string | null`

      The error message when the call failed.

      `minLength: 0`, `maxLength: 1048576`

    - `output?: AgentFunctionCallOutputParam | null`

      The function result when the call succeeded.

      - `string`

      - `Array<InputContentParam>`

        - `InputContentParamInputText`

          Text input to the model.

        - `InputContentParamInputImage`

          Image input to the model.

### Agent Session Item

- `AgentSessionItem = AgentSessionMessage | AgentReasoningItem | AgentFunctionCallItem | 14 more`

  An item associated with a session turn.

  - `AgentSessionMessage`

    A user or assistant message recorded in a session.

    - `id: string | null`

      The ID of this item, or null for legacy user messages whose ID was not recorded.

      `minLength: 0`

    - `content: Array<AgentSessionMessageContent>`

      The content of the message. User messages contain input text or images; assistant messages contain output text.

      `minItems: 0`, `maxItems: 2000`

      - `MessageContentResourceInputText`

        Text supplied by the user.

        - `text: string`

          The text supplied by the user.

          `minLength: 0`

        - `type: "input_text"`

          The type of the object. Always `input_text`.

          - `"input_text"`

      - `MessageContentResourceInputImage`

        An image supplied by the user.

        - `image_url: string`

          The URL of the image supplied by the user, which may be a base64-encoded data URL.

          `minLength: 0`

        - `type: "input_image"`

          The type of the object. Always `input_image`.

          - `"input_image"`

      - `MessageContentResourceOutputText`

        Text produced by the assistant.

        - `text: string`

          The text produced by the assistant.

          `minLength: 0`

        - `type: "output_text"`

          The type of the object. Always `output_text`.

          - `"output_text"`

    - `phase: "commentary" | "final_answer" | null`

      The phase of an assistant message. Null for user messages.

      - `"commentary"`

        Commentary produced while the agent works.

      - `"final_answer"`

        The agent's final answer.

    - `role: "user" | "assistant"`

      The role of the message author.

      - `"user"`

      - `"assistant"`

    - `status: AgentOutputItemStatus`

      The status of the message. User messages are always `completed`.

      - `"in_progress"`

        The item is in progress.

      - `"completed"`

        The item is complete.

      - `"incomplete"`

        The item stopped before completing.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "message"`

      The item type. Always `message`.

      - `"message"`

  - `AgentReasoningItem`

    A reasoning item produced by the agent.

    - `id: string`

      The ID of the reasoning item.

      `minLength: 0`

    - `status: AgentOutputItemStatus | null`

      The status of the reasoning item.

    - `summary: Array<SummaryText>`

      The reasoning summaries produced by the agent.

      `minItems: 0`, `maxItems: 2000`

      - `text: string`

        The reasoning summary text.

        `minLength: 0`

      - `type: "summary_text"`

        The content type. Always `summary_text`.

        - `"summary_text"`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "reasoning"`

      The item type. Always `reasoning`.

      - `"reasoning"`

  - `AgentFunctionCallItem`

    A function call produced by the agent.

    - `id: string`

      The ID of the function call item.

      `minLength: 0`

    - `arguments: unknown`

      The arguments to pass to the function.

    - `call_id: string`

      The ID used to submit the function result.

      `minLength: 0`

    - `name: string`

      The name of the function to call.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the function call.

      - `"in_progress"`

        The call is in progress.

      - `"completed"`

        The call completed successfully.

      - `"failed"`

        The call failed.

      - `"incomplete"`

        The call stopped before completing.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "function_call"`

      The item type. Always `function_call`.

      - `"function_call"`

  - `FunctionCallOutputItemResource`

    The result supplied for a function call.

    - `id: string`

      The ID of the function call output item.

      `minLength: 0`

    - `call_id: string`

      The ID of the function call that produced this output.

      `minLength: 0`

    - `error: string | null`

      The error message, if the call failed.

      `minLength: 0`

    - `output: AgentFunctionCallOutput | null`

      The function result, if the call succeeded.

      - `string`

      - `Array<InputContent>`

        - `InputContentResourceInputText`

          Text input recorded in a session item.

          - `text: string`

            The text supplied to the agent.

            `minLength: 0`

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputContentResourceInputImage`

          Image input recorded in a session item.

          - `image_url: string`

            The URL of the image supplied to the agent, which may be a base64-encoded data URL.

            `minLength: 0`

          - `type: "input_image"`

            The type of the object. Always `input_image`.

            - `"input_image"`

    - `status: AgentFunctionCallStatus`

      The status of the function call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "function_call_output"`

      The item type. Always `function_call_output`.

      - `"function_call_output"`

  - `AgentMessageItemResource`

    A message exchanged between agent threads.

    - `id: string`

      The ID of the message.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The content exchanged between the agents.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

          `minLength: 0`

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

          `minLength: 0`

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `recipient_agent_id: string`

      The ID or name of the receiving agent.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID or name of the sending agent.

      `minLength: 0`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "agent_message"`

      The item type. Always `agent_message`.

      - `"agent_message"`

  - `AgentMcpCallItem`

    A call to a tool on an MCP server.

    - `id: string`

      The ID of the MCP call item.

      `minLength: 0`

    - `arguments: unknown`

      The arguments passed to the MCP tool.

    - `error: unknown`

      The error returned by the MCP tool, if any.

    - `name: string`

      The name of the MCP tool.

      `minLength: 0`

    - `output: unknown`

      The output returned by the MCP tool, if any.

    - `server_label: string`

      The label of the MCP server.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the MCP tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "mcp_call"`

      The item type. Always `mcp_call`.

      - `"mcp_call"`

  - `ComputerUseCallItemResource`

    One execution of the platform-provided computer-use capability.

    - `id: string`

      The ID of the activity item.

      `minLength: 0`

    - `output: Output | null`

      The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot.

      - `image_url: string`

        The complete JPEG image as a base64 data URL.

        `minLength: 0`

      - `type: "computer_screenshot"`

        The content type. Always `computer_screenshot`.

        - `"computer_screenshot"`

    - `status: AgentFunctionCallStatus`

      The execution status of the activity.

    - `title: string | null`

      A model-generated description of the activity, when available.

      `minLength: 0`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "computer_use_call"`

      The item type. Always `computer_use_call`.

      - `"computer_use_call"`

  - `BrowserAuthenticationRequestItemResource`

    A credential-free history record of the emitted login request.

    - `id: string`

      The stable history item ID.

      `minLength: 0`

    - `request: Request`

      A registered form awaiting the application's response.

      - `credential_origin: string | null`

        The registered form or frame origin where values will be entered.

        `minLength: 0`

      - `fields: Array<Field>`

        Controls to render. All submitted values are sensitive.

        `minItems: 0`, `maxItems: 2000`

        - `id: string`

          The field ID to submit as field_id in a fields entry.

          `minLength: 0`

        - `label: string`

          The label to display beside the control.

          `minLength: 0`

        - `required: boolean`

          Whether this control requires a nonempty value.

        - `type: string`

          The rendering type, such as email, password, or text.

          `minLength: 0`

      - `options: Array<Option>`

        Sign-in methods. Empty for a plain form.

        `minItems: 0`, `maxItems: 2000`

        - `id: string`

          The option ID to submit as selected_option.

          `minLength: 0`

        - `field_ids: Array<string>`

          IDs from the registered fields that this method accepts.

          `minItems: 0`, `maxItems: 2000`

        - `label: string`

          The method label to display.

          `minLength: 0`

      - `reason: string | null`

        Why the agent needs the user to sign in.

        `minLength: 0`

      - `type: "browser_authentication"`

        The type of the object. Always `browser_authentication`.

        - `"browser_authentication"`

    - `request_id: string`

      `minLength: 0`

    - `turn_id: string`

      `minLength: 0`

    - `type: "computer_use_approval_request"`

      The item type. Always computer_use_approval_request.

      - `"computer_use_approval_request"`

  - `ComputerUseApprovalRequestResultItemResource`

    A credential-free record of an admitted response, not proof of completion.

    - `id: string`

      The stable history item ID.

      `minLength: 0`

    - `request_id: string`

      The registered request answered by this item.

      `minLength: 0`

    - `response: ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource | ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

      The admitted response, without submitted credential values.

      - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource`

        - `action: "submit"`

          - `"submit"`

        - `selected_option: string | null`

          The chosen sign-in method, or null when no options were offered.

          `minLength: 0`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

      - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

        - `action: "cancel"`

          - `"cancel"`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "computer_use_approval_request_result"`

      - `"computer_use_approval_request_result"`

  - `AgentWebSearchCallItem`

    A web search call produced by the agent.

    - `id: string`

      The ID of the web search call.

      `minLength: 0`

    - `action: WebSearchAction | null`

      The action performed by the web search tool.

      - `WebSearchActionResourceSearch`

        A search query or group of search queries.

        - `queries: Array<string> | null`

          The search queries, when multiple queries were used.

          `minItems: 0`, `maxItems: 2000`

        - `query: string | null`

          The search query, when a single query was used.

          `minLength: 0`

        - `type: "search"`

          The type of the object. Always `search`.

          - `"search"`

      - `WebSearchActionResourceOpenPage`

        Opens a web page.

        - `type: "open_page"`

          The type of the object. Always `open_page`.

          - `"open_page"`

        - `url: string | null`

          The URL of the page that was opened.

          `minLength: 0`

      - `WebSearchActionResourceFindInPage`

        Finds text within a web page.

        - `pattern: string | null`

          The text pattern that was searched for.

          `minLength: 0`

        - `type: "find_in_page"`

          The type of the object. Always `find_in_page`.

          - `"find_in_page"`

        - `url: string | null`

          The URL of the page that was searched.

          `minLength: 0`

      - `WebSearchActionResourceOther`

        Another web search action.

        - `type: "other"`

          The type of the object. Always `other`.

          - `"other"`

    - `status: AgentOutputItemStatus`

      The status of the web search call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "web_search_call"`

      The item type. Always `web_search_call`.

      - `"web_search_call"`

  - `AgentCommandExecutionItem`

    A command execution produced by the agent.

    - `id: string`

      The ID of the command execution item.

      `minLength: 0`

    - `command: string`

      The command that was executed.

      `minLength: 0`

    - `cwd: string | null`

      The working directory used to execute the command.

      `minLength: 0`

    - `duration_ms: number | null`

      The command duration in milliseconds.

      `format: int64`

    - `exit_code: number | null`

      The process exit code, if the command completed.

      `format: int64`

    - `output: string | null`

      The command output, if available.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the command execution.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "command_execution"`

      The item type. Always `command_execution`.

      - `"command_execution"`

  - `AgentCreateSubagentCallItem`

    A request to spawn a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `agent_id: string`

      The ID of the agent that requested the subagent.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The task given to the spawned agent.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

    - `model: string | null`

      The model requested for the spawned agent.

      `minLength: 0`

    - `reasoning_effort: string | null`

      The reasoning effort requested for the spawned agent.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "create_subagent_call"`

      The item type. Always `create_subagent_call`.

      - `"create_subagent_call"`

  - `AgentSendSubagentInputCallItem`

    A request to send input to another agent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The input sent to the receiving agent.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

    - `recipient_agent_id: string`

      The ID of the agent receiving the input.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent sending the input.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "send_subagent_input_call"`

      The item type. Always `send_subagent_input_call`.

      - `"send_subagent_input_call"`

  - `AgentResumeSubagentCallItem`

    A request to resume a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to resume.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the resume.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "resume_subagent_call"`

      The item type. Always `resume_subagent_call`.

      - `"resume_subagent_call"`

  - `AgentWaitForSubagentsCallItem`

    A request to wait for one or more subagents.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_ids: Array<string>`

      The IDs of the agents to wait for.

      `minItems: 0`, `maxItems: 2000`

    - `sender_agent_id: string`

      The ID of the agent waiting for results.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "wait_for_subagents_call"`

      The item type. Always `wait_for_subagents_call`.

      - `"wait_for_subagents_call"`

  - `AgentInterruptSubagentCallItem`

    A request to interrupt a subagent's current turn. The subagent remains available.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to interrupt.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the interrupt.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "interrupt_subagent_call"`

      The item type. Always `interrupt_subagent_call`.

      - `"interrupt_subagent_call"`

  - `AgentCloseSubagentCallItem`

    A request to close a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to close.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the close.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "close_subagent_call"`

      The item type. Always `close_subagent_call`.

      - `"close_subagent_call"`

### Agent Session Message

- `AgentSessionMessage`

  A user or assistant message recorded in a session.

  - `id: string | null`

    The ID of this item, or null for legacy user messages whose ID was not recorded.

    `minLength: 0`

  - `content: Array<AgentSessionMessageContent>`

    The content of the message. User messages contain input text or images; assistant messages contain output text.

    `minItems: 0`, `maxItems: 2000`

    - `MessageContentResourceInputText`

      Text supplied by the user.

      - `text: string`

        The text supplied by the user.

        `minLength: 0`

      - `type: "input_text"`

        The type of the object. Always `input_text`.

        - `"input_text"`

    - `MessageContentResourceInputImage`

      An image supplied by the user.

      - `image_url: string`

        The URL of the image supplied by the user, which may be a base64-encoded data URL.

        `minLength: 0`

      - `type: "input_image"`

        The type of the object. Always `input_image`.

        - `"input_image"`

    - `MessageContentResourceOutputText`

      Text produced by the assistant.

      - `text: string`

        The text produced by the assistant.

        `minLength: 0`

      - `type: "output_text"`

        The type of the object. Always `output_text`.

        - `"output_text"`

  - `phase: "commentary" | "final_answer" | null`

    The phase of an assistant message. Null for user messages.

    - `"commentary"`

      Commentary produced while the agent works.

    - `"final_answer"`

      The agent's final answer.

  - `role: "user" | "assistant"`

    The role of the message author.

    - `"user"`

    - `"assistant"`

  - `status: AgentOutputItemStatus`

    The status of the message. User messages are always `completed`.

    - `"in_progress"`

      The item is in progress.

    - `"completed"`

      The item is complete.

    - `"incomplete"`

      The item stopped before completing.

  - `turn_id: string`

    The ID of the turn that contains this item.

    `minLength: 0`

  - `type: "message"`

    The item type. Always `message`.

    - `"message"`

### Agent Session Message Content

- `AgentSessionMessageContent = MessageContentResourceInputText | MessageContentResourceInputImage | MessageContentResourceOutputText`

  A content part in a session message.

  - `MessageContentResourceInputText`

    Text supplied by the user.

    - `text: string`

      The text supplied by the user.

      `minLength: 0`

    - `type: "input_text"`

      The type of the object. Always `input_text`.

      - `"input_text"`

  - `MessageContentResourceInputImage`

    An image supplied by the user.

    - `image_url: string`

      The URL of the image supplied by the user, which may be a base64-encoded data URL.

      `minLength: 0`

    - `type: "input_image"`

      The type of the object. Always `input_image`.

      - `"input_image"`

  - `MessageContentResourceOutputText`

    Text produced by the assistant.

    - `text: string`

      The text produced by the assistant.

      `minLength: 0`

    - `type: "output_text"`

      The type of the object. Always `output_text`.

      - `"output_text"`

### Agent Session Requires Action Event

- `AgentSessionRequiresActionEvent`

  Emitted when a session is waiting for one or more required actions.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session: AgentSession`

    The session and its current required actions.

    - `id: string`

      The ID of the session.

      `minLength: 0`

    - `agent: Agent`

      The agent running in the session.

      - `id: string`

        The ID of the agent.

        `minLength: 0`

      - `instructions: string | null`

        Custom instructions appended to the agent's default base instructions.

        `minLength: 0`

      - `model: string`

        The model used by the agent.

        `minLength: 0`

      - `multi_agent: MultiAgentConfig`

        Configuration for creating and coordinating subagents.

        - `enabled: boolean`

          Whether subagent tools are enabled. Defaults to false.

        - `max_concurrent_subagents: number | null`

          Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

          `format: int64`, `minimum: 1`, `maximum: 4294967295`

      - `name: string | null`

        The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

        `minLength: 0`

      - `reasoning: AgentReasoning`

        The agent's reasoning configuration.

        - `effort: "none" | "minimal" | "low" | 4 more | null`

          The requested reasoning effort, or `null` when the model selects its own default.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

        - `summary: "concise" | "detailed" | "auto" | null`

          The requested reasoning summary format, or `null` when summaries are disabled.

          - `"concise"`

            Returns a concise reasoning summary when supported.

          - `"detailed"`

            Returns a detailed reasoning summary when supported.

          - `"auto"`

            Automatically selects the most detailed summary supported by the model.

      - `service_tier: "auto" | "default" | "flex" | 3 more`

        The effective service-tier policy for model requests. Defaults to `auto`.

        - `"auto"`

        - `"default"`

        - `"flex"`

        - `"priority"`

        - `"fast"`

        - `"ultrafast"`

      - `text: AgentText`

        Configuration for text generated by the agent.

        - `format: TextFormat`

          The effective output format. Defaults to ordinary text.

          - `TextFormatResourceText`

            Generates ordinary text without a structured-output constraint.

            - `type: "text"`

              The type of the object. Always `text`.

              - `"text"`

          - `TextFormatResourceJSONSchema`

            Constrains generated text to a JSON Schema.

            - `schema: Record<string, unknown>`

              The JSON Schema that generated text must match.

            - `type: "json_schema"`

              The type of the object. Always `json_schema`.

              - `"json_schema"`

        - `verbosity: "low" | "medium" | "high"`

          The amount of text produced by the agent. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

      - `tools: Array<AgentTool>`

        Tools available to the agent.

        `minItems: 0`, `maxItems: 2000`

        - `AgentToolResourceFunction`

          A function defined by the application.

          - `defer_loading: boolean`

            Whether the function is deferred and discovered through tool search.

          - `description: string`

            A description of what the function does.

            `minLength: 0`

          - `name: string`

            The name of the function.

            `minLength: 0`

          - `parameters: Record<string, unknown>`

            A JSON Schema object describing the function's arguments.

          - `type: "function"`

            The type of the object. Always `function`.

            - `"function"`

          - `async?: boolean`

            Whether the agent continues without waiting for the function result.

        - `AgentToolResourceProgrammaticToolCalling`

          Enables calling tools from model-generated code.

          - `enabled: boolean`

            Whether tools can be called from model-generated code.

          - `type: "programmatic_tool_calling"`

            The type of the object. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `AgentToolResourceMcp`

          Tools provided by a remote MCP server.

          - `allowed_tools: Array<string> | null`

            The MCP tools the agent may call.

            `minItems: 0`, `maxItems: 2000`

          - `connection_origin: "service" | "environment"`

            Where outbound MCP HTTP connections originate.

            - `"service"`

            - `"environment"`

          - `credential_id: string | null`

            The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

            `minLength: 0`

          - `request_metadata: Record<string, unknown>`

            Metadata included with requests to this MCP server.

          - `required: boolean`

            Whether this MCP server must initialize before the first turn.

          - `server_label: string`

            A label used to identify the MCP server in tool calls.

            `minLength: 0`

          - `transport: McpTransport`

            The transport used to connect to the MCP server.

            - `McpTransportResourceHTTP`

              Connects to an MCP server over HTTP.

              - `server_url: string`

                The URL of the MCP server.

                `minLength: 0`

              - `type: "http"`

                The type of the object. Always `http`.

                - `"http"`

            - `McpTransportResourceStdio`

              Starts an MCP server as a local process.

              - `args: Array<string>`

                Arguments passed to the MCP server command.

                `minItems: 0`, `maxItems: 2000`

              - `command: string`

                The command used to start the MCP server.

                `minLength: 0`

              - `cwd: string`

                The working directory used to start the MCP server.

                `minLength: 0`

              - `env_vars: Array<string>`

                Environment variable names inherited from the execution environment.

                `minItems: 0`, `maxItems: 2000`

              - `type: "stdio"`

                The type of the object. Always `stdio`.

                - `"stdio"`

          - `type: "mcp"`

            The type of the object. Always `mcp`.

            - `"mcp"`

        - `AgentToolResourceWebSearch`

          Web search.

          - `allowed_domains: Array<string> | null`

            Allowed search domains, or `null` when the search is unrestricted.

            `minItems: 0`, `maxItems: 2000`

          - `context_size: "low" | "medium" | "high"`

            The amount of search context made available to the model. Defaults to `medium`.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `location: Location | null`

            Approximate location used to localize search results, if provided.

            - `city: string | null`

              The city name.

              `minLength: 0`

            - `country: string | null`

              The two-letter ISO country code, such as `US`.

              `minLength: 0`

            - `region: string | null`

              The region or state name.

              `minLength: 0`

            - `timezone: string | null`

              The IANA timezone, such as `America/Los_Angeles`.

              `minLength: 0`

          - `mode: "disabled" | "cached" | "live"`

            The source used for web search results.

            - `"disabled"`

            - `"cached"`

            - `"live"`

          - `type: "web_search"`

            The type of the object. Always `web_search`.

            - `"web_search"`

        - `AgentToolResourceComputerUse`

          Browser use in an OpenAI-hosted session.

          - `include_screenshots: boolean`

            Whether computer tool outputs include screenshots.

          - `type: "computer_use"`

            The type of the object. Always `computer_use`.

            - `"computer_use"`

        - `AgentToolResourceAutomations`

          Lets the agent manage its own scheduled wakeups.

          - `type: "automations"`

            The type of the object. Always `automations`.

            - `"automations"`

      - `compaction?: Compaction`

        The effective context compaction settings.

        - `async: boolean`

          Whether context is compacted in the background. Defaults to true.

      - `experimental?: Experimental`

        The effective experimental settings for the agent.

        - `time_awareness: boolean`

          Whether the model receives periodic current-time reminders.

    - `created_at: number`

      The Unix timestamp, in seconds, when the session was created.

      `format: int64`

    - `environment: Environment`

      The execution environment for the session.

      - `EnvironmentResourceNone`

        The session talks to CCA without selecting or provisioning an execution environment.

        - `type: "none"`

          The type of the object. Always `none`.

          - `"none"`

      - `EnvironmentResourceOpenAIHosted`

        An environment hosted by OpenAI.

        - `id: string`

          The public ID of the environment.

          `minLength: 0`

        - `capability_directories: Array<string>`

          Directories that contain capabilities exposed to the agent.

          `minItems: 0`, `maxItems: 2000`

        - `files: Array<HostedEnvironmentFile>`

          Files available in the environment, excluding their contents.

          `minItems: 0`, `maxItems: 50`

          - `HostedEnvironmentFileID`

            A file copied from the OpenAI Files API.

            - `id: string`

              The session-scoped ID of the file in the execution environment.

              `minLength: 0`

            - `file_id: string`

              The ID of the uploaded file.

              `minLength: 0`

            - `path: string`

              The file's absolute path inside the environment.

              `minLength: 0`

            - `size_bytes: number`

              The decoded file size in bytes.

              `format: int64`, `minimum: 0`

            - `type: "file_id"`

              The type of the object. Always `file_id`.

              - `"file_id"`

          - `HostedEnvironmentFileResourceInline`

            A file supplied inline when the session was created.

            - `id: string`

              The session-scoped ID of the file in the execution environment.

              `minLength: 0`

            - `path: string`

              The file's absolute path inside the environment.

              `minLength: 0`

            - `size_bytes: number`

              The decoded file size in bytes.

              `format: int64`, `minimum: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `network: Network`

          The effective network access policy for the environment.

          - `access: "enabled" | "disabled" | "restricted"`

            The environment's network access mode.

            - `"enabled"`

              Allows unrestricted network access.

            - `"disabled"`

              Disables network access.

            - `"restricted"`

              Applies the configured domain restrictions.

          - `allowed_domains: Array<string>`

            Domains the environment may access when network access is restricted.

            `minItems: 0`, `maxItems: 2000`

        - `packages: Packages`

          Packages installed in the environment.

          - `npm: Array<string>`

            npm packages installed globally in the environment.

            `minItems: 0`, `maxItems: 16384`

          - `python: Array<string>`

            Python packages installed in the environment.

            `minItems: 0`, `maxItems: 16384`

          - `system: Array<string>`

            System packages installed in the environment.

            `minItems: 0`, `maxItems: 16384`

        - `plugins: Array<HostedPlugin>`

          Plugins installed in the environment, excluding their archive contents.

          `minItems: 0`, `maxItems: 2000`

          - `description: string`

            The installed plugin description.

            `minLength: 0`

          - `name: string`

            The installed plugin name.

            `minLength: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

        - `skills: Array<HostedSkill>`

          Skills installed in the environment, excluding their archive contents.

          `minItems: 0`, `maxItems: 2000`

          - `HostedSkillReference`

            A skill installed from the Skills API.

            - `description: string`

              The installed skill description.

              `minLength: 0`

            - `name: string`

              The installed skill name.

              `minLength: 0`

            - `skill_id: string`

              The referenced skill ID.

              `minLength: 0`

            - `type: "skill_reference"`

              The type of the object. Always `skill_reference`.

              - `"skill_reference"`

            - `version: string`

              The concrete skill version installed for this session.

              `minLength: 0`

          - `HostedSkillResourceInline`

            A skill installed from an inline ZIP archive.

            - `description: string`

              The installed skill description.

              `minLength: 0`

            - `name: string`

              The installed skill name.

              `minLength: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `type: "openai_hosted"`

          The type of the object. Always `openai_hosted`.

          - `"openai_hosted"`

        - `container_size?: "small" | "medium" | "large" | null`

          The effective CPU and memory tier, or null when unknown or outside the public tiers.

          - `"small"`

          - `"medium"`

          - `"large"`

        - `desktop?: Desktop`

          The effective desktop configuration.

          - `enabled: boolean`

            Whether the environment provisions a desktop and browser proxy.

      - `EnvironmentResourceSelfHosted`

        An environment hosted by the application.

        - `id: string`

          The public ID of the environment.

          `minLength: 0`

        - `capability_directories: Array<string>`

          Directories that contain capabilities exposed to the agent.

          `minItems: 0`, `maxItems: 2000`

        - `remote_url: string`

          Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

          `minLength: 0`

        - `type: "self_hosted"`

          The type of the object. Always `self_hosted`.

          - `"self_hosted"`

        - `workspace_directory: string`

          The absolute project directory inside the environment. Defaults to `/workspace`.

          `minLength: 0`

    - `error: string | null`

      The error that caused the session to fail, if any.

      `minLength: 0`

    - `last_active_at: number`

      The Unix timestamp, in seconds, when the session was last active.

      `format: int64`

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the session.

    - `object: "agent.session"`

      The object type. Always `agent.session`.

      - `"agent.session"`

    - `required_actions: Array<SessionRequiredActionResourceComputerUseApprovalRequest | SessionRequiredActionResourceFunctionCall | SessionRequiredActionResourceEnvironmentConnection>`

      Actions that must be completed before the session can continue.

      `minItems: 0`, `maxItems: 2000`

      - `SessionRequiredActionResourceComputerUseApprovalRequest`

        Respond to a computer-use request.

        - `request: ComputerUseApprovalRequestKindResourceBrowserAuthentication | ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

          The information needed to render the request.

          - `ComputerUseApprovalRequestKindResourceBrowserAuthentication`

            A registered form awaiting the application's response.

            - `credential_origin: string | null`

              The registered form or frame origin where values will be entered.

              `minLength: 0`

            - `fields: Array<Field>`

              Controls to render. All submitted values are sensitive.

              `minItems: 0`, `maxItems: 2000`

              - `id: string`

                The field ID to submit as field_id in a fields entry.

                `minLength: 0`

              - `label: string`

                The label to display beside the control.

                `minLength: 0`

              - `required: boolean`

                Whether this control requires a nonempty value.

              - `type: string`

                The rendering type, such as email, password, or text.

                `minLength: 0`

            - `options: Array<Option>`

              Sign-in methods. Empty for a plain form.

              `minItems: 0`, `maxItems: 2000`

              - `id: string`

                The option ID to submit as selected_option.

                `minLength: 0`

              - `field_ids: Array<string>`

                IDs from the registered fields that this method accepts.

                `minItems: 0`, `maxItems: 2000`

              - `label: string`

                The method label to display.

                `minLength: 0`

            - `reason: string | null`

              Why the agent needs the user to sign in.

              `minLength: 0`

            - `type: "browser_authentication"`

              The type of the object. Always `browser_authentication`.

              - `"browser_authentication"`

          - `ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

            A browser origin awaiting the application's approval decision.

            - `origin: string`

              The origin the browser needs permission to access.

              `minLength: 0`

            - `reason: string | null`

              The browser's explanation for this request, or null when unavailable.

              `minLength: 0`

            - `type: "browser_origin_access"`

              The type of the object. Always `browser_origin_access`.

              - `"browser_origin_access"`

        - `request_id: string`

          The registered request ID to echo when responding.

          `minLength: 0`

        - `turn_id: string`

          The turn that requested approval.

          `minLength: 0`

        - `type: "computer_use_approval_request"`

          The type of the object. Always `computer_use_approval_request`.

          - `"computer_use_approval_request"`

      - `SessionRequiredActionResourceFunctionCall`

        Run a function tool and submit its result.

        - `arguments: unknown`

          The arguments supplied by the model.

        - `call_id: string`

          The ID to include when submitting the function result.

          `minLength: 0`

        - `name: string`

          The function name.

          `minLength: 0`

        - `turn_id: string`

          The ID of the turn that requested the function call.

          `minLength: 0`

        - `type: "function_call"`

          The type of the object. Always `function_call`.

          - `"function_call"`

      - `SessionRequiredActionResourceEnvironmentConnection`

        Reconnect a session environment.

        - `environment_id: string`

          The ID of the environment to reconnect.

          `minLength: 0`

        - `type: "environment_connection"`

          The type of the object. Always `environment_connection`.

          - `"environment_connection"`

    - `status: "idle" | "in_progress" | "requires_action" | "failed"`

      The current status of the session.

      - `"idle"`

        The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

      - `"in_progress"`

        The session is processing a turn.

      - `"requires_action"`

        The session is waiting for one or more required actions.

      - `"failed"`

        The session failed.

    - `usage: TokenUsage | null`

      Best-effort token usage for the session, or null if unknown. Recorded usage may change.

      - `input_tokens: number`

        The number of input tokens used by the agent.

        `format: int64`

      - `input_tokens_details: InputTokensDetails`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

          `format: int64`

      - `output_tokens: number`

        The number of output tokens generated by the agent.

        `format: int64`

      - `output_tokens_details: OutputTokensDetails`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

          `format: int64`

      - `total_tokens: number`

        The total number of input and output tokens used by the agent.

        `format: int64`

    - `vault_ids: Array<string>`

      The IDs of vaults made available to the session.

      `minItems: 0`, `maxItems: 2000`

    - `prompt_cache_options?: PromptCacheOptions | null`

      Default prompt cache lifetime for turns in this session, when configured.

      - `ttl: "30m" | "12h"`

        - `"30m"`

        - `"12h"`

    - `review?: "none" | "auto_review"`

      Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none.

      - `"none"`

      - `"auto_review"`

    - `spend_control?: SpendControl`

      Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object.

      - `consumed: number | null`

        Best-effort recorded spend floored to whole USD cents, or null when unavailable.

        `minimum: 0`

      - `limit: number`

        The configured positive limit in USD cents.

        `format: int64`, `minimum: 1`, `maximum: 4503599627370495`

  - `type: "agent.session.requires_action"`

    The type of the object. Always `agent.session.requires_action`.

    - `"agent.session.requires_action"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Subagent Active Event

- `AgentSessionSubagentActiveEvent`

  Emitted when a closed subagent successfully resumes.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `subagent: Subagent`

    The subagent that resumed.

    - `id: string`

      The ID of the subagent.

      `minLength: 0`

    - `closed_at: number | null`

      The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume.

      `format: int64`

    - `instructions: Array<AgentContent> | null`

      Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

          `minLength: 0`

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

          `minLength: 0`

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `name: string | null`

      The runner-assigned nickname, or null when unavailable.

      `minLength: 0`

    - `object: "agent.session.subagent"`

      The object type. Always `agent.session.subagent`.

      - `"agent.session.subagent"`

    - `opened_at: number`

      The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it.

      `format: int64`

    - `parent_agent_id: string`

      The ID of the agent that created this subagent.

      `minLength: 0`

    - `session_id: string`

      The ID of the session that owns the subagent.

      `minLength: 0`

    - `status: "active" | "closed"`

      The current status of the subagent.

      - `"active"`

        The subagent remains available, including while idle between turns.

      - `"closed"`

        The subagent is closed.

  - `type: "agent.session.subagent.active"`

    The type of the object. Always `agent.session.subagent.active`.

    - `"agent.session.subagent.active"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Subagent Closed Event

- `AgentSessionSubagentClosedEvent`

  Emitted when a subagent is closed.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `subagent: Subagent`

    The subagent that was closed.

    - `id: string`

      The ID of the subagent.

      `minLength: 0`

    - `closed_at: number | null`

      The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume.

      `format: int64`

    - `instructions: Array<AgentContent> | null`

      Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

          `minLength: 0`

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

          `minLength: 0`

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `name: string | null`

      The runner-assigned nickname, or null when unavailable.

      `minLength: 0`

    - `object: "agent.session.subagent"`

      The object type. Always `agent.session.subagent`.

      - `"agent.session.subagent"`

    - `opened_at: number`

      The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it.

      `format: int64`

    - `parent_agent_id: string`

      The ID of the agent that created this subagent.

      `minLength: 0`

    - `session_id: string`

      The ID of the session that owns the subagent.

      `minLength: 0`

    - `status: "active" | "closed"`

      The current status of the subagent.

      - `"active"`

        The subagent remains available, including while idle between turns.

      - `"closed"`

        The subagent is closed.

  - `type: "agent.session.subagent.closed"`

    The type of the object. Always `agent.session.subagent.closed`.

    - `"agent.session.subagent.closed"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Subagent Created Event

- `AgentSessionSubagentCreatedEvent`

  Emitted when a subagent is created.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `subagent: Subagent`

    The subagent that was created.

    - `id: string`

      The ID of the subagent.

      `minLength: 0`

    - `closed_at: number | null`

      The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume.

      `format: int64`

    - `instructions: Array<AgentContent> | null`

      Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

          `minLength: 0`

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

          `minLength: 0`

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `name: string | null`

      The runner-assigned nickname, or null when unavailable.

      `minLength: 0`

    - `object: "agent.session.subagent"`

      The object type. Always `agent.session.subagent`.

      - `"agent.session.subagent"`

    - `opened_at: number`

      The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it.

      `format: int64`

    - `parent_agent_id: string`

      The ID of the agent that created this subagent.

      `minLength: 0`

    - `session_id: string`

      The ID of the session that owns the subagent.

      `minLength: 0`

    - `status: "active" | "closed"`

      The current status of the subagent.

      - `"active"`

        The subagent remains available, including while idle between turns.

      - `"closed"`

        The subagent is closed.

  - `type: "agent.session.subagent.created"`

    The type of the object. Always `agent.session.subagent.created`.

    - `"agent.session.subagent.created"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn Cancelled Event

- `AgentSessionTurnCancelledEvent`

  Emitted when a turn is cancelled.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn: Turn`

    The cancelled turn.

    - `id: string`

      The ID of the turn.

      `minLength: 0`

    - `agent_id: string`

      The ID of the agent that ran the turn.

      `minLength: 0`

    - `completed_at: number | null`

      The Unix timestamp, in seconds, when the turn reached a terminal state.

      `format: int64`

    - `created_at: number`

      The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

      `format: int64`

    - `error: SessionTurnError | null`

      A customer-safe error. Non-null only for a failed turn.

      - `code: "context_length_exceeded" | "max_output_tokens" | "session_budget_exceeded" | 21 more`

        A stable, machine-readable failure category.

        - `"context_length_exceeded"`

          The request exceeds the model's context window.

        - `"max_output_tokens"`

          The model reached its output token limit before finishing the response.

        - `"session_budget_exceeded"`

          The session has reached its usage budget.

        - `"usage_limit_exceeded"`

          The organization has reached a usage, plan, or billing limit.

        - `"project_spend_limit_exceeded"`

          The project has reached its enforced spend limit.

        - `"organization_spend_limit_exceeded"`

          The organization has reached its enforced spend limit.

        - `"organization_usage_limit_exceeded"`

          The organization has reached its OpenAI-assigned usage limit.

        - `"billing_not_active"`

          Billing is not active for the account.

        - `"credit_balance_exhausted"`

          The organization has no API credits remaining.

        - `"rate_limit_exceeded"`

          The request exceeds the available rate limit.

        - `"flex_unavailable"`

          Flex processing is temporarily unavailable.

        - `"server_overloaded"`

          The model service is temporarily overloaded.

        - `"cyber_policy"`

          The request was rejected by a safety policy.

        - `"misalignment_policy_violation"`

          The request was blocked by the safety systems.

        - `"connection_failed"`

          The request could not connect to the model service.

        - `"server_error"`

          The model service encountered an unexpected error.

        - `"authentication_error"`

          The API credentials are invalid or lack the required access.

        - `"invalid_request"`

          The request contains invalid input or configuration.

        - `"resource_not_found"`

          The requested model or resource is unavailable.

        - `"sandbox_error"`

          The request could not complete in its execution environment.

        - `"executor_version_incompatible"`

          The executor must be upgraded before it can run this turn.

        - `"active_turn_not_steerable"`

          The session cannot accept additional input while a request is running.

        - `"request_timeout"`

          The request timed out before the model service responded.

        - `"internal_error"`

          An unexpected internal error prevented the session request from completing.

      - `message: string`

        A customer-safe explanation of the failure.

        `minLength: 0`

    - `object: "agent.session.turn"`

      The object type. Always `agent.session.turn`.

      - `"agent.session.turn"`

    - `session_id: string`

      The ID of the session that owns the turn.

      `minLength: 0`

    - `started_at: number | null`

      The Unix timestamp, in seconds, when the turn started.

      `format: int64`

    - `status: "queued" | "in_progress" | "waiting" | 3 more`

      The current status of the turn.

      - `"queued"`

        The turn is waiting to start.

      - `"in_progress"`

        The turn is in progress.

      - `"waiting"`

        The turn is waiting for external input.

      - `"completed"`

        The turn completed successfully.

      - `"failed"`

        The turn failed.

      - `"cancelled"`

        The turn was cancelled.

    - `subagent_id: string | null`

      The ID of the subagent that ran the turn, if applicable.

      `minLength: 0`

    - `usage: TokenUsage | null`

      Best-effort token usage for the turn, or null if unknown. Recorded usage may change.

      - `input_tokens: number`

        The number of input tokens used by the agent.

        `format: int64`

      - `input_tokens_details: InputTokensDetails`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

          `format: int64`

      - `output_tokens: number`

        The number of output tokens generated by the agent.

        `format: int64`

      - `output_tokens_details: OutputTokensDetails`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

          `format: int64`

      - `total_tokens: number`

        The total number of input and output tokens used by the agent.

        `format: int64`

    - `prompt_cache_options?: PromptCacheOptions | null`

      Prompt cache lifetime selected when this turn started, including an inherited session TTL. Null when the turn used the model default or no TTL was recorded.

      - `ttl: "30m" | "12h"`

        - `"30m"`

        - `"12h"`

  - `turn_id: string`

    The ID of the turn associated with the event.

    `minLength: 0`

  - `type: "agent.session.turn.cancelled"`

    The type of the object. Always `agent.session.turn.cancelled`.

    - `"agent.session.turn.cancelled"`

  - `usage: TokenUsage | null`

    Token usage by the root agent during the turn, when available.

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn Completed Event

- `AgentSessionTurnCompletedEvent`

  Emitted when a turn completes.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn: Turn`

    The completed turn.

    - `id: string`

      The ID of the turn.

      `minLength: 0`

    - `agent_id: string`

      The ID of the agent that ran the turn.

      `minLength: 0`

    - `completed_at: number | null`

      The Unix timestamp, in seconds, when the turn reached a terminal state.

      `format: int64`

    - `created_at: number`

      The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

      `format: int64`

    - `error: SessionTurnError | null`

      A customer-safe error. Non-null only for a failed turn.

      - `code: "context_length_exceeded" | "max_output_tokens" | "session_budget_exceeded" | 21 more`

        A stable, machine-readable failure category.

        - `"context_length_exceeded"`

          The request exceeds the model's context window.

        - `"max_output_tokens"`

          The model reached its output token limit before finishing the response.

        - `"session_budget_exceeded"`

          The session has reached its usage budget.

        - `"usage_limit_exceeded"`

          The organization has reached a usage, plan, or billing limit.

        - `"project_spend_limit_exceeded"`

          The project has reached its enforced spend limit.

        - `"organization_spend_limit_exceeded"`

          The organization has reached its enforced spend limit.

        - `"organization_usage_limit_exceeded"`

          The organization has reached its OpenAI-assigned usage limit.

        - `"billing_not_active"`

          Billing is not active for the account.

        - `"credit_balance_exhausted"`

          The organization has no API credits remaining.

        - `"rate_limit_exceeded"`

          The request exceeds the available rate limit.

        - `"flex_unavailable"`

          Flex processing is temporarily unavailable.

        - `"server_overloaded"`

          The model service is temporarily overloaded.

        - `"cyber_policy"`

          The request was rejected by a safety policy.

        - `"misalignment_policy_violation"`

          The request was blocked by the safety systems.

        - `"connection_failed"`

          The request could not connect to the model service.

        - `"server_error"`

          The model service encountered an unexpected error.

        - `"authentication_error"`

          The API credentials are invalid or lack the required access.

        - `"invalid_request"`

          The request contains invalid input or configuration.

        - `"resource_not_found"`

          The requested model or resource is unavailable.

        - `"sandbox_error"`

          The request could not complete in its execution environment.

        - `"executor_version_incompatible"`

          The executor must be upgraded before it can run this turn.

        - `"active_turn_not_steerable"`

          The session cannot accept additional input while a request is running.

        - `"request_timeout"`

          The request timed out before the model service responded.

        - `"internal_error"`

          An unexpected internal error prevented the session request from completing.

      - `message: string`

        A customer-safe explanation of the failure.

        `minLength: 0`

    - `object: "agent.session.turn"`

      The object type. Always `agent.session.turn`.

      - `"agent.session.turn"`

    - `session_id: string`

      The ID of the session that owns the turn.

      `minLength: 0`

    - `started_at: number | null`

      The Unix timestamp, in seconds, when the turn started.

      `format: int64`

    - `status: "queued" | "in_progress" | "waiting" | 3 more`

      The current status of the turn.

      - `"queued"`

        The turn is waiting to start.

      - `"in_progress"`

        The turn is in progress.

      - `"waiting"`

        The turn is waiting for external input.

      - `"completed"`

        The turn completed successfully.

      - `"failed"`

        The turn failed.

      - `"cancelled"`

        The turn was cancelled.

    - `subagent_id: string | null`

      The ID of the subagent that ran the turn, if applicable.

      `minLength: 0`

    - `usage: TokenUsage | null`

      Best-effort token usage for the turn, or null if unknown. Recorded usage may change.

      - `input_tokens: number`

        The number of input tokens used by the agent.

        `format: int64`

      - `input_tokens_details: InputTokensDetails`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

          `format: int64`

      - `output_tokens: number`

        The number of output tokens generated by the agent.

        `format: int64`

      - `output_tokens_details: OutputTokensDetails`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

          `format: int64`

      - `total_tokens: number`

        The total number of input and output tokens used by the agent.

        `format: int64`

    - `prompt_cache_options?: PromptCacheOptions | null`

      Prompt cache lifetime selected when this turn started, including an inherited session TTL. Null when the turn used the model default or no TTL was recorded.

      - `ttl: "30m" | "12h"`

        - `"30m"`

        - `"12h"`

  - `turn_id: string`

    The ID of the turn associated with the event.

    `minLength: 0`

  - `type: "agent.session.turn.completed"`

    The type of the object. Always `agent.session.turn.completed`.

    - `"agent.session.turn.completed"`

  - `usage: TokenUsage | null`

    Token usage by the root agent during the turn, when available.

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn Content Part Added Event

- `AgentSessionTurnContentPartAddedEvent`

  Emitted when an output text content part is added.

  - `content_index: number`

    The index of the content part in the message.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `item_id: string`

    The ID of the message item.

    `minLength: 0`

  - `output_index: number`

    The index of the item in the turn output.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `part: OutputText`

    The initial content part.

    - `text: string`

      The text produced by the agent.

      `minLength: 0`

    - `type: "output_text"`

      The content type. Always `output_text`.

      - `"output_text"`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.turn.content_part.added"`

    The type of the object. Always `agent.session.turn.content_part.added`.

    - `"agent.session.turn.content_part.added"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn Content Part Done Event

- `AgentSessionTurnContentPartDoneEvent`

  Emitted when an output content part is complete.

  - `content_index: number`

    The index of the content part in the message.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `item_id: string`

    The ID of the message item.

    `minLength: 0`

  - `output_index: number`

    The index of the item in the turn output.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `part: OutputText`

    The completed content part.

    - `text: string`

      The text produced by the agent.

      `minLength: 0`

    - `type: "output_text"`

      The content type. Always `output_text`.

      - `"output_text"`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.turn.content_part.done"`

    The type of the object. Always `agent.session.turn.content_part.done`.

    - `"agent.session.turn.content_part.done"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn Created Event

- `AgentSessionTurnCreatedEvent`

  Emitted when a turn is created.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn: Turn`

    The turn at the time it was created.

    - `id: string`

      The ID of the turn.

      `minLength: 0`

    - `agent_id: string`

      The ID of the agent that ran the turn.

      `minLength: 0`

    - `completed_at: number | null`

      The Unix timestamp, in seconds, when the turn reached a terminal state.

      `format: int64`

    - `created_at: number`

      The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

      `format: int64`

    - `error: SessionTurnError | null`

      A customer-safe error. Non-null only for a failed turn.

      - `code: "context_length_exceeded" | "max_output_tokens" | "session_budget_exceeded" | 21 more`

        A stable, machine-readable failure category.

        - `"context_length_exceeded"`

          The request exceeds the model's context window.

        - `"max_output_tokens"`

          The model reached its output token limit before finishing the response.

        - `"session_budget_exceeded"`

          The session has reached its usage budget.

        - `"usage_limit_exceeded"`

          The organization has reached a usage, plan, or billing limit.

        - `"project_spend_limit_exceeded"`

          The project has reached its enforced spend limit.

        - `"organization_spend_limit_exceeded"`

          The organization has reached its enforced spend limit.

        - `"organization_usage_limit_exceeded"`

          The organization has reached its OpenAI-assigned usage limit.

        - `"billing_not_active"`

          Billing is not active for the account.

        - `"credit_balance_exhausted"`

          The organization has no API credits remaining.

        - `"rate_limit_exceeded"`

          The request exceeds the available rate limit.

        - `"flex_unavailable"`

          Flex processing is temporarily unavailable.

        - `"server_overloaded"`

          The model service is temporarily overloaded.

        - `"cyber_policy"`

          The request was rejected by a safety policy.

        - `"misalignment_policy_violation"`

          The request was blocked by the safety systems.

        - `"connection_failed"`

          The request could not connect to the model service.

        - `"server_error"`

          The model service encountered an unexpected error.

        - `"authentication_error"`

          The API credentials are invalid or lack the required access.

        - `"invalid_request"`

          The request contains invalid input or configuration.

        - `"resource_not_found"`

          The requested model or resource is unavailable.

        - `"sandbox_error"`

          The request could not complete in its execution environment.

        - `"executor_version_incompatible"`

          The executor must be upgraded before it can run this turn.

        - `"active_turn_not_steerable"`

          The session cannot accept additional input while a request is running.

        - `"request_timeout"`

          The request timed out before the model service responded.

        - `"internal_error"`

          An unexpected internal error prevented the session request from completing.

      - `message: string`

        A customer-safe explanation of the failure.

        `minLength: 0`

    - `object: "agent.session.turn"`

      The object type. Always `agent.session.turn`.

      - `"agent.session.turn"`

    - `session_id: string`

      The ID of the session that owns the turn.

      `minLength: 0`

    - `started_at: number | null`

      The Unix timestamp, in seconds, when the turn started.

      `format: int64`

    - `status: "queued" | "in_progress" | "waiting" | 3 more`

      The current status of the turn.

      - `"queued"`

        The turn is waiting to start.

      - `"in_progress"`

        The turn is in progress.

      - `"waiting"`

        The turn is waiting for external input.

      - `"completed"`

        The turn completed successfully.

      - `"failed"`

        The turn failed.

      - `"cancelled"`

        The turn was cancelled.

    - `subagent_id: string | null`

      The ID of the subagent that ran the turn, if applicable.

      `minLength: 0`

    - `usage: TokenUsage | null`

      Best-effort token usage for the turn, or null if unknown. Recorded usage may change.

      - `input_tokens: number`

        The number of input tokens used by the agent.

        `format: int64`

      - `input_tokens_details: InputTokensDetails`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

          `format: int64`

      - `output_tokens: number`

        The number of output tokens generated by the agent.

        `format: int64`

      - `output_tokens_details: OutputTokensDetails`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

          `format: int64`

      - `total_tokens: number`

        The total number of input and output tokens used by the agent.

        `format: int64`

    - `prompt_cache_options?: PromptCacheOptions | null`

      Prompt cache lifetime selected when this turn started, including an inherited session TTL. Null when the turn used the model default or no TTL was recorded.

      - `ttl: "30m" | "12h"`

        - `"30m"`

        - `"12h"`

  - `turn_id: string`

    The ID of the turn associated with the event.

    `minLength: 0`

  - `type: "agent.session.turn.created"`

    The type of the object. Always `agent.session.turn.created`.

    - `"agent.session.turn.created"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn Failed Event

- `AgentSessionTurnFailedEvent`

  Emitted when a turn fails.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn: Turn`

    The failed turn.

    - `id: string`

      The ID of the turn.

      `minLength: 0`

    - `agent_id: string`

      The ID of the agent that ran the turn.

      `minLength: 0`

    - `completed_at: number | null`

      The Unix timestamp, in seconds, when the turn reached a terminal state.

      `format: int64`

    - `created_at: number`

      The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

      `format: int64`

    - `error: SessionTurnError | null`

      A customer-safe error. Non-null only for a failed turn.

      - `code: "context_length_exceeded" | "max_output_tokens" | "session_budget_exceeded" | 21 more`

        A stable, machine-readable failure category.

        - `"context_length_exceeded"`

          The request exceeds the model's context window.

        - `"max_output_tokens"`

          The model reached its output token limit before finishing the response.

        - `"session_budget_exceeded"`

          The session has reached its usage budget.

        - `"usage_limit_exceeded"`

          The organization has reached a usage, plan, or billing limit.

        - `"project_spend_limit_exceeded"`

          The project has reached its enforced spend limit.

        - `"organization_spend_limit_exceeded"`

          The organization has reached its enforced spend limit.

        - `"organization_usage_limit_exceeded"`

          The organization has reached its OpenAI-assigned usage limit.

        - `"billing_not_active"`

          Billing is not active for the account.

        - `"credit_balance_exhausted"`

          The organization has no API credits remaining.

        - `"rate_limit_exceeded"`

          The request exceeds the available rate limit.

        - `"flex_unavailable"`

          Flex processing is temporarily unavailable.

        - `"server_overloaded"`

          The model service is temporarily overloaded.

        - `"cyber_policy"`

          The request was rejected by a safety policy.

        - `"misalignment_policy_violation"`

          The request was blocked by the safety systems.

        - `"connection_failed"`

          The request could not connect to the model service.

        - `"server_error"`

          The model service encountered an unexpected error.

        - `"authentication_error"`

          The API credentials are invalid or lack the required access.

        - `"invalid_request"`

          The request contains invalid input or configuration.

        - `"resource_not_found"`

          The requested model or resource is unavailable.

        - `"sandbox_error"`

          The request could not complete in its execution environment.

        - `"executor_version_incompatible"`

          The executor must be upgraded before it can run this turn.

        - `"active_turn_not_steerable"`

          The session cannot accept additional input while a request is running.

        - `"request_timeout"`

          The request timed out before the model service responded.

        - `"internal_error"`

          An unexpected internal error prevented the session request from completing.

      - `message: string`

        A customer-safe explanation of the failure.

        `minLength: 0`

    - `object: "agent.session.turn"`

      The object type. Always `agent.session.turn`.

      - `"agent.session.turn"`

    - `session_id: string`

      The ID of the session that owns the turn.

      `minLength: 0`

    - `started_at: number | null`

      The Unix timestamp, in seconds, when the turn started.

      `format: int64`

    - `status: "queued" | "in_progress" | "waiting" | 3 more`

      The current status of the turn.

      - `"queued"`

        The turn is waiting to start.

      - `"in_progress"`

        The turn is in progress.

      - `"waiting"`

        The turn is waiting for external input.

      - `"completed"`

        The turn completed successfully.

      - `"failed"`

        The turn failed.

      - `"cancelled"`

        The turn was cancelled.

    - `subagent_id: string | null`

      The ID of the subagent that ran the turn, if applicable.

      `minLength: 0`

    - `usage: TokenUsage | null`

      Best-effort token usage for the turn, or null if unknown. Recorded usage may change.

      - `input_tokens: number`

        The number of input tokens used by the agent.

        `format: int64`

      - `input_tokens_details: InputTokensDetails`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

          `format: int64`

      - `output_tokens: number`

        The number of output tokens generated by the agent.

        `format: int64`

      - `output_tokens_details: OutputTokensDetails`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

          `format: int64`

      - `total_tokens: number`

        The total number of input and output tokens used by the agent.

        `format: int64`

    - `prompt_cache_options?: PromptCacheOptions | null`

      Prompt cache lifetime selected when this turn started, including an inherited session TTL. Null when the turn used the model default or no TTL was recorded.

      - `ttl: "30m" | "12h"`

        - `"30m"`

        - `"12h"`

  - `turn_id: string`

    The ID of the turn associated with the event.

    `minLength: 0`

  - `type: "agent.session.turn.failed"`

    The type of the object. Always `agent.session.turn.failed`.

    - `"agent.session.turn.failed"`

  - `usage: TokenUsage | null`

    Token usage by the root agent during the turn, when available.

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn In Progress Event

- `AgentSessionTurnInProgressEvent`

  Emitted when a turn starts running.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn: Turn`

    The turn at the time it started running.

    - `id: string`

      The ID of the turn.

      `minLength: 0`

    - `agent_id: string`

      The ID of the agent that ran the turn.

      `minLength: 0`

    - `completed_at: number | null`

      The Unix timestamp, in seconds, when the turn reached a terminal state.

      `format: int64`

    - `created_at: number`

      The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

      `format: int64`

    - `error: SessionTurnError | null`

      A customer-safe error. Non-null only for a failed turn.

      - `code: "context_length_exceeded" | "max_output_tokens" | "session_budget_exceeded" | 21 more`

        A stable, machine-readable failure category.

        - `"context_length_exceeded"`

          The request exceeds the model's context window.

        - `"max_output_tokens"`

          The model reached its output token limit before finishing the response.

        - `"session_budget_exceeded"`

          The session has reached its usage budget.

        - `"usage_limit_exceeded"`

          The organization has reached a usage, plan, or billing limit.

        - `"project_spend_limit_exceeded"`

          The project has reached its enforced spend limit.

        - `"organization_spend_limit_exceeded"`

          The organization has reached its enforced spend limit.

        - `"organization_usage_limit_exceeded"`

          The organization has reached its OpenAI-assigned usage limit.

        - `"billing_not_active"`

          Billing is not active for the account.

        - `"credit_balance_exhausted"`

          The organization has no API credits remaining.

        - `"rate_limit_exceeded"`

          The request exceeds the available rate limit.

        - `"flex_unavailable"`

          Flex processing is temporarily unavailable.

        - `"server_overloaded"`

          The model service is temporarily overloaded.

        - `"cyber_policy"`

          The request was rejected by a safety policy.

        - `"misalignment_policy_violation"`

          The request was blocked by the safety systems.

        - `"connection_failed"`

          The request could not connect to the model service.

        - `"server_error"`

          The model service encountered an unexpected error.

        - `"authentication_error"`

          The API credentials are invalid or lack the required access.

        - `"invalid_request"`

          The request contains invalid input or configuration.

        - `"resource_not_found"`

          The requested model or resource is unavailable.

        - `"sandbox_error"`

          The request could not complete in its execution environment.

        - `"executor_version_incompatible"`

          The executor must be upgraded before it can run this turn.

        - `"active_turn_not_steerable"`

          The session cannot accept additional input while a request is running.

        - `"request_timeout"`

          The request timed out before the model service responded.

        - `"internal_error"`

          An unexpected internal error prevented the session request from completing.

      - `message: string`

        A customer-safe explanation of the failure.

        `minLength: 0`

    - `object: "agent.session.turn"`

      The object type. Always `agent.session.turn`.

      - `"agent.session.turn"`

    - `session_id: string`

      The ID of the session that owns the turn.

      `minLength: 0`

    - `started_at: number | null`

      The Unix timestamp, in seconds, when the turn started.

      `format: int64`

    - `status: "queued" | "in_progress" | "waiting" | 3 more`

      The current status of the turn.

      - `"queued"`

        The turn is waiting to start.

      - `"in_progress"`

        The turn is in progress.

      - `"waiting"`

        The turn is waiting for external input.

      - `"completed"`

        The turn completed successfully.

      - `"failed"`

        The turn failed.

      - `"cancelled"`

        The turn was cancelled.

    - `subagent_id: string | null`

      The ID of the subagent that ran the turn, if applicable.

      `minLength: 0`

    - `usage: TokenUsage | null`

      Best-effort token usage for the turn, or null if unknown. Recorded usage may change.

      - `input_tokens: number`

        The number of input tokens used by the agent.

        `format: int64`

      - `input_tokens_details: InputTokensDetails`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

          `format: int64`

      - `output_tokens: number`

        The number of output tokens generated by the agent.

        `format: int64`

      - `output_tokens_details: OutputTokensDetails`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

          `format: int64`

      - `total_tokens: number`

        The total number of input and output tokens used by the agent.

        `format: int64`

    - `prompt_cache_options?: PromptCacheOptions | null`

      Prompt cache lifetime selected when this turn started, including an inherited session TTL. Null when the turn used the model default or no TTL was recorded.

      - `ttl: "30m" | "12h"`

        - `"30m"`

        - `"12h"`

  - `turn_id: string`

    The ID of the turn associated with the event.

    `minLength: 0`

  - `type: "agent.session.turn.in_progress"`

    The type of the object. Always `agent.session.turn.in_progress`.

    - `"agent.session.turn.in_progress"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn Item Added Event

- `AgentSessionTurnItemAddedEvent`

  Emitted when an item is added to a turn.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `item: AgentSessionItem`

    The item that was added.

    - `AgentSessionMessage`

      A user or assistant message recorded in a session.

      - `id: string | null`

        The ID of this item, or null for legacy user messages whose ID was not recorded.

        `minLength: 0`

      - `content: Array<AgentSessionMessageContent>`

        The content of the message. User messages contain input text or images; assistant messages contain output text.

        `minItems: 0`, `maxItems: 2000`

        - `MessageContentResourceInputText`

          Text supplied by the user.

          - `text: string`

            The text supplied by the user.

            `minLength: 0`

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `MessageContentResourceInputImage`

          An image supplied by the user.

          - `image_url: string`

            The URL of the image supplied by the user, which may be a base64-encoded data URL.

            `minLength: 0`

          - `type: "input_image"`

            The type of the object. Always `input_image`.

            - `"input_image"`

        - `MessageContentResourceOutputText`

          Text produced by the assistant.

          - `text: string`

            The text produced by the assistant.

            `minLength: 0`

          - `type: "output_text"`

            The type of the object. Always `output_text`.

            - `"output_text"`

      - `phase: "commentary" | "final_answer" | null`

        The phase of an assistant message. Null for user messages.

        - `"commentary"`

          Commentary produced while the agent works.

        - `"final_answer"`

          The agent's final answer.

      - `role: "user" | "assistant"`

        The role of the message author.

        - `"user"`

        - `"assistant"`

      - `status: AgentOutputItemStatus`

        The status of the message. User messages are always `completed`.

        - `"in_progress"`

          The item is in progress.

        - `"completed"`

          The item is complete.

        - `"incomplete"`

          The item stopped before completing.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "message"`

        The item type. Always `message`.

        - `"message"`

    - `AgentReasoningItem`

      A reasoning item produced by the agent.

      - `id: string`

        The ID of the reasoning item.

        `minLength: 0`

      - `status: AgentOutputItemStatus | null`

        The status of the reasoning item.

      - `summary: Array<SummaryText>`

        The reasoning summaries produced by the agent.

        `minItems: 0`, `maxItems: 2000`

        - `text: string`

          The reasoning summary text.

          `minLength: 0`

        - `type: "summary_text"`

          The content type. Always `summary_text`.

          - `"summary_text"`

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "reasoning"`

        The item type. Always `reasoning`.

        - `"reasoning"`

    - `AgentFunctionCallItem`

      A function call produced by the agent.

      - `id: string`

        The ID of the function call item.

        `minLength: 0`

      - `arguments: unknown`

        The arguments to pass to the function.

      - `call_id: string`

        The ID used to submit the function result.

        `minLength: 0`

      - `name: string`

        The name of the function to call.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the function call.

        - `"in_progress"`

          The call is in progress.

        - `"completed"`

          The call completed successfully.

        - `"failed"`

          The call failed.

        - `"incomplete"`

          The call stopped before completing.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "function_call"`

        The item type. Always `function_call`.

        - `"function_call"`

    - `FunctionCallOutputItemResource`

      The result supplied for a function call.

      - `id: string`

        The ID of the function call output item.

        `minLength: 0`

      - `call_id: string`

        The ID of the function call that produced this output.

        `minLength: 0`

      - `error: string | null`

        The error message, if the call failed.

        `minLength: 0`

      - `output: AgentFunctionCallOutput | null`

        The function result, if the call succeeded.

        - `string`

        - `Array<InputContent>`

          - `InputContentResourceInputText`

            Text input recorded in a session item.

            - `text: string`

              The text supplied to the agent.

              `minLength: 0`

            - `type: "input_text"`

              The type of the object. Always `input_text`.

              - `"input_text"`

          - `InputContentResourceInputImage`

            Image input recorded in a session item.

            - `image_url: string`

              The URL of the image supplied to the agent, which may be a base64-encoded data URL.

              `minLength: 0`

            - `type: "input_image"`

              The type of the object. Always `input_image`.

              - `"input_image"`

      - `status: AgentFunctionCallStatus`

        The status of the function call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "function_call_output"`

        The item type. Always `function_call_output`.

        - `"function_call_output"`

    - `AgentMessageItemResource`

      A message exchanged between agent threads.

      - `id: string`

        The ID of the message.

        `minLength: 0`

      - `content: Array<AgentContent>`

        The content exchanged between the agents.

        `minItems: 0`, `maxItems: 2000`

        - `OutputText`

          A text content part produced by the agent.

          - `text: string`

            The text produced by the agent.

            `minLength: 0`

          - `type: "output_text"`

            The content type. Always `output_text`.

            - `"output_text"`

        - `EncryptedContentResource`

          Encrypted content exchanged between agents.

          - `encrypted_content: string`

            The encrypted content payload.

            `minLength: 0`

          - `type: "encrypted_content"`

            The content type. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient_agent_id: string`

        The ID or name of the receiving agent.

        `minLength: 0`

      - `sender_agent_id: string`

        The ID or name of the sending agent.

        `minLength: 0`

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "agent_message"`

        The item type. Always `agent_message`.

        - `"agent_message"`

    - `AgentMcpCallItem`

      A call to a tool on an MCP server.

      - `id: string`

        The ID of the MCP call item.

        `minLength: 0`

      - `arguments: unknown`

        The arguments passed to the MCP tool.

      - `error: unknown`

        The error returned by the MCP tool, if any.

      - `name: string`

        The name of the MCP tool.

        `minLength: 0`

      - `output: unknown`

        The output returned by the MCP tool, if any.

      - `server_label: string`

        The label of the MCP server.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the MCP tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "mcp_call"`

        The item type. Always `mcp_call`.

        - `"mcp_call"`

    - `ComputerUseCallItemResource`

      One execution of the platform-provided computer-use capability.

      - `id: string`

        The ID of the activity item.

        `minLength: 0`

      - `output: Output | null`

        The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot.

        - `image_url: string`

          The complete JPEG image as a base64 data URL.

          `minLength: 0`

        - `type: "computer_screenshot"`

          The content type. Always `computer_screenshot`.

          - `"computer_screenshot"`

      - `status: AgentFunctionCallStatus`

        The execution status of the activity.

      - `title: string | null`

        A model-generated description of the activity, when available.

        `minLength: 0`

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "computer_use_call"`

        The item type. Always `computer_use_call`.

        - `"computer_use_call"`

    - `BrowserAuthenticationRequestItemResource`

      A credential-free history record of the emitted login request.

      - `id: string`

        The stable history item ID.

        `minLength: 0`

      - `request: Request`

        A registered form awaiting the application's response.

        - `credential_origin: string | null`

          The registered form or frame origin where values will be entered.

          `minLength: 0`

        - `fields: Array<Field>`

          Controls to render. All submitted values are sensitive.

          `minItems: 0`, `maxItems: 2000`

          - `id: string`

            The field ID to submit as field_id in a fields entry.

            `minLength: 0`

          - `label: string`

            The label to display beside the control.

            `minLength: 0`

          - `required: boolean`

            Whether this control requires a nonempty value.

          - `type: string`

            The rendering type, such as email, password, or text.

            `minLength: 0`

        - `options: Array<Option>`

          Sign-in methods. Empty for a plain form.

          `minItems: 0`, `maxItems: 2000`

          - `id: string`

            The option ID to submit as selected_option.

            `minLength: 0`

          - `field_ids: Array<string>`

            IDs from the registered fields that this method accepts.

            `minItems: 0`, `maxItems: 2000`

          - `label: string`

            The method label to display.

            `minLength: 0`

        - `reason: string | null`

          Why the agent needs the user to sign in.

          `minLength: 0`

        - `type: "browser_authentication"`

          The type of the object. Always `browser_authentication`.

          - `"browser_authentication"`

      - `request_id: string`

        `minLength: 0`

      - `turn_id: string`

        `minLength: 0`

      - `type: "computer_use_approval_request"`

        The item type. Always computer_use_approval_request.

        - `"computer_use_approval_request"`

    - `ComputerUseApprovalRequestResultItemResource`

      A credential-free record of an admitted response, not proof of completion.

      - `id: string`

        The stable history item ID.

        `minLength: 0`

      - `request_id: string`

        The registered request answered by this item.

        `minLength: 0`

      - `response: ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource | ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

        The admitted response, without submitted credential values.

        - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource`

          - `action: "submit"`

            - `"submit"`

          - `selected_option: string | null`

            The chosen sign-in method, or null when no options were offered.

            `minLength: 0`

          - `type: "browser_authentication"`

            - `"browser_authentication"`

        - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

          - `action: "cancel"`

            - `"cancel"`

          - `type: "browser_authentication"`

            - `"browser_authentication"`

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "computer_use_approval_request_result"`

        - `"computer_use_approval_request_result"`

    - `AgentWebSearchCallItem`

      A web search call produced by the agent.

      - `id: string`

        The ID of the web search call.

        `minLength: 0`

      - `action: WebSearchAction | null`

        The action performed by the web search tool.

        - `WebSearchActionResourceSearch`

          A search query or group of search queries.

          - `queries: Array<string> | null`

            The search queries, when multiple queries were used.

            `minItems: 0`, `maxItems: 2000`

          - `query: string | null`

            The search query, when a single query was used.

            `minLength: 0`

          - `type: "search"`

            The type of the object. Always `search`.

            - `"search"`

        - `WebSearchActionResourceOpenPage`

          Opens a web page.

          - `type: "open_page"`

            The type of the object. Always `open_page`.

            - `"open_page"`

          - `url: string | null`

            The URL of the page that was opened.

            `minLength: 0`

        - `WebSearchActionResourceFindInPage`

          Finds text within a web page.

          - `pattern: string | null`

            The text pattern that was searched for.

            `minLength: 0`

          - `type: "find_in_page"`

            The type of the object. Always `find_in_page`.

            - `"find_in_page"`

          - `url: string | null`

            The URL of the page that was searched.

            `minLength: 0`

        - `WebSearchActionResourceOther`

          Another web search action.

          - `type: "other"`

            The type of the object. Always `other`.

            - `"other"`

      - `status: AgentOutputItemStatus`

        The status of the web search call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "web_search_call"`

        The item type. Always `web_search_call`.

        - `"web_search_call"`

    - `AgentCommandExecutionItem`

      A command execution produced by the agent.

      - `id: string`

        The ID of the command execution item.

        `minLength: 0`

      - `command: string`

        The command that was executed.

        `minLength: 0`

      - `cwd: string | null`

        The working directory used to execute the command.

        `minLength: 0`

      - `duration_ms: number | null`

        The command duration in milliseconds.

        `format: int64`

      - `exit_code: number | null`

        The process exit code, if the command completed.

        `format: int64`

      - `output: string | null`

        The command output, if available.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the command execution.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "command_execution"`

        The item type. Always `command_execution`.

        - `"command_execution"`

    - `AgentCreateSubagentCallItem`

      A request to spawn a subagent.

      - `id: string`

        The ID of the tool call item.

        `minLength: 0`

      - `agent_id: string`

        The ID of the agent that requested the subagent.

        `minLength: 0`

      - `content: Array<AgentContent>`

        The task given to the spawned agent.

        `minItems: 0`, `maxItems: 2000`

        - `OutputText`

          A text content part produced by the agent.

        - `EncryptedContentResource`

          Encrypted content exchanged between agents.

      - `model: string | null`

        The model requested for the spawned agent.

        `minLength: 0`

      - `reasoning_effort: string | null`

        The reasoning effort requested for the spawned agent.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "create_subagent_call"`

        The item type. Always `create_subagent_call`.

        - `"create_subagent_call"`

    - `AgentSendSubagentInputCallItem`

      A request to send input to another agent.

      - `id: string`

        The ID of the tool call item.

        `minLength: 0`

      - `content: Array<AgentContent>`

        The input sent to the receiving agent.

        `minItems: 0`, `maxItems: 2000`

        - `OutputText`

          A text content part produced by the agent.

        - `EncryptedContentResource`

          Encrypted content exchanged between agents.

      - `recipient_agent_id: string`

        The ID of the agent receiving the input.

        `minLength: 0`

      - `sender_agent_id: string`

        The ID of the agent sending the input.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "send_subagent_input_call"`

        The item type. Always `send_subagent_input_call`.

        - `"send_subagent_input_call"`

    - `AgentResumeSubagentCallItem`

      A request to resume a subagent.

      - `id: string`

        The ID of the tool call item.

        `minLength: 0`

      - `recipient_agent_id: string`

        The ID of the agent to resume.

        `minLength: 0`

      - `sender_agent_id: string`

        The ID of the agent requesting the resume.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "resume_subagent_call"`

        The item type. Always `resume_subagent_call`.

        - `"resume_subagent_call"`

    - `AgentWaitForSubagentsCallItem`

      A request to wait for one or more subagents.

      - `id: string`

        The ID of the tool call item.

        `minLength: 0`

      - `recipient_agent_ids: Array<string>`

        The IDs of the agents to wait for.

        `minItems: 0`, `maxItems: 2000`

      - `sender_agent_id: string`

        The ID of the agent waiting for results.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "wait_for_subagents_call"`

        The item type. Always `wait_for_subagents_call`.

        - `"wait_for_subagents_call"`

    - `AgentInterruptSubagentCallItem`

      A request to interrupt a subagent's current turn. The subagent remains available.

      - `id: string`

        The ID of the tool call item.

        `minLength: 0`

      - `recipient_agent_id: string`

        The ID of the agent to interrupt.

        `minLength: 0`

      - `sender_agent_id: string`

        The ID of the agent requesting the interrupt.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "interrupt_subagent_call"`

        The item type. Always `interrupt_subagent_call`.

        - `"interrupt_subagent_call"`

    - `AgentCloseSubagentCallItem`

      A request to close a subagent.

      - `id: string`

        The ID of the tool call item.

        `minLength: 0`

      - `recipient_agent_id: string`

        The ID of the agent to close.

        `minLength: 0`

      - `sender_agent_id: string`

        The ID of the agent requesting the close.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "close_subagent_call"`

        The item type. Always `close_subagent_call`.

        - `"close_subagent_call"`

  - `output_index: number | null`

    The index of the item in the turn output, when the item is agent output.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.turn.item.added"`

    The type of the object. Always `agent.session.turn.item.added`.

    - `"agent.session.turn.item.added"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn Item Done Event

- `AgentSessionTurnItemDoneEvent`

  Emitted when an output item is complete.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `item: AgentOutputItem`

    The completed output item.

    - `AgentSessionAssistantMessage`

      An assistant message produced by the agent.

      - `id: string`

        The ID of the message.

        `minLength: 0`

      - `content: Array<OutputText>`

        The content of the message.

        `minItems: 0`, `maxItems: 2000`

        - `text: string`

          The text produced by the agent.

          `minLength: 0`

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `phase: "commentary" | "final_answer" | null`

        The phase of the assistant message.

        - `"commentary"`

          Commentary produced while the agent works.

        - `"final_answer"`

          The agent's final answer.

      - `role: "assistant"`

        The role of the message author. Always `assistant`.

        - `"assistant"`

      - `status: AgentOutputItemStatus`

        The status of the message.

        - `"in_progress"`

          The item is in progress.

        - `"completed"`

          The item is complete.

        - `"incomplete"`

          The item stopped before completing.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "message"`

        The item type. Always `message`.

        - `"message"`

    - `AgentReasoningItem`

      A reasoning item produced by the agent.

      - `id: string`

        The ID of the reasoning item.

        `minLength: 0`

      - `status: AgentOutputItemStatus | null`

        The status of the reasoning item.

      - `summary: Array<SummaryText>`

        The reasoning summaries produced by the agent.

        `minItems: 0`, `maxItems: 2000`

        - `text: string`

          The reasoning summary text.

          `minLength: 0`

        - `type: "summary_text"`

          The content type. Always `summary_text`.

          - `"summary_text"`

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "reasoning"`

        The item type. Always `reasoning`.

        - `"reasoning"`

    - `AgentFunctionCallItem`

      A function call produced by the agent.

      - `id: string`

        The ID of the function call item.

        `minLength: 0`

      - `arguments: unknown`

        The arguments to pass to the function.

      - `call_id: string`

        The ID used to submit the function result.

        `minLength: 0`

      - `name: string`

        The name of the function to call.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the function call.

        - `"in_progress"`

          The call is in progress.

        - `"completed"`

          The call completed successfully.

        - `"failed"`

          The call failed.

        - `"incomplete"`

          The call stopped before completing.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "function_call"`

        The item type. Always `function_call`.

        - `"function_call"`

    - `AgentMcpCallItem`

      A call to a tool on an MCP server.

      - `id: string`

        The ID of the MCP call item.

        `minLength: 0`

      - `arguments: unknown`

        The arguments passed to the MCP tool.

      - `error: unknown`

        The error returned by the MCP tool, if any.

      - `name: string`

        The name of the MCP tool.

        `minLength: 0`

      - `output: unknown`

        The output returned by the MCP tool, if any.

      - `server_label: string`

        The label of the MCP server.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the MCP tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "mcp_call"`

        The item type. Always `mcp_call`.

        - `"mcp_call"`

    - `ComputerUseCallItemResource`

      One execution of the platform-provided computer-use capability.

      - `id: string`

        The ID of the activity item.

        `minLength: 0`

      - `output: Output | null`

        The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot.

        - `image_url: string`

          The complete JPEG image as a base64 data URL.

          `minLength: 0`

        - `type: "computer_screenshot"`

          The content type. Always `computer_screenshot`.

          - `"computer_screenshot"`

      - `status: AgentFunctionCallStatus`

        The execution status of the activity.

      - `title: string | null`

        A model-generated description of the activity, when available.

        `minLength: 0`

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "computer_use_call"`

        The item type. Always `computer_use_call`.

        - `"computer_use_call"`

    - `BrowserAuthenticationRequestItemResource`

      A credential-free history record of the emitted login request.

      - `id: string`

        The stable history item ID.

        `minLength: 0`

      - `request: Request`

        A registered form awaiting the application's response.

        - `credential_origin: string | null`

          The registered form or frame origin where values will be entered.

          `minLength: 0`

        - `fields: Array<Field>`

          Controls to render. All submitted values are sensitive.

          `minItems: 0`, `maxItems: 2000`

          - `id: string`

            The field ID to submit as field_id in a fields entry.

            `minLength: 0`

          - `label: string`

            The label to display beside the control.

            `minLength: 0`

          - `required: boolean`

            Whether this control requires a nonempty value.

          - `type: string`

            The rendering type, such as email, password, or text.

            `minLength: 0`

        - `options: Array<Option>`

          Sign-in methods. Empty for a plain form.

          `minItems: 0`, `maxItems: 2000`

          - `id: string`

            The option ID to submit as selected_option.

            `minLength: 0`

          - `field_ids: Array<string>`

            IDs from the registered fields that this method accepts.

            `minItems: 0`, `maxItems: 2000`

          - `label: string`

            The method label to display.

            `minLength: 0`

        - `reason: string | null`

          Why the agent needs the user to sign in.

          `minLength: 0`

        - `type: "browser_authentication"`

          The type of the object. Always `browser_authentication`.

          - `"browser_authentication"`

      - `request_id: string`

        `minLength: 0`

      - `turn_id: string`

        `minLength: 0`

      - `type: "computer_use_approval_request"`

        The item type. Always computer_use_approval_request.

        - `"computer_use_approval_request"`

    - `AgentWebSearchCallItem`

      A web search call produced by the agent.

      - `id: string`

        The ID of the web search call.

        `minLength: 0`

      - `action: WebSearchAction | null`

        The action performed by the web search tool.

        - `WebSearchActionResourceSearch`

          A search query or group of search queries.

          - `queries: Array<string> | null`

            The search queries, when multiple queries were used.

            `minItems: 0`, `maxItems: 2000`

          - `query: string | null`

            The search query, when a single query was used.

            `minLength: 0`

          - `type: "search"`

            The type of the object. Always `search`.

            - `"search"`

        - `WebSearchActionResourceOpenPage`

          Opens a web page.

          - `type: "open_page"`

            The type of the object. Always `open_page`.

            - `"open_page"`

          - `url: string | null`

            The URL of the page that was opened.

            `minLength: 0`

        - `WebSearchActionResourceFindInPage`

          Finds text within a web page.

          - `pattern: string | null`

            The text pattern that was searched for.

            `minLength: 0`

          - `type: "find_in_page"`

            The type of the object. Always `find_in_page`.

            - `"find_in_page"`

          - `url: string | null`

            The URL of the page that was searched.

            `minLength: 0`

        - `WebSearchActionResourceOther`

          Another web search action.

          - `type: "other"`

            The type of the object. Always `other`.

            - `"other"`

      - `status: AgentOutputItemStatus`

        The status of the web search call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "web_search_call"`

        The item type. Always `web_search_call`.

        - `"web_search_call"`

    - `AgentCommandExecutionItem`

      A command execution produced by the agent.

      - `id: string`

        The ID of the command execution item.

        `minLength: 0`

      - `command: string`

        The command that was executed.

        `minLength: 0`

      - `cwd: string | null`

        The working directory used to execute the command.

        `minLength: 0`

      - `duration_ms: number | null`

        The command duration in milliseconds.

        `format: int64`

      - `exit_code: number | null`

        The process exit code, if the command completed.

        `format: int64`

      - `output: string | null`

        The command output, if available.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the command execution.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "command_execution"`

        The item type. Always `command_execution`.

        - `"command_execution"`

    - `AgentCreateSubagentCallItem`

      A request to spawn a subagent.

      - `id: string`

        The ID of the tool call item.

        `minLength: 0`

      - `agent_id: string`

        The ID of the agent that requested the subagent.

        `minLength: 0`

      - `content: Array<AgentContent>`

        The task given to the spawned agent.

        `minItems: 0`, `maxItems: 2000`

        - `OutputText`

          A text content part produced by the agent.

          - `text: string`

            The text produced by the agent.

            `minLength: 0`

          - `type: "output_text"`

            The content type. Always `output_text`.

        - `EncryptedContentResource`

          Encrypted content exchanged between agents.

          - `encrypted_content: string`

            The encrypted content payload.

            `minLength: 0`

          - `type: "encrypted_content"`

            The content type. Always `encrypted_content`.

            - `"encrypted_content"`

      - `model: string | null`

        The model requested for the spawned agent.

        `minLength: 0`

      - `reasoning_effort: string | null`

        The reasoning effort requested for the spawned agent.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "create_subagent_call"`

        The item type. Always `create_subagent_call`.

        - `"create_subagent_call"`

    - `AgentSendSubagentInputCallItem`

      A request to send input to another agent.

      - `id: string`

        The ID of the tool call item.

        `minLength: 0`

      - `content: Array<AgentContent>`

        The input sent to the receiving agent.

        `minItems: 0`, `maxItems: 2000`

        - `OutputText`

          A text content part produced by the agent.

        - `EncryptedContentResource`

          Encrypted content exchanged between agents.

      - `recipient_agent_id: string`

        The ID of the agent receiving the input.

        `minLength: 0`

      - `sender_agent_id: string`

        The ID of the agent sending the input.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "send_subagent_input_call"`

        The item type. Always `send_subagent_input_call`.

        - `"send_subagent_input_call"`

    - `AgentResumeSubagentCallItem`

      A request to resume a subagent.

      - `id: string`

        The ID of the tool call item.

        `minLength: 0`

      - `recipient_agent_id: string`

        The ID of the agent to resume.

        `minLength: 0`

      - `sender_agent_id: string`

        The ID of the agent requesting the resume.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "resume_subagent_call"`

        The item type. Always `resume_subagent_call`.

        - `"resume_subagent_call"`

    - `AgentWaitForSubagentsCallItem`

      A request to wait for one or more subagents.

      - `id: string`

        The ID of the tool call item.

        `minLength: 0`

      - `recipient_agent_ids: Array<string>`

        The IDs of the agents to wait for.

        `minItems: 0`, `maxItems: 2000`

      - `sender_agent_id: string`

        The ID of the agent waiting for results.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "wait_for_subagents_call"`

        The item type. Always `wait_for_subagents_call`.

        - `"wait_for_subagents_call"`

    - `AgentInterruptSubagentCallItem`

      A request to interrupt a subagent's current turn. The subagent remains available.

      - `id: string`

        The ID of the tool call item.

        `minLength: 0`

      - `recipient_agent_id: string`

        The ID of the agent to interrupt.

        `minLength: 0`

      - `sender_agent_id: string`

        The ID of the agent requesting the interrupt.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "interrupt_subagent_call"`

        The item type. Always `interrupt_subagent_call`.

        - `"interrupt_subagent_call"`

    - `AgentCloseSubagentCallItem`

      A request to close a subagent.

      - `id: string`

        The ID of the tool call item.

        `minLength: 0`

      - `recipient_agent_id: string`

        The ID of the agent to close.

        `minLength: 0`

      - `sender_agent_id: string`

        The ID of the agent requesting the close.

        `minLength: 0`

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

        `minLength: 0`

      - `type: "close_subagent_call"`

        The item type. Always `close_subagent_call`.

        - `"close_subagent_call"`

  - `output_index: number`

    The index of the output item in the turn output.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.turn.item.done"`

    The type of the object. Always `agent.session.turn.item.done`.

    - `"agent.session.turn.item.done"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn Output Text Delta Event

- `AgentSessionTurnOutputTextDeltaEvent`

  Emitted when text is appended to an output text content part.

  - `content_index: number`

    The index of the content part in the message.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `delta: string`

    The text that was appended.

    `minLength: 0`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `item_id: string`

    The ID of the message item.

    `minLength: 0`

  - `output_index: number`

    The index of the item in the turn output.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.turn.output_text.delta"`

    The type of the object. Always `agent.session.turn.output_text.delta`.

    - `"agent.session.turn.output_text.delta"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn Output Text Done Event

- `AgentSessionTurnOutputTextDoneEvent`

  Emitted when an output text content part is complete.

  - `content_index: number`

    The index of the content part in the message.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `item_id: string`

    The ID of the message item.

    `minLength: 0`

  - `output_index: number`

    The index of the item in the turn output.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `text: string`

    The complete output text.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.turn.output_text.done"`

    The type of the object. Always `agent.session.turn.output_text.done`.

    - `"agent.session.turn.output_text.done"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn Reasoning Summary Part Added Event

- `AgentSessionTurnReasoningSummaryPartAddedEvent`

  Emitted when a reasoning summary content part is added.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `item_id: string`

    The ID of the reasoning item.

    `minLength: 0`

  - `output_index: number`

    The index of the item in the turn output.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `part: SummaryText`

    The initial summary part.

    - `text: string`

      The reasoning summary text.

      `minLength: 0`

    - `type: "summary_text"`

      The content type. Always `summary_text`.

      - `"summary_text"`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `summary_index: number`

    The index of the summary content part.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.turn.reasoning_summary_part.added"`

    The type of the object. Always `agent.session.turn.reasoning_summary_part.added`.

    - `"agent.session.turn.reasoning_summary_part.added"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn Reasoning Summary Part Done Event

- `AgentSessionTurnReasoningSummaryPartDoneEvent`

  Emitted when a reasoning summary part is complete.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `item_id: string`

    The ID of the reasoning item.

    `minLength: 0`

  - `output_index: number`

    The index of the item in the turn output.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `part: SummaryText`

    The completed summary part.

    - `text: string`

      The reasoning summary text.

      `minLength: 0`

    - `type: "summary_text"`

      The content type. Always `summary_text`.

      - `"summary_text"`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `status: "incomplete" | null`

    Present as `incomplete` when summary generation was interrupted.

    - `"incomplete"`

  - `summary_index: number`

    The index of the summary part.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.turn.reasoning_summary_part.done"`

    The type of the object. Always `agent.session.turn.reasoning_summary_part.done`.

    - `"agent.session.turn.reasoning_summary_part.done"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn Reasoning Summary Text Delta Event

- `AgentSessionTurnReasoningSummaryTextDeltaEvent`

  Emitted when text is appended to a reasoning summary.

  - `delta: string`

    The summary text that was appended.

    `minLength: 0`

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `item_id: string`

    The ID of the reasoning item.

    `minLength: 0`

  - `output_index: number`

    The index of the item in the turn output.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `summary_index: number`

    The index of the summary content part.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.turn.reasoning_summary_text.delta"`

    The type of the object. Always `agent.session.turn.reasoning_summary_text.delta`.

    - `"agent.session.turn.reasoning_summary_text.delta"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Session Turn Reasoning Summary Text Done Event

- `AgentSessionTurnReasoningSummaryTextDoneEvent`

  Emitted when a reasoning summary content part is complete.

  - `event_id: string`

    The unique ID of the event.

    `minLength: 0`

  - `item_id: string`

    The ID of the reasoning item.

    `minLength: 0`

  - `output_index: number`

    The index of the item in the turn output.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `session_id: string`

    The ID of the session associated with the event.

    `minLength: 0`

  - `summary_index: number`

    The index of the summary content part.

    `format: int64`, `minimum: 0`, `maximum: 4294967295`

  - `text: string`

    The complete reasoning summary text.

    `minLength: 0`

  - `turn_id: string | null`

    The ID of the turn associated with the event, when applicable.

    `minLength: 0`

  - `type: "agent.session.turn.reasoning_summary_text.done"`

    The type of the object. Always `agent.session.turn.reasoning_summary_text.done`.

    - `"agent.session.turn.reasoning_summary_text.done"`

  - `obfuscation?: string`

    Random alphanumeric padding. Present when stream obfuscation is enabled.

    `minLength: 0`

### Agent Text

- `AgentText`

  The text configuration used by an agent.

  - `format: TextFormat`

    The effective output format. Defaults to ordinary text.

    - `TextFormatResourceText`

      Generates ordinary text without a structured-output constraint.

      - `type: "text"`

        The type of the object. Always `text`.

        - `"text"`

    - `TextFormatResourceJSONSchema`

      Constrains generated text to a JSON Schema.

      - `schema: Record<string, unknown>`

        The JSON Schema that generated text must match.

      - `type: "json_schema"`

        The type of the object. Always `json_schema`.

        - `"json_schema"`

  - `verbosity: "low" | "medium" | "high"`

    The amount of text produced by the agent. Defaults to `medium`.

    - `"low"`

    - `"medium"`

    - `"high"`

### Agent Text Param

- `AgentTextParam`

  Configuration for text generated by the agent.

  - `format?: TextFormatParam | null`

    The output format. Omission uses ordinary text (`{"type": "text"}`).

    - `TextFormatParamText`

      Generates ordinary text without a structured-output constraint.

      - `type: "text"`

        The type of the object. Always `text`.

        - `"text"`

    - `TextFormatParamJSONSchema`

      Constrains generated text to a JSON Schema.

      - `schema: Record<string, unknown>`

        The JSON Schema that generated text must match.

      - `type: "json_schema"`

        The type of the object. Always `json_schema`.

        - `"json_schema"`

  - `verbosity?: "low" | "medium" | "high" | null`

    The amount of text the model should produce. Defaults to `medium`, matching Responses.

    - `"low"`

      Produces less text.

    - `"medium"`

      Uses the default amount of text.

    - `"high"`

      Produces more text.

### Agent Tool

- `AgentTool = AgentToolResourceFunction | AgentToolResourceProgrammaticToolCalling | AgentToolResourceMcp | 3 more`

  A tool available to the agent.

  - `AgentToolResourceFunction`

    A function defined by the application.

    - `defer_loading: boolean`

      Whether the function is deferred and discovered through tool search.

    - `description: string`

      A description of what the function does.

      `minLength: 0`

    - `name: string`

      The name of the function.

      `minLength: 0`

    - `parameters: Record<string, unknown>`

      A JSON Schema object describing the function's arguments.

    - `type: "function"`

      The type of the object. Always `function`.

      - `"function"`

    - `async?: boolean`

      Whether the agent continues without waiting for the function result.

  - `AgentToolResourceProgrammaticToolCalling`

    Enables calling tools from model-generated code.

    - `enabled: boolean`

      Whether tools can be called from model-generated code.

    - `type: "programmatic_tool_calling"`

      The type of the object. Always `programmatic_tool_calling`.

      - `"programmatic_tool_calling"`

  - `AgentToolResourceMcp`

    Tools provided by a remote MCP server.

    - `allowed_tools: Array<string> | null`

      The MCP tools the agent may call.

      `minItems: 0`, `maxItems: 2000`

    - `connection_origin: "service" | "environment"`

      Where outbound MCP HTTP connections originate.

      - `"service"`

      - `"environment"`

    - `credential_id: string | null`

      The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

      `minLength: 0`

    - `request_metadata: Record<string, unknown>`

      Metadata included with requests to this MCP server.

    - `required: boolean`

      Whether this MCP server must initialize before the first turn.

    - `server_label: string`

      A label used to identify the MCP server in tool calls.

      `minLength: 0`

    - `transport: McpTransport`

      The transport used to connect to the MCP server.

      - `McpTransportResourceHTTP`

        Connects to an MCP server over HTTP.

        - `server_url: string`

          The URL of the MCP server.

          `minLength: 0`

        - `type: "http"`

          The type of the object. Always `http`.

          - `"http"`

      - `McpTransportResourceStdio`

        Starts an MCP server as a local process.

        - `args: Array<string>`

          Arguments passed to the MCP server command.

          `minItems: 0`, `maxItems: 2000`

        - `command: string`

          The command used to start the MCP server.

          `minLength: 0`

        - `cwd: string`

          The working directory used to start the MCP server.

          `minLength: 0`

        - `env_vars: Array<string>`

          Environment variable names inherited from the execution environment.

          `minItems: 0`, `maxItems: 2000`

        - `type: "stdio"`

          The type of the object. Always `stdio`.

          - `"stdio"`

    - `type: "mcp"`

      The type of the object. Always `mcp`.

      - `"mcp"`

  - `AgentToolResourceWebSearch`

    Web search.

    - `allowed_domains: Array<string> | null`

      Allowed search domains, or `null` when the search is unrestricted.

      `minItems: 0`, `maxItems: 2000`

    - `context_size: "low" | "medium" | "high"`

      The amount of search context made available to the model. Defaults to `medium`.

      - `"low"`

      - `"medium"`

      - `"high"`

    - `location: Location | null`

      Approximate location used to localize search results, if provided.

      - `city: string | null`

        The city name.

        `minLength: 0`

      - `country: string | null`

        The two-letter ISO country code, such as `US`.

        `minLength: 0`

      - `region: string | null`

        The region or state name.

        `minLength: 0`

      - `timezone: string | null`

        The IANA timezone, such as `America/Los_Angeles`.

        `minLength: 0`

    - `mode: "disabled" | "cached" | "live"`

      The source used for web search results.

      - `"disabled"`

      - `"cached"`

      - `"live"`

    - `type: "web_search"`

      The type of the object. Always `web_search`.

      - `"web_search"`

  - `AgentToolResourceComputerUse`

    Browser use in an OpenAI-hosted session.

    - `include_screenshots: boolean`

      Whether computer tool outputs include screenshots.

    - `type: "computer_use"`

      The type of the object. Always `computer_use`.

      - `"computer_use"`

  - `AgentToolResourceAutomations`

    Lets the agent manage its own scheduled wakeups.

    - `type: "automations"`

      The type of the object. Always `automations`.

      - `"automations"`

### Agent Tool Param

- `AgentToolParam = AgentToolConfigParamFunction | AgentToolConfigParamToolSearch | AgentToolConfigParamProgrammaticToolCalling | 4 more`

  A tool available to the agent.

  - `AgentToolConfigParamFunction`

    A function defined by the application.

    - `description: string`

      A description of what the function does.

      `minLength: 0`, `maxLength: 1048576`

    - `name: string`

      The name of the function.

      `minLength: 0`, `maxLength: 1048576`

    - `parameters: Record<string, unknown>`

      A JSON Schema object describing the function's arguments.

    - `type: "function"`

      The type of the object. Always `function`.

      - `"function"`

    - `async?: boolean`

      Whether the agent continues without waiting for the function result. Defaults to `false`.

    - `defer_loading?: boolean`

      Whether this function is deferred and discovered through tool search. Defaults to `false`.

  - `AgentToolConfigParamToolSearch`

    Discovers deferred function tools and loads them into the model context.

    - `type: "tool_search"`

      The type of the object. Always `tool_search`.

      - `"tool_search"`

  - `AgentToolConfigParamProgrammaticToolCalling`

    Enables calling tools from model-generated code.

    - `type: "programmatic_tool_calling"`

      The type of the object. Always `programmatic_tool_calling`.

      - `"programmatic_tool_calling"`

    - `enabled?: boolean`

      Whether tools can be called from model-generated code. Defaults to `true`.

  - `AgentToolConfigParamMcp`

    Tools provided by a remote MCP server.

    - `server_label: string`

      A label used to identify the MCP server in tool calls.

      `minLength: 0`, `maxLength: 1048576`

    - `transport: McpTransportParam`

      The transport used to connect to the MCP server.

      - `McpTransportConfigParamHTTP`

        Connects to an MCP server over HTTP.

        - `server_url: string`

          The URL of the MCP server.

          `minLength: 0`, `maxLength: 1048576`

        - `type: "http"`

          The type of the object. Always `http`.

          - `"http"`

        - `authorization?: string | null`

          The authorization value sent to the MCP server, if any.

          `minLength: 0`, `maxLength: 1048576`

        - `headers?: Record<string, string> | null`

          Additional HTTP headers sent to the MCP server.

      - `McpTransportConfigParamStdio`

        Starts an MCP server as a local process.

        - `command: string`

          The command used to start the MCP server.

          `minLength: 0`, `maxLength: 1048576`

        - `cwd: string`

          The working directory used to start the MCP server.

          `minLength: 0`, `maxLength: 1048576`

        - `type: "stdio"`

          The type of the object. Always `stdio`.

          - `"stdio"`

        - `args?: Array<string> | null`

          Arguments passed to the MCP server command.

          `minItems: 0`, `maxItems: 16384`

        - `env?: Record<string, string> | null`

          Environment variables set for the MCP server process.

        - `env_vars?: Array<string> | null`

          Environment variable names to inherit from the selected execution environment.

          `minItems: 0`, `maxItems: 16384`

    - `type: "mcp"`

      The type of the object. Always `mcp`.

      - `"mcp"`

    - `allowed_tools?: Array<string> | null`

      The MCP tools the agent may call. All server tools are allowed when omitted.

      `minItems: 0`, `maxItems: 16384`

    - `connection_origin?: "service" | "environment" | null`

      Selects where outbound MCP HTTP connections originate. Omitted or `service` uses the Managed Agents service network; `environment` uses the session's selected environment.

      - `"service"`

        Uses the Managed Agents service network.

      - `"environment"`

        Uses the session's execution environment.

    - `credential_id?: string | null`

      The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL.

      `minLength: 0`, `maxLength: 1048576`

    - `request_metadata?: Record<string, unknown> | null`

      Metadata included with requests to this MCP server.

    - `required?: boolean`

      Whether this MCP server must initialize before the first turn. Defaults to `false`.

  - `AgentToolConfigParamWebSearch`

    Web search.

    - `type: "web_search"`

      The type of the object. Always `web_search`.

      - `"web_search"`

    - `allowed_domains?: Array<string> | null`

      Domains the search may include.

      `minItems: 0`, `maxItems: 16384`

    - `context_size?: "low" | "medium" | "high" | null`

      The amount of search context made available to the model. Defaults to `medium`.

      - `"low"`

      - `"medium"`

      - `"high"`

    - `location?: Location | null`

      Approximate location used to localize search results.

      - `city?: string | null`

        The city name.

        `minLength: 0`, `maxLength: 1048576`

      - `country?: string | null`

        The two-letter ISO country code, such as `US`.

        `minLength: 0`, `maxLength: 1048576`

      - `region?: string | null`

        The region or state name.

        `minLength: 0`, `maxLength: 1048576`

      - `timezone?: string | null`

        The IANA timezone, such as `America/Los_Angeles`.

        `minLength: 0`, `maxLength: 1048576`

    - `mode?: "disabled" | "cached" | "live" | null`

      The source used for web search results. Defaults to `live`.

      - `"disabled"`

        Disables web search.

      - `"cached"`

        Uses cached search results.

      - `"live"`

        Searches the live web.

  - `AgentToolConfigParamComputerUse`

    Browser use in an OpenAI-hosted session.

    - `type: "computer_use"`

      The type of the object. Always `computer_use`.

      - `"computer_use"`

    - `include_screenshots?: boolean`

      Whether computer tool outputs include screenshots. Defaults to `false`.

  - `AgentToolConfigParamAutomations`

    Lets the agent manage its own scheduled wakeups.

    - `type: "automations"`

      The type of the object. Always `automations`.

      - `"automations"`

### Agent Wait For Subagents Call Item

- `AgentWaitForSubagentsCallItem`

  A request to wait for one or more subagents.

  - `id: string`

    The ID of the tool call item.

    `minLength: 0`

  - `recipient_agent_ids: Array<string>`

    The IDs of the agents to wait for.

    `minItems: 0`, `maxItems: 2000`

  - `sender_agent_id: string`

    The ID of the agent waiting for results.

    `minLength: 0`

  - `status: AgentFunctionCallStatus`

    The status of the tool call.

    - `"in_progress"`

      The call is in progress.

    - `"completed"`

      The call completed successfully.

    - `"failed"`

      The call failed.

    - `"incomplete"`

      The call stopped before completing.

  - `turn_id: string`

    The ID of the turn that contains this item.

    `minLength: 0`

  - `type: "wait_for_subagents_call"`

    The item type. Always `wait_for_subagents_call`.

    - `"wait_for_subagents_call"`

### Agent Web Search Call Item

- `AgentWebSearchCallItem`

  A web search call produced by the agent.

  - `id: string`

    The ID of the web search call.

    `minLength: 0`

  - `action: WebSearchAction | null`

    The action performed by the web search tool.

    - `WebSearchActionResourceSearch`

      A search query or group of search queries.

      - `queries: Array<string> | null`

        The search queries, when multiple queries were used.

        `minItems: 0`, `maxItems: 2000`

      - `query: string | null`

        The search query, when a single query was used.

        `minLength: 0`

      - `type: "search"`

        The type of the object. Always `search`.

        - `"search"`

    - `WebSearchActionResourceOpenPage`

      Opens a web page.

      - `type: "open_page"`

        The type of the object. Always `open_page`.

        - `"open_page"`

      - `url: string | null`

        The URL of the page that was opened.

        `minLength: 0`

    - `WebSearchActionResourceFindInPage`

      Finds text within a web page.

      - `pattern: string | null`

        The text pattern that was searched for.

        `minLength: 0`

      - `type: "find_in_page"`

        The type of the object. Always `find_in_page`.

        - `"find_in_page"`

      - `url: string | null`

        The URL of the page that was searched.

        `minLength: 0`

    - `WebSearchActionResourceOther`

      Another web search action.

      - `type: "other"`

        The type of the object. Always `other`.

        - `"other"`

  - `status: AgentOutputItemStatus`

    The status of the web search call.

    - `"in_progress"`

      The item is in progress.

    - `"completed"`

      The item is complete.

    - `"incomplete"`

      The item stopped before completing.

  - `turn_id: string`

    The ID of the turn that contains this item.

    `minLength: 0`

  - `type: "web_search_call"`

    The item type. Always `web_search_call`.

    - `"web_search_call"`

### Environment

- `Environment = EnvironmentResourceNone | EnvironmentResourceOpenAIHosted | EnvironmentResourceSelfHosted`

  The execution environment for a session.

  - `EnvironmentResourceNone`

    The session talks to CCA without selecting or provisioning an execution environment.

    - `type: "none"`

      The type of the object. Always `none`.

      - `"none"`

  - `EnvironmentResourceOpenAIHosted`

    An environment hosted by OpenAI.

    - `id: string`

      The public ID of the environment.

      `minLength: 0`

    - `capability_directories: Array<string>`

      Directories that contain capabilities exposed to the agent.

      `minItems: 0`, `maxItems: 2000`

    - `files: Array<HostedEnvironmentFile>`

      Files available in the environment, excluding their contents.

      `minItems: 0`, `maxItems: 50`

      - `HostedEnvironmentFileID`

        A file copied from the OpenAI Files API.

        - `id: string`

          The session-scoped ID of the file in the execution environment.

          `minLength: 0`

        - `file_id: string`

          The ID of the uploaded file.

          `minLength: 0`

        - `path: string`

          The file's absolute path inside the environment.

          `minLength: 0`

        - `size_bytes: number`

          The decoded file size in bytes.

          `format: int64`, `minimum: 0`

        - `type: "file_id"`

          The type of the object. Always `file_id`.

          - `"file_id"`

      - `HostedEnvironmentFileResourceInline`

        A file supplied inline when the session was created.

        - `id: string`

          The session-scoped ID of the file in the execution environment.

          `minLength: 0`

        - `path: string`

          The file's absolute path inside the environment.

          `minLength: 0`

        - `size_bytes: number`

          The decoded file size in bytes.

          `format: int64`, `minimum: 0`

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

    - `network: Network`

      The effective network access policy for the environment.

      - `access: "enabled" | "disabled" | "restricted"`

        The environment's network access mode.

        - `"enabled"`

          Allows unrestricted network access.

        - `"disabled"`

          Disables network access.

        - `"restricted"`

          Applies the configured domain restrictions.

      - `allowed_domains: Array<string>`

        Domains the environment may access when network access is restricted.

        `minItems: 0`, `maxItems: 2000`

    - `packages: Packages`

      Packages installed in the environment.

      - `npm: Array<string>`

        npm packages installed globally in the environment.

        `minItems: 0`, `maxItems: 16384`

      - `python: Array<string>`

        Python packages installed in the environment.

        `minItems: 0`, `maxItems: 16384`

      - `system: Array<string>`

        System packages installed in the environment.

        `minItems: 0`, `maxItems: 16384`

    - `plugins: Array<HostedPlugin>`

      Plugins installed in the environment, excluding their archive contents.

      `minItems: 0`, `maxItems: 2000`

      - `description: string`

        The installed plugin description.

        `minLength: 0`

      - `name: string`

        The installed plugin name.

        `minLength: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

    - `skills: Array<HostedSkill>`

      Skills installed in the environment, excluding their archive contents.

      `minItems: 0`, `maxItems: 2000`

      - `HostedSkillReference`

        A skill installed from the Skills API.

        - `description: string`

          The installed skill description.

          `minLength: 0`

        - `name: string`

          The installed skill name.

          `minLength: 0`

        - `skill_id: string`

          The referenced skill ID.

          `minLength: 0`

        - `type: "skill_reference"`

          The type of the object. Always `skill_reference`.

          - `"skill_reference"`

        - `version: string`

          The concrete skill version installed for this session.

          `minLength: 0`

      - `HostedSkillResourceInline`

        A skill installed from an inline ZIP archive.

        - `description: string`

          The installed skill description.

          `minLength: 0`

        - `name: string`

          The installed skill name.

          `minLength: 0`

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

    - `type: "openai_hosted"`

      The type of the object. Always `openai_hosted`.

      - `"openai_hosted"`

    - `container_size?: "small" | "medium" | "large" | null`

      The effective CPU and memory tier, or null when unknown or outside the public tiers.

      - `"small"`

      - `"medium"`

      - `"large"`

    - `desktop?: Desktop`

      The effective desktop configuration.

      - `enabled: boolean`

        Whether the environment provisions a desktop and browser proxy.

  - `EnvironmentResourceSelfHosted`

    An environment hosted by the application.

    - `id: string`

      The public ID of the environment.

      `minLength: 0`

    - `capability_directories: Array<string>`

      Directories that contain capabilities exposed to the agent.

      `minItems: 0`, `maxItems: 2000`

    - `remote_url: string`

      Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

      `minLength: 0`

    - `type: "self_hosted"`

      The type of the object. Always `self_hosted`.

      - `"self_hosted"`

    - `workspace_directory: string`

      The absolute project directory inside the environment. Defaults to `/workspace`.

      `minLength: 0`

### Environment Param

- `EnvironmentParam = EnvironmentParamNone | EnvironmentParamOpenAIHosted | EnvironmentParamSelfHosted`

  The execution environment and optional reusable template for a session.

  - `EnvironmentParamNone`

    Runs the agent without an execution environment.

    - `type: "none"`

      The type of the object. Always `none`.

      - `"none"`

  - `EnvironmentParamOpenAIHosted`

    An existing OpenAI-hosted environment or new inline/template-based hosted configuration.

    - `type: "openai_hosted"`

      The type of the object. Always `openai_hosted`.

      - `"openai_hosted"`

    - `capability_directories?: Array<string> | null`

      Directories that contain capabilities exposed to the agent. Defaults to an empty list.

      `minItems: 0`, `maxItems: 16384`

    - `container_size?: "small" | "medium" | "large"`

      The hosted container size. Omission selects the medium tier.

      - `"small"`

      - `"medium"`

      - `"large"`

    - `desktop?: Desktop | null`

      Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled.

      - `enabled: boolean`

        Whether to provision the desktop and its browser proxy.

    - `env?: Record<string, string> | null`

      Environment variables made available to the agent.

    - `environment_id?: string`

      An existing prewarmed environment. Cannot be combined with a template or inline configuration.

      `minLength: 9`, `maxLength: 256`

    - `environment_template_id?: string`

      A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy.

      `minLength: 0`, `maxLength: 64`

    - `files?: Array<HostedEnvironmentFileParam> | null`

      Files available before the agent starts. Defaults to an empty list.

      `minItems: 0`, `maxItems: 50`

      - `HostedEnvironmentFileParamFileID`

        A file previously uploaded through the OpenAI Files API.

        - `file_id: string`

          The ID of the uploaded file.

          `minLength: 1`, `maxLength: 256`

        - `path: string`

          The absolute destination path inside `/workspace`.

          `minLength: 1`, `maxLength: 4096`

        - `type: "file_id"`

          The type of the object. Always `file_id`.

          - `"file_id"`

      - `HostedEnvironmentFileParamInline`

        A file supplied directly as standard-base64 data.

        - `data: string`

          The standard-base64-encoded file contents.

          `minLength: 0`, `maxLength: 6990508`

        - `path: string`

          The absolute destination path inside `/workspace`.

          `minLength: 1`, `maxLength: 4096`

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

    - `network?: Network | null`

      Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled.

      - `access: "enabled" | "disabled" | "restricted"`

        The environment's network access mode.

        - `"enabled"`

          Allows unrestricted network access.

        - `"disabled"`

          Disables network access.

        - `"restricted"`

          Applies the configured domain restrictions.

      - `allowed_domains?: Array<string> | null`

        Domains the environment may access when network access is restricted.

        `minItems: 0`, `maxItems: 16384`

      - `blocked_domains?: Array<string> | null`

        Domains blocked for both executor and browser when access is restricted. A nonempty list requires `access: restricted` and cannot be combined with nonempty `allowed_domains`. Wildcard domains are not supported.

        `minItems: 0`, `maxItems: 100`

    - `packages?: Packages | null`

      Packages to install in the environment. Defaults to empty package lists.

      - `npm?: Array<string> | null`

        npm packages to install globally. Defaults to an empty list.

        `minItems: 0`, `maxItems: 16384`

      - `python?: Array<string> | null`

        Python packages to install. Defaults to an empty list.

        `minItems: 0`, `maxItems: 16384`

      - `system?: Array<string> | null`

        System packages to install. Defaults to an empty list.

        `minItems: 0`, `maxItems: 16384`

    - `plugins?: Array<HostedPluginParam> | null`

      Plugins provided as inline ZIP archives. Defaults to an empty list.

      `minItems: 0`, `maxItems: 32`

      - `description: string`

        The plugin description declared in `.codex-plugin/plugin.json`.

        `minLength: 0`, `maxLength: 1048576`

      - `name: string`

        The plugin name declared in `.codex-plugin/plugin.json`.

        `minLength: 1`, `maxLength: 64`

      - `source: InlineCapabilitySourceParam`

        Provides ZIP bytes encoded with standard base64.

        - `data: string`

          Standard-base64 encoded ZIP archive bytes.

          `minLength: 1`, `maxLength: 70254592`

        - `media_type: "application/zip"`

          The archive media type, always `application/zip`.

          - `"application/zip"`

        - `type: "base64"`

          The type of the object. Always `base64`.

          - `"base64"`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

    - `setup_commands?: Array<SetupCommandParam> | null`

      Ordered, confidential setup commands. Command bodies are never returned.

      `minItems: 0`, `maxItems: 16`

      - `command: string`

        The shell command to execute.

        `minLength: 0`, `maxLength: 65536`

      - `cwd?: string | null`

        The absolute working directory. Defaults to `/workspace`.

        `minLength: 0`, `maxLength: 4096`

    - `skills?: Array<HostedSkillParam> | null`

      Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.

      `minItems: 0`, `maxItems: 200`

      - `HostedSkillParamSkillReference`

        References a skill uploaded through the Skills API.

        - `skill_id: string`

          The ID of the skill created through `/v1/skills`.

          `minLength: 1`, `maxLength: 64`

        - `type: "skill_reference"`

          The type of the object. Always `skill_reference`.

          - `"skill_reference"`

        - `version?: string | null`

          The skill version, a positive integer or `latest`; omission selects the default.

          `minLength: 0`, `maxLength: 1048576`

      - `HostedSkillParamInline`

        Supplies a skill ZIP directly in the session request.

        - `description: string`

          The skill description declared in `SKILL.md`.

          `minLength: 0`, `maxLength: 1048576`

        - `name: string`

          The skill name declared in `SKILL.md`.

          `minLength: 1`, `maxLength: 64`

        - `source: InlineCapabilitySourceParam`

          Provides ZIP bytes encoded with standard base64.

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

  - `EnvironmentParamSelfHosted`

    An application-hosted environment configured inline.

    - `type: "self_hosted"`

      The type of the object. Always `self_hosted`.

      - `"self_hosted"`

    - `workspace_directory: string`

      Absolute project directory inside the self-hosted environment.

      `minLength: 0`, `maxLength: 1048576`

    - `capability_directories?: Array<string> | null`

      Directories that contain capabilities exposed to the agent. Defaults to an empty list.

      `minItems: 0`, `maxItems: 16384`

### Hosted Environment File

- `HostedEnvironmentFile = HostedEnvironmentFileID | HostedEnvironmentFileResourceInline`

  Metadata for a file materialized in an OpenAI-hosted execution environment.

  - `HostedEnvironmentFileID`

    A file copied from the OpenAI Files API.

    - `id: string`

      The session-scoped ID of the file in the execution environment.

      `minLength: 0`

    - `file_id: string`

      The ID of the uploaded file.

      `minLength: 0`

    - `path: string`

      The file's absolute path inside the environment.

      `minLength: 0`

    - `size_bytes: number`

      The decoded file size in bytes.

      `format: int64`, `minimum: 0`

    - `type: "file_id"`

      The type of the object. Always `file_id`.

      - `"file_id"`

  - `HostedEnvironmentFileResourceInline`

    A file supplied inline when the session was created.

    - `id: string`

      The session-scoped ID of the file in the execution environment.

      `minLength: 0`

    - `path: string`

      The file's absolute path inside the environment.

      `minLength: 0`

    - `size_bytes: number`

      The decoded file size in bytes.

      `format: int64`, `minimum: 0`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

### Hosted Environment File ID

- `HostedEnvironmentFileID`

  A file copied from the OpenAI Files API.

  - `id: string`

    The session-scoped ID of the file in the execution environment.

    `minLength: 0`

  - `file_id: string`

    The ID of the uploaded file.

    `minLength: 0`

  - `path: string`

    The file's absolute path inside the environment.

    `minLength: 0`

  - `size_bytes: number`

    The decoded file size in bytes.

    `format: int64`, `minimum: 0`

  - `type: "file_id"`

    The type of the object. Always `file_id`.

    - `"file_id"`

### Hosted Environment File Param

- `HostedEnvironmentFileParam = HostedEnvironmentFileParamFileID | HostedEnvironmentFileParamInline`

  A file materialized in an OpenAI-hosted execution environment.

  - `HostedEnvironmentFileParamFileID`

    A file previously uploaded through the OpenAI Files API.

    - `file_id: string`

      The ID of the uploaded file.

      `minLength: 1`, `maxLength: 256`

    - `path: string`

      The absolute destination path inside `/workspace`.

      `minLength: 1`, `maxLength: 4096`

    - `type: "file_id"`

      The type of the object. Always `file_id`.

      - `"file_id"`

  - `HostedEnvironmentFileParamInline`

    A file supplied directly as standard-base64 data.

    - `data: string`

      The standard-base64-encoded file contents.

      `minLength: 0`, `maxLength: 6990508`

    - `path: string`

      The absolute destination path inside `/workspace`.

      `minLength: 1`, `maxLength: 4096`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

### Hosted Plugin

- `HostedPlugin`

  A plugin installed from an inline ZIP archive.

  - `description: string`

    The installed plugin description.

    `minLength: 0`

  - `name: string`

    The installed plugin name.

    `minLength: 0`

  - `type: "inline"`

    The type of the object. Always `inline`.

    - `"inline"`

### Hosted Plugin Param

- `HostedPluginParam`

  Supplies a plugin ZIP directly in the session request.

  - `description: string`

    The plugin description declared in `.codex-plugin/plugin.json`.

    `minLength: 0`, `maxLength: 1048576`

  - `name: string`

    The plugin name declared in `.codex-plugin/plugin.json`.

    `minLength: 1`, `maxLength: 64`

  - `source: InlineCapabilitySourceParam`

    Provides ZIP bytes encoded with standard base64.

    - `data: string`

      Standard-base64 encoded ZIP archive bytes.

      `minLength: 1`, `maxLength: 70254592`

    - `media_type: "application/zip"`

      The archive media type, always `application/zip`.

      - `"application/zip"`

    - `type: "base64"`

      The type of the object. Always `base64`.

      - `"base64"`

  - `type: "inline"`

    The type of the object. Always `inline`.

    - `"inline"`

### Hosted Skill

- `HostedSkill = HostedSkillReference | HostedSkillResourceInline`

  A skill installed in an OpenAI-hosted environment.

  - `HostedSkillReference`

    A skill installed from the Skills API.

    - `description: string`

      The installed skill description.

      `minLength: 0`

    - `name: string`

      The installed skill name.

      `minLength: 0`

    - `skill_id: string`

      The referenced skill ID.

      `minLength: 0`

    - `type: "skill_reference"`

      The type of the object. Always `skill_reference`.

      - `"skill_reference"`

    - `version: string`

      The concrete skill version installed for this session.

      `minLength: 0`

  - `HostedSkillResourceInline`

    A skill installed from an inline ZIP archive.

    - `description: string`

      The installed skill description.

      `minLength: 0`

    - `name: string`

      The installed skill name.

      `minLength: 0`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

### Hosted Skill Param

- `HostedSkillParam = HostedSkillParamSkillReference | HostedSkillParamInline`

  A skill installed in an OpenAI-hosted environment.

  - `HostedSkillParamSkillReference`

    References a skill uploaded through the Skills API.

    - `skill_id: string`

      The ID of the skill created through `/v1/skills`.

      `minLength: 1`, `maxLength: 64`

    - `type: "skill_reference"`

      The type of the object. Always `skill_reference`.

      - `"skill_reference"`

    - `version?: string | null`

      The skill version, a positive integer or `latest`; omission selects the default.

      `minLength: 0`, `maxLength: 1048576`

  - `HostedSkillParamInline`

    Supplies a skill ZIP directly in the session request.

    - `description: string`

      The skill description declared in `SKILL.md`.

      `minLength: 0`, `maxLength: 1048576`

    - `name: string`

      The skill name declared in `SKILL.md`.

      `minLength: 1`, `maxLength: 64`

    - `source: InlineCapabilitySourceParam`

      Provides ZIP bytes encoded with standard base64.

      - `data: string`

        Standard-base64 encoded ZIP archive bytes.

        `minLength: 1`, `maxLength: 70254592`

      - `media_type: "application/zip"`

        The archive media type, always `application/zip`.

        - `"application/zip"`

      - `type: "base64"`

        The type of the object. Always `base64`.

        - `"base64"`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

### Hosted Skill Reference

- `HostedSkillReference`

  A skill installed from the Skills API.

  - `description: string`

    The installed skill description.

    `minLength: 0`

  - `name: string`

    The installed skill name.

    `minLength: 0`

  - `skill_id: string`

    The referenced skill ID.

    `minLength: 0`

  - `type: "skill_reference"`

    The type of the object. Always `skill_reference`.

    - `"skill_reference"`

  - `version: string`

    The concrete skill version installed for this session.

    `minLength: 0`

### Inline Capability Source Param

- `InlineCapabilitySourceParam`

  Provides ZIP bytes encoded with standard base64.

  - `data: string`

    Standard-base64 encoded ZIP archive bytes.

    `minLength: 1`, `maxLength: 70254592`

  - `media_type: "application/zip"`

    The archive media type, always `application/zip`.

    - `"application/zip"`

  - `type: "base64"`

    The type of the object. Always `base64`.

    - `"base64"`

### Input Content

- `InputContent = InputContentResourceInputText | InputContentResourceInputImage`

  User-provided content recorded in a session item.

  - `InputContentResourceInputText`

    Text input recorded in a session item.

    - `text: string`

      The text supplied to the agent.

      `minLength: 0`

    - `type: "input_text"`

      The type of the object. Always `input_text`.

      - `"input_text"`

  - `InputContentResourceInputImage`

    Image input recorded in a session item.

    - `image_url: string`

      The URL of the image supplied to the agent, which may be a base64-encoded data URL.

      `minLength: 0`

    - `type: "input_image"`

      The type of the object. Always `input_image`.

      - `"input_image"`

### Input Content Param

- `InputContentParam = InputContentParamInputText | InputContentParamInputImage`

  Content included in an input message.

  - `InputContentParamInputText`

    Text input to the model.

    - `text: string`

      The text sent to the model.

      `minLength: 0`, `maxLength: 1048576`

    - `type: "input_text"`

      The type of the object. Always `input_text`.

      - `"input_text"`

  - `InputContentParamInputImage`

    Image input to the model.

    - `image_url: string`

      The URL of the image sent to the model.

      `minLength: 0`, `maxLength: 1048576`

    - `type: "input_image"`

      The type of the object. Always `input_image`.

      - `"input_image"`

### Mcp Transport

- `McpTransport = McpTransportResourceHTTP | McpTransportResourceStdio`

  The transport used to connect to an MCP server.

  - `McpTransportResourceHTTP`

    Connects to an MCP server over HTTP.

    - `server_url: string`

      The URL of the MCP server.

      `minLength: 0`

    - `type: "http"`

      The type of the object. Always `http`.

      - `"http"`

  - `McpTransportResourceStdio`

    Starts an MCP server as a local process.

    - `args: Array<string>`

      Arguments passed to the MCP server command.

      `minItems: 0`, `maxItems: 2000`

    - `command: string`

      The command used to start the MCP server.

      `minLength: 0`

    - `cwd: string`

      The working directory used to start the MCP server.

      `minLength: 0`

    - `env_vars: Array<string>`

      Environment variable names inherited from the execution environment.

      `minItems: 0`, `maxItems: 2000`

    - `type: "stdio"`

      The type of the object. Always `stdio`.

      - `"stdio"`

### Mcp Transport Param

- `McpTransportParam = McpTransportConfigParamHTTP | McpTransportConfigParamStdio`

  The transport used to connect to an MCP server.

  - `McpTransportConfigParamHTTP`

    Connects to an MCP server over HTTP.

    - `server_url: string`

      The URL of the MCP server.

      `minLength: 0`, `maxLength: 1048576`

    - `type: "http"`

      The type of the object. Always `http`.

      - `"http"`

    - `authorization?: string | null`

      The authorization value sent to the MCP server, if any.

      `minLength: 0`, `maxLength: 1048576`

    - `headers?: Record<string, string> | null`

      Additional HTTP headers sent to the MCP server.

  - `McpTransportConfigParamStdio`

    Starts an MCP server as a local process.

    - `command: string`

      The command used to start the MCP server.

      `minLength: 0`, `maxLength: 1048576`

    - `cwd: string`

      The working directory used to start the MCP server.

      `minLength: 0`, `maxLength: 1048576`

    - `type: "stdio"`

      The type of the object. Always `stdio`.

      - `"stdio"`

    - `args?: Array<string> | null`

      Arguments passed to the MCP server command.

      `minItems: 0`, `maxItems: 16384`

    - `env?: Record<string, string> | null`

      Environment variables set for the MCP server process.

    - `env_vars?: Array<string> | null`

      Environment variable names to inherit from the selected execution environment.

      `minItems: 0`, `maxItems: 16384`

### Multi Agent Config

- `MultiAgentConfig`

  The resolved configuration for creating and coordinating subagents.

  - `enabled: boolean`

    Whether subagent tools are enabled. Defaults to false.

  - `max_concurrent_subagents: number | null`

    Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

    `format: int64`, `minimum: 1`, `maximum: 4294967295`

### Multi Agent Config Param

- `MultiAgentConfigParam`

  Explicit configuration for creating and coordinating subagents.

  - `enabled: boolean`

    Whether subagent tools are enabled.

  - `max_concurrent_subagents?: number`

    Maximum number of subagents that may run concurrently. Defaults to 6.

    `format: int64`, `minimum: 1`, `maximum: 4294967295`

### Output Text

- `OutputText`

  A text content part produced by the agent.

  - `text: string`

    The text produced by the agent.

    `minLength: 0`

  - `type: "output_text"`

    The content type. Always `output_text`.

    - `"output_text"`

### Persisted Agent Tool

- `PersistedAgentTool = PersistedAgentToolResourceFunction | PersistedAgentToolResourceToolSearch | PersistedAgentToolResourceProgrammaticToolCalling | 4 more`

  A credential-free tool available to a reusable agent.

  - `PersistedAgentToolResourceFunction`

    A function defined by the application.

    - `defer_loading: boolean`

      Whether the function is deferred and discovered through tool search.

    - `description: string`

      A description of what the function does.

      `minLength: 0`

    - `name: string`

      The name of the function.

      `minLength: 0`

    - `parameters: Record<string, unknown>`

      A JSON Schema object describing the function's arguments.

    - `type: "function"`

      The type of the object. Always `function`.

      - `"function"`

    - `async?: boolean`

      Whether the agent continues without waiting for the function result.

  - `PersistedAgentToolResourceToolSearch`

    Discovers deferred function tools and loads them into the model context.

    - `type: "tool_search"`

      The type of the object. Always `tool_search`.

      - `"tool_search"`

  - `PersistedAgentToolResourceProgrammaticToolCalling`

    Enables calling tools from model-generated code.

    - `enabled: boolean`

      Whether tools can be called from model-generated code.

    - `type: "programmatic_tool_calling"`

      The type of the object. Always `programmatic_tool_calling`.

      - `"programmatic_tool_calling"`

  - `PersistedAgentToolResourceMcp`

    Tools provided by a remote MCP server without stored credentials.

    - `allowed_tools: Array<string> | null`

      The MCP tools the agent may call, or null when all server tools are allowed.

      `minItems: 0`, `maxItems: 2000`

    - `connection_origin: "service" | "environment"`

      Where outbound MCP HTTP connections originate.

      - `"service"`

      - `"environment"`

    - `credential_id: string | null`

      The vault credential selected for this MCP server, if any.

      `minLength: 0`

    - `request_metadata: Record<string, unknown>`

      Metadata included with requests to this MCP server.

    - `required: boolean`

      Whether this MCP server must initialize before the first turn.

    - `server_label: string`

      A label used to identify the MCP server in tool calls.

      `minLength: 0`

    - `transport: PersistedMcpTransport`

      The credential-free transport used to connect to the MCP server.

      - `PersistedMcpTransportResourceHTTP`

        Connects to an MCP server over HTTP.

        - `headers: Record<string, string>`

          Non-secret HTTP headers sent to the MCP server.

        - `server_url: string`

          The URL of the MCP server.

          `minLength: 0`

        - `type: "http"`

          The type of the object. Always `http`.

          - `"http"`

      - `PersistedMcpTransportResourceStdio`

        Starts an MCP server as a local process.

        - `args: Array<string>`

          Arguments passed to the MCP server command.

          `minItems: 0`, `maxItems: 2000`

        - `command: string`

          The command used to start the MCP server.

          `minLength: 0`

        - `cwd: string`

          The working directory used to start the MCP server.

          `minLength: 0`

        - `env_vars: Array<string>`

          Environment variable names inherited from the execution environment.

          `minItems: 0`, `maxItems: 2000`

        - `type: "stdio"`

          The type of the object. Always `stdio`.

          - `"stdio"`

    - `type: "mcp"`

      The type of the object. Always `mcp`.

      - `"mcp"`

  - `PersistedAgentToolResourceWebSearch`

    Web search.

    - `allowed_domains: Array<string> | null`

      Allowed search domains, or `null` when the search is unrestricted.

      `minItems: 0`, `maxItems: 2000`

    - `context_size: "low" | "medium" | "high"`

      The amount of search context made available to the model. Defaults to `medium`.

      - `"low"`

      - `"medium"`

      - `"high"`

    - `location: Location | null`

      Approximate location used to localize search results, if provided.

      - `city: string | null`

        The city name.

        `minLength: 0`

      - `country: string | null`

        The two-letter ISO country code, such as `US`.

        `minLength: 0`

      - `region: string | null`

        The region or state name.

        `minLength: 0`

      - `timezone: string | null`

        The IANA timezone, such as `America/Los_Angeles`.

        `minLength: 0`

    - `mode: "disabled" | "cached" | "live"`

      The source used for web search results.

      - `"disabled"`

      - `"cached"`

      - `"live"`

    - `type: "web_search"`

      The type of the object. Always `web_search`.

      - `"web_search"`

  - `PersistedAgentToolResourceComputerUse`

    Browser use in an OpenAI-hosted session.

    - `include_screenshots: boolean`

      Whether computer tool outputs include screenshots.

    - `type: "computer_use"`

      The type of the object. Always `computer_use`.

      - `"computer_use"`

  - `PersistedAgentToolResourceAutomations`

    Lets the agent manage its own scheduled wakeups.

    - `type: "automations"`

      The type of the object. Always `automations`.

      - `"automations"`

### Persisted Agent Tool Param

- `PersistedAgentToolParam = PersistedAgentToolConfigParamFunction | PersistedAgentToolConfigParamToolSearch | PersistedAgentToolConfigParamProgrammaticToolCalling | 4 more`

  A tool that can be stored on a reusable agent without session credentials.

  - `PersistedAgentToolConfigParamFunction`

    A function defined by the application.

    - `description: string`

      A description of what the function does.

      `minLength: 0`, `maxLength: 1048576`

    - `name: string`

      The name of the function.

      `minLength: 0`, `maxLength: 1048576`

    - `parameters: Record<string, unknown>`

      A JSON Schema object describing the function's arguments.

    - `type: "function"`

      The type of the object. Always `function`.

      - `"function"`

    - `async?: boolean`

      Whether the agent continues without waiting for the function result. Defaults to `false`.

    - `defer_loading?: boolean`

      Whether this function is deferred and discovered through tool search. Defaults to `false`.

  - `PersistedAgentToolConfigParamToolSearch`

    Discovers deferred function tools and loads them into the model context.

    - `type: "tool_search"`

      The type of the object. Always `tool_search`.

      - `"tool_search"`

  - `PersistedAgentToolConfigParamProgrammaticToolCalling`

    Enables calling tools from model-generated code.

    - `type: "programmatic_tool_calling"`

      The type of the object. Always `programmatic_tool_calling`.

      - `"programmatic_tool_calling"`

    - `enabled?: boolean`

      Whether tools can be called from model-generated code. Defaults to `true`.

  - `PersistedAgentToolConfigParamMcp`

    Tools provided by a remote MCP server without stored credentials.

    - `server_label: string`

      A label used to identify the MCP server in tool calls.

      `minLength: 0`, `maxLength: 1048576`

    - `transport: PersistedMcpTransportParam`

      The credential-free transport used to connect to the MCP server.

      - `PersistedMcpTransportConfigParamHTTP`

        Connects to an MCP server over HTTP.

        - `server_url: string`

          The URL of the MCP server.

          `minLength: 0`, `maxLength: 1048576`

        - `type: "http"`

          The type of the object. Always `http`.

          - `"http"`

        - `headers?: Record<string, string> | null`

          Non-secret HTTP headers sent to the MCP server.

      - `PersistedMcpTransportConfigParamStdio`

        Starts an MCP server as a local process.

        - `command: string`

          The command used to start the MCP server.

          `minLength: 0`, `maxLength: 1048576`

        - `cwd: string`

          The working directory used to start the MCP server.

          `minLength: 0`, `maxLength: 1048576`

        - `type: "stdio"`

          The type of the object. Always `stdio`.

          - `"stdio"`

        - `args?: Array<string> | null`

          Arguments passed to the MCP server command.

          `minItems: 0`, `maxItems: 16384`

        - `env_vars?: Array<string> | null`

          Environment variable names to inherit from the selected execution environment.

          `minItems: 0`, `maxItems: 16384`

    - `type: "mcp"`

      The type of the object. Always `mcp`.

      - `"mcp"`

    - `allowed_tools?: Array<string> | null`

      The MCP tools the agent may call. All server tools are allowed when omitted.

      `minItems: 0`, `maxItems: 16384`

    - `connection_origin?: "service" | "environment" | null`

      Selects where outbound MCP HTTP connections originate.

      - `"service"`

        Uses the Managed Agents service network.

      - `"environment"`

        Uses the session's execution environment.

    - `credential_id?: string | null`

      The vault credential selected for this MCP server. Optional when exactly one attached credential matches the server URL.

      `minLength: 0`, `maxLength: 1048576`

    - `request_metadata?: Record<string, unknown> | null`

      Metadata included with requests to this MCP server.

    - `required?: boolean`

      Whether this MCP server must initialize before the first turn. Defaults to `false`.

  - `PersistedAgentToolConfigParamWebSearch`

    Web search.

    - `type: "web_search"`

      The type of the object. Always `web_search`.

      - `"web_search"`

    - `allowed_domains?: Array<string> | null`

      Domains the search may include.

      `minItems: 0`, `maxItems: 16384`

    - `context_size?: "low" | "medium" | "high" | null`

      The amount of search context made available to the model. Defaults to `medium`.

      - `"low"`

      - `"medium"`

      - `"high"`

    - `location?: Location | null`

      Approximate location used to localize search results.

      - `city?: string | null`

        The city name.

        `minLength: 0`, `maxLength: 1048576`

      - `country?: string | null`

        The two-letter ISO country code, such as `US`.

        `minLength: 0`, `maxLength: 1048576`

      - `region?: string | null`

        The region or state name.

        `minLength: 0`, `maxLength: 1048576`

      - `timezone?: string | null`

        The IANA timezone, such as `America/Los_Angeles`.

        `minLength: 0`, `maxLength: 1048576`

    - `mode?: "disabled" | "cached" | "live" | null`

      The source used for web search results. Defaults to `live`.

      - `"disabled"`

        Disables web search.

      - `"cached"`

        Uses cached search results.

      - `"live"`

        Searches the live web.

  - `PersistedAgentToolConfigParamComputerUse`

    Browser use in an OpenAI-hosted session.

    - `type: "computer_use"`

      The type of the object. Always `computer_use`.

      - `"computer_use"`

    - `include_screenshots?: boolean`

      Whether computer tool outputs include screenshots. Defaults to `false`.

  - `PersistedAgentToolConfigParamAutomations`

    Lets the agent manage its own scheduled wakeups.

    - `type: "automations"`

      The type of the object. Always `automations`.

      - `"automations"`

### Persisted Mcp Transport

- `PersistedMcpTransport = PersistedMcpTransportResourceHTTP | PersistedMcpTransportResourceStdio`

  A credential-free transport used to connect to an MCP server.

  - `PersistedMcpTransportResourceHTTP`

    Connects to an MCP server over HTTP.

    - `headers: Record<string, string>`

      Non-secret HTTP headers sent to the MCP server.

    - `server_url: string`

      The URL of the MCP server.

      `minLength: 0`

    - `type: "http"`

      The type of the object. Always `http`.

      - `"http"`

  - `PersistedMcpTransportResourceStdio`

    Starts an MCP server as a local process.

    - `args: Array<string>`

      Arguments passed to the MCP server command.

      `minItems: 0`, `maxItems: 2000`

    - `command: string`

      The command used to start the MCP server.

      `minLength: 0`

    - `cwd: string`

      The working directory used to start the MCP server.

      `minLength: 0`

    - `env_vars: Array<string>`

      Environment variable names inherited from the execution environment.

      `minItems: 0`, `maxItems: 2000`

    - `type: "stdio"`

      The type of the object. Always `stdio`.

      - `"stdio"`

### Persisted Mcp Transport Param

- `PersistedMcpTransportParam = PersistedMcpTransportConfigParamHTTP | PersistedMcpTransportConfigParamStdio`

  A credential-free transport used to connect to an MCP server.

  - `PersistedMcpTransportConfigParamHTTP`

    Connects to an MCP server over HTTP.

    - `server_url: string`

      The URL of the MCP server.

      `minLength: 0`, `maxLength: 1048576`

    - `type: "http"`

      The type of the object. Always `http`.

      - `"http"`

    - `headers?: Record<string, string> | null`

      Non-secret HTTP headers sent to the MCP server.

  - `PersistedMcpTransportConfigParamStdio`

    Starts an MCP server as a local process.

    - `command: string`

      The command used to start the MCP server.

      `minLength: 0`, `maxLength: 1048576`

    - `cwd: string`

      The working directory used to start the MCP server.

      `minLength: 0`, `maxLength: 1048576`

    - `type: "stdio"`

      The type of the object. Always `stdio`.

      - `"stdio"`

    - `args?: Array<string> | null`

      Arguments passed to the MCP server command.

      `minItems: 0`, `maxItems: 16384`

    - `env_vars?: Array<string> | null`

      Environment variable names to inherit from the selected execution environment.

      `minItems: 0`, `maxItems: 16384`

### Session Error

- `SessionError`

  An error payload with the same public fields as Responses API streaming errors.

  - `code: string | null`

    The machine-readable error code, if any.

    `minLength: 0`

  - `message: string`

    A customer-safe explanation of the error.

    `minLength: 0`

  - `param: string | null`

    The request parameter associated with the error, if any.

    `minLength: 0`

  - `type: string`

    The error type.

    `minLength: 0`

### Session Turn Error

- `SessionTurnError`

  A customer-safe error describing why a session request failed.

  - `code: "context_length_exceeded" | "max_output_tokens" | "session_budget_exceeded" | 21 more`

    A stable, machine-readable failure category.

    - `"context_length_exceeded"`

      The request exceeds the model's context window.

    - `"max_output_tokens"`

      The model reached its output token limit before finishing the response.

    - `"session_budget_exceeded"`

      The session has reached its usage budget.

    - `"usage_limit_exceeded"`

      The organization has reached a usage, plan, or billing limit.

    - `"project_spend_limit_exceeded"`

      The project has reached its enforced spend limit.

    - `"organization_spend_limit_exceeded"`

      The organization has reached its enforced spend limit.

    - `"organization_usage_limit_exceeded"`

      The organization has reached its OpenAI-assigned usage limit.

    - `"billing_not_active"`

      Billing is not active for the account.

    - `"credit_balance_exhausted"`

      The organization has no API credits remaining.

    - `"rate_limit_exceeded"`

      The request exceeds the available rate limit.

    - `"flex_unavailable"`

      Flex processing is temporarily unavailable.

    - `"server_overloaded"`

      The model service is temporarily overloaded.

    - `"cyber_policy"`

      The request was rejected by a safety policy.

    - `"misalignment_policy_violation"`

      The request was blocked by the safety systems.

    - `"connection_failed"`

      The request could not connect to the model service.

    - `"server_error"`

      The model service encountered an unexpected error.

    - `"authentication_error"`

      The API credentials are invalid or lack the required access.

    - `"invalid_request"`

      The request contains invalid input or configuration.

    - `"resource_not_found"`

      The requested model or resource is unavailable.

    - `"sandbox_error"`

      The request could not complete in its execution environment.

    - `"executor_version_incompatible"`

      The executor must be upgraded before it can run this turn.

    - `"active_turn_not_steerable"`

      The session cannot accept additional input while a request is running.

    - `"request_timeout"`

      The request timed out before the model service responded.

    - `"internal_error"`

      An unexpected internal error prevented the session request from completing.

  - `message: string`

    A customer-safe explanation of the failure.

    `minLength: 0`

### Setup Command Param

- `SetupCommandParam`

  A confidential setup command executed before the hosted agent starts.

  - `command: string`

    The shell command to execute.

    `minLength: 0`, `maxLength: 65536`

  - `cwd?: string | null`

    The absolute working directory. Defaults to `/workspace`.

    `minLength: 0`, `maxLength: 4096`

### Subagent

- `Subagent`

  A subagent created within a session.

  - `id: string`

    The ID of the subagent.

    `minLength: 0`

  - `closed_at: number | null`

    The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume.

    `format: int64`

  - `instructions: Array<AgentContent> | null`

    Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available.

    `minItems: 0`, `maxItems: 2000`

    - `OutputText`

      A text content part produced by the agent.

      - `text: string`

        The text produced by the agent.

        `minLength: 0`

      - `type: "output_text"`

        The content type. Always `output_text`.

        - `"output_text"`

    - `EncryptedContentResource`

      Encrypted content exchanged between agents.

      - `encrypted_content: string`

        The encrypted content payload.

        `minLength: 0`

      - `type: "encrypted_content"`

        The content type. Always `encrypted_content`.

        - `"encrypted_content"`

  - `name: string | null`

    The runner-assigned nickname, or null when unavailable.

    `minLength: 0`

  - `object: "agent.session.subagent"`

    The object type. Always `agent.session.subagent`.

    - `"agent.session.subagent"`

  - `opened_at: number`

    The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it.

    `format: int64`

  - `parent_agent_id: string`

    The ID of the agent that created this subagent.

    `minLength: 0`

  - `session_id: string`

    The ID of the session that owns the subagent.

    `minLength: 0`

  - `status: "active" | "closed"`

    The current status of the subagent.

    - `"active"`

      The subagent remains available, including while idle between turns.

    - `"closed"`

      The subagent is closed.

### Summary Text

- `SummaryText`

  A reasoning summary content part.

  - `text: string`

    The reasoning summary text.

    `minLength: 0`

  - `type: "summary_text"`

    The content type. Always `summary_text`.

    - `"summary_text"`

### Text Format

- `TextFormat = TextFormatResourceText | TextFormatResourceJSONSchema`

  The effective output format for generated text.

  - `TextFormatResourceText`

    Generates ordinary text without a structured-output constraint.

    - `type: "text"`

      The type of the object. Always `text`.

      - `"text"`

  - `TextFormatResourceJSONSchema`

    Constrains generated text to a JSON Schema.

    - `schema: Record<string, unknown>`

      The JSON Schema that generated text must match.

    - `type: "json_schema"`

      The type of the object. Always `json_schema`.

      - `"json_schema"`

### Text Format Param

- `TextFormatParam = TextFormatParamText | TextFormatParamJSONSchema`

  The output format for generated text.

  - `TextFormatParamText`

    Generates ordinary text without a structured-output constraint.

    - `type: "text"`

      The type of the object. Always `text`.

      - `"text"`

  - `TextFormatParamJSONSchema`

    Constrains generated text to a JSON Schema.

    - `schema: Record<string, unknown>`

      The JSON Schema that generated text must match.

    - `type: "json_schema"`

      The type of the object. Always `json_schema`.

      - `"json_schema"`

### Token Usage

- `TokenUsage`

  Recorded token usage for a session or turn. Usage is best effort and may change.

  - `input_tokens: number`

    The number of input tokens used by the agent.

    `format: int64`

  - `input_tokens_details: InputTokensDetails`

    A breakdown of the agent's input token usage.

    - `cached_tokens: number`

      The number of input tokens retrieved from the prompt cache.

      `format: int64`

  - `output_tokens: number`

    The number of output tokens generated by the agent.

    `format: int64`

  - `output_tokens_details: OutputTokensDetails`

    A breakdown of the agent's output token usage.

    - `reasoning_tokens: number`

      The number of output tokens used for reasoning.

      `format: int64`

  - `total_tokens: number`

    The total number of input and output tokens used by the agent.

    `format: int64`

### Web Search Action

- `WebSearchAction = WebSearchActionResourceSearch | WebSearchActionResourceOpenPage | WebSearchActionResourceFindInPage | WebSearchActionResourceOther`

  An action performed by the web search tool.

  - `WebSearchActionResourceSearch`

    A search query or group of search queries.

    - `queries: Array<string> | null`

      The search queries, when multiple queries were used.

      `minItems: 0`, `maxItems: 2000`

    - `query: string | null`

      The search query, when a single query was used.

      `minLength: 0`

    - `type: "search"`

      The type of the object. Always `search`.

      - `"search"`

  - `WebSearchActionResourceOpenPage`

    Opens a web page.

    - `type: "open_page"`

      The type of the object. Always `open_page`.

      - `"open_page"`

    - `url: string | null`

      The URL of the page that was opened.

      `minLength: 0`

  - `WebSearchActionResourceFindInPage`

    Finds text within a web page.

    - `pattern: string | null`

      The text pattern that was searched for.

      `minLength: 0`

    - `type: "find_in_page"`

      The type of the object. Always `find_in_page`.

      - `"find_in_page"`

    - `url: string | null`

      The URL of the page that was searched.

      `minLength: 0`

  - `WebSearchActionResourceOther`

    Another web search action.

    - `type: "other"`

      The type of the object. Always `other`.

      - `"other"`

# Automations

## Create an automation

`client.beta.agents.automations.create(AutomationCreateParamsbody, RequestOptionsoptions?): Automation`

**post** `/agents/automations`

Saves an active automation without invoking it immediately.

### Parameters

- `AutomationCreateParams = CreateAutomationParamsPeriodic | CreateAutomationParamsOnce`

  - `AutomationCreateParamsBase`

    - `expression: string`

      A standard five-field cron expression defining scheduled occurrences.

      `minLength: 1`, `maxLength: 256`

    - `name: string`

      A human-readable name for the automation.

      `minLength: 1`, `maxLength: 256`

    - `target: AutomationTargetParam`

      The session an automation invocation targets.

      - `AutomationTargetParamNewSession`

        Create a session for each invocation.

        - `environment: EnvironmentParam`

          The execution environment for each new session.

          - `EnvironmentParamNone`

            Runs the agent without an execution environment.

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `EnvironmentParamOpenAIHosted`

            An existing OpenAI-hosted environment or new inline/template-based hosted configuration.

            - `type: "openai_hosted"`

              The type of the object. Always `openai_hosted`.

              - `"openai_hosted"`

            - `capability_directories?: Array<string> | null`

              Directories that contain capabilities exposed to the agent. Defaults to an empty list.

              `minItems: 0`, `maxItems: 16384`

            - `container_size?: "small" | "medium" | "large"`

              The hosted container size. Omission selects the medium tier.

              - `"small"`

              - `"medium"`

              - `"large"`

            - `desktop?: Desktop | null`

              Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled.

              - `enabled: boolean`

                Whether to provision the desktop and its browser proxy.

            - `env?: Record<string, string> | null`

              Environment variables made available to the agent.

            - `environment_id?: string`

              An existing prewarmed environment. Cannot be combined with a template or inline configuration.

              `minLength: 9`, `maxLength: 256`

            - `environment_template_id?: string`

              A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy.

              `minLength: 0`, `maxLength: 64`

            - `files?: Array<HostedEnvironmentFileParam> | null`

              Files available before the agent starts. Defaults to an empty list.

              `minItems: 0`, `maxItems: 50`

              - `HostedEnvironmentFileParamFileID`

                A file previously uploaded through the OpenAI Files API.

                - `file_id: string`

                  The ID of the uploaded file.

                  `minLength: 1`, `maxLength: 256`

                - `path: string`

                  The absolute destination path inside `/workspace`.

                  `minLength: 1`, `maxLength: 4096`

                - `type: "file_id"`

                  The type of the object. Always `file_id`.

                  - `"file_id"`

              - `HostedEnvironmentFileParamInline`

                A file supplied directly as standard-base64 data.

                - `data: string`

                  The standard-base64-encoded file contents.

                  `minLength: 0`, `maxLength: 6990508`

                - `path: string`

                  The absolute destination path inside `/workspace`.

                  `minLength: 1`, `maxLength: 4096`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `network?: Network | null`

              Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled.

              - `access: "enabled" | "disabled" | "restricted"`

                The environment's network access mode.

                - `"enabled"`

                  Allows unrestricted network access.

                - `"disabled"`

                  Disables network access.

                - `"restricted"`

                  Applies the configured domain restrictions.

              - `allowed_domains?: Array<string> | null`

                Domains the environment may access when network access is restricted.

                `minItems: 0`, `maxItems: 16384`

              - `blocked_domains?: Array<string> | null`

                Domains blocked for both executor and browser when access is restricted. A nonempty list requires `access: restricted` and cannot be combined with nonempty `allowed_domains`. Wildcard domains are not supported.

                `minItems: 0`, `maxItems: 100`

            - `packages?: Packages | null`

              Packages to install in the environment. Defaults to empty package lists.

              - `npm?: Array<string> | null`

                npm packages to install globally. Defaults to an empty list.

                `minItems: 0`, `maxItems: 16384`

              - `python?: Array<string> | null`

                Python packages to install. Defaults to an empty list.

                `minItems: 0`, `maxItems: 16384`

              - `system?: Array<string> | null`

                System packages to install. Defaults to an empty list.

                `minItems: 0`, `maxItems: 16384`

            - `plugins?: Array<HostedPluginParam> | null`

              Plugins provided as inline ZIP archives. Defaults to an empty list.

              `minItems: 0`, `maxItems: 32`

              - `description: string`

                The plugin description declared in `.codex-plugin/plugin.json`.

                `minLength: 0`, `maxLength: 1048576`

              - `name: string`

                The plugin name declared in `.codex-plugin/plugin.json`.

                `minLength: 1`, `maxLength: 64`

              - `source: InlineCapabilitySourceParam`

                Provides ZIP bytes encoded with standard base64.

                - `data: string`

                  Standard-base64 encoded ZIP archive bytes.

                  `minLength: 1`, `maxLength: 70254592`

                - `media_type: "application/zip"`

                  The archive media type, always `application/zip`.

                  - `"application/zip"`

                - `type: "base64"`

                  The type of the object. Always `base64`.

                  - `"base64"`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

            - `setup_commands?: Array<SetupCommandParam> | null`

              Ordered, confidential setup commands. Command bodies are never returned.

              `minItems: 0`, `maxItems: 16`

              - `command: string`

                The shell command to execute.

                `minLength: 0`, `maxLength: 65536`

              - `cwd?: string | null`

                The absolute working directory. Defaults to `/workspace`.

                `minLength: 0`, `maxLength: 4096`

            - `skills?: Array<HostedSkillParam> | null`

              Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.

              `minItems: 0`, `maxItems: 200`

              - `HostedSkillParamSkillReference`

                References a skill uploaded through the Skills API.

                - `skill_id: string`

                  The ID of the skill created through `/v1/skills`.

                  `minLength: 1`, `maxLength: 64`

                - `type: "skill_reference"`

                  The type of the object. Always `skill_reference`.

                  - `"skill_reference"`

                - `version?: string | null`

                  The skill version, a positive integer or `latest`; omission selects the default.

                  `minLength: 0`, `maxLength: 1048576`

              - `HostedSkillParamInline`

                Supplies a skill ZIP directly in the session request.

                - `description: string`

                  The skill description declared in `SKILL.md`.

                  `minLength: 0`, `maxLength: 1048576`

                - `name: string`

                  The skill name declared in `SKILL.md`.

                  `minLength: 1`, `maxLength: 64`

                - `source: InlineCapabilitySourceParam`

                  Provides ZIP bytes encoded with standard base64.

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

          - `EnvironmentParamSelfHosted`

            An application-hosted environment configured inline.

            - `type: "self_hosted"`

              The type of the object. Always `self_hosted`.

              - `"self_hosted"`

            - `workspace_directory: string`

              Absolute project directory inside the self-hosted environment.

              `minLength: 0`, `maxLength: 1048576`

            - `capability_directories?: Array<string> | null`

              Directories that contain capabilities exposed to the agent. Defaults to an empty list.

              `minItems: 0`, `maxItems: 16384`

        - `input: Array<AgentSessionInputMessageParam>`

          Initial user messages submitted with each new session.

          `minItems: 0`, `maxItems: 16384`

          - `content: Array<InputContentParam>`

            The content of the message.

            `minItems: 0`, `maxItems: 16384`

            - `InputContentParamInputText`

              Text input to the model.

              - `text: string`

                The text sent to the model.

                `minLength: 0`, `maxLength: 1048576`

              - `type: "input_text"`

                The type of the object. Always `input_text`.

                - `"input_text"`

            - `InputContentParamInputImage`

              Image input to the model.

              - `image_url: string`

                The URL of the image sent to the model.

                `minLength: 0`, `maxLength: 1048576`

              - `type: "input_image"`

                The type of the object. Always `input_image`.

                - `"input_image"`

          - `role: "user"`

            The role of the message author. Always `user`.

            - `"user"`

          - `type?: "message"`

            The type of the input item. Always `message`.

            - `"message"`

        - `type: "new_session"`

          The type of the object. Always `new_session`.

          - `"new_session"`

        - `agent?: Agent`

          Inline agent configuration. Provide exactly one of agent and agent_id.

          - `compaction?: Compaction | null`

            Context compaction settings. Omit to keep the current settings. A supplied object replaces the settings; null or an empty object enables background compaction.

            - `async?: boolean | null`

              Whether to compact context in the background. Omission or null defaults to true. Set to false to use blocking compaction. Background compaction may increase token usage.

          - `experimental?: Experimental`

            Experimental settings to merge by key. Omitted settings keep their current values.

            - `time_awareness?: boolean`

              Whether to give the model periodic current-time reminders. Omit to keep the current setting.

          - `instructions?: string | null`

            Additional instructions appended to the agent's default base instructions. Omit to leave unchanged.

            `minLength: 0`, `maxLength: 1048576`

          - `model?: string`

            The model to use for the agent. The requested model name is preserved.

            `minLength: 0`, `maxLength: 1048576`

          - `multi_agent?: MultiAgentConfigParam | null`

            Configuration for creating and coordinating subagents.

            - `enabled: boolean`

              Whether subagent tools are enabled.

            - `max_concurrent_subagents?: number`

              Maximum number of subagents that may run concurrently. Defaults to 6.

              `format: int64`, `minimum: 1`, `maximum: 4294967295`

          - `reasoning?: AgentReasoningParam | null`

            Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort.

            - `effort?: "none" | "minimal" | "low" | 4 more | null`

              The amount of reasoning effort the model should use. Omission lets the model select it.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

            - `summary?: "concise" | "detailed" | "auto" | null`

              Controls whether the response includes a reasoning summary.

              - `"concise"`

                Returns a concise reasoning summary when supported.

              - `"detailed"`

                Returns a detailed reasoning summary when supported.

              - `"auto"`

                Automatically selects the most detailed summary supported by the model.

          - `service_tier?: "auto" | "default" | "flex" | 3 more | null`

            The service tier used for model requests.

            - `"auto"`

              Selects the service tier automatically.

            - `"default"`

              Uses the default service tier.

            - `"flex"`

              Uses the flex service tier.

            - `"priority"`

              Uses the priority service tier.

            - `"fast"`

              Uses the fast service tier.

            - `"ultrafast"`

              Uses the ultrafast service tier.

          - `text?: AgentTextParam | null`

            Configuration for text generated by the agent.

            - `format?: TextFormatParam | null`

              The output format. Omission uses ordinary text (`{"type": "text"}`).

              - `TextFormatParamText`

                Generates ordinary text without a structured-output constraint.

                - `type: "text"`

                  The type of the object. Always `text`.

                  - `"text"`

              - `TextFormatParamJSONSchema`

                Constrains generated text to a JSON Schema.

                - `schema: Record<string, unknown>`

                  The JSON Schema that generated text must match.

                - `type: "json_schema"`

                  The type of the object. Always `json_schema`.

                  - `"json_schema"`

            - `verbosity?: "low" | "medium" | "high" | null`

              The amount of text the model should produce. Defaults to `medium`, matching Responses.

              - `"low"`

                Produces less text.

              - `"medium"`

                Uses the default amount of text.

              - `"high"`

                Produces more text.

          - `tools?: Array<AgentToolParam> | null`

            Tools available to the agent. Omit to inherit, or pass null to clear them. The resolved tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON.

            `minItems: 0`, `maxItems: 16384`

            - `AgentToolConfigParamFunction`

              A function defined by the application.

              - `description: string`

                A description of what the function does.

                `minLength: 0`, `maxLength: 1048576`

              - `name: string`

                The name of the function.

                `minLength: 0`, `maxLength: 1048576`

              - `parameters: Record<string, unknown>`

                A JSON Schema object describing the function's arguments.

              - `type: "function"`

                The type of the object. Always `function`.

                - `"function"`

              - `async?: boolean`

                Whether the agent continues without waiting for the function result. Defaults to `false`.

              - `defer_loading?: boolean`

                Whether this function is deferred and discovered through tool search. Defaults to `false`.

            - `AgentToolConfigParamToolSearch`

              Discovers deferred function tools and loads them into the model context.

              - `type: "tool_search"`

                The type of the object. Always `tool_search`.

                - `"tool_search"`

            - `AgentToolConfigParamProgrammaticToolCalling`

              Enables calling tools from model-generated code.

              - `type: "programmatic_tool_calling"`

                The type of the object. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

              - `enabled?: boolean`

                Whether tools can be called from model-generated code. Defaults to `true`.

            - `AgentToolConfigParamMcp`

              Tools provided by a remote MCP server.

              - `server_label: string`

                A label used to identify the MCP server in tool calls.

                `minLength: 0`, `maxLength: 1048576`

              - `transport: McpTransportParam`

                The transport used to connect to the MCP server.

                - `McpTransportConfigParamHTTP`

                  Connects to an MCP server over HTTP.

                  - `server_url: string`

                    The URL of the MCP server.

                    `minLength: 0`, `maxLength: 1048576`

                  - `type: "http"`

                    The type of the object. Always `http`.

                    - `"http"`

                  - `authorization?: string | null`

                    The authorization value sent to the MCP server, if any.

                    `minLength: 0`, `maxLength: 1048576`

                  - `headers?: Record<string, string> | null`

                    Additional HTTP headers sent to the MCP server.

                - `McpTransportConfigParamStdio`

                  Starts an MCP server as a local process.

                  - `command: string`

                    The command used to start the MCP server.

                    `minLength: 0`, `maxLength: 1048576`

                  - `cwd: string`

                    The working directory used to start the MCP server.

                    `minLength: 0`, `maxLength: 1048576`

                  - `type: "stdio"`

                    The type of the object. Always `stdio`.

                    - `"stdio"`

                  - `args?: Array<string> | null`

                    Arguments passed to the MCP server command.

                    `minItems: 0`, `maxItems: 16384`

                  - `env?: Record<string, string> | null`

                    Environment variables set for the MCP server process.

                  - `env_vars?: Array<string> | null`

                    Environment variable names to inherit from the selected execution environment.

                    `minItems: 0`, `maxItems: 16384`

              - `type: "mcp"`

                The type of the object. Always `mcp`.

                - `"mcp"`

              - `allowed_tools?: Array<string> | null`

                The MCP tools the agent may call. All server tools are allowed when omitted.

                `minItems: 0`, `maxItems: 16384`

              - `connection_origin?: "service" | "environment" | null`

                Selects where outbound MCP HTTP connections originate. Omitted or `service` uses the Managed Agents service network; `environment` uses the session's selected environment.

                - `"service"`

                  Uses the Managed Agents service network.

                - `"environment"`

                  Uses the session's execution environment.

              - `credential_id?: string | null`

                The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL.

                `minLength: 0`, `maxLength: 1048576`

              - `request_metadata?: Record<string, unknown> | null`

                Metadata included with requests to this MCP server.

              - `required?: boolean`

                Whether this MCP server must initialize before the first turn. Defaults to `false`.

            - `AgentToolConfigParamWebSearch`

              Web search.

              - `type: "web_search"`

                The type of the object. Always `web_search`.

                - `"web_search"`

              - `allowed_domains?: Array<string> | null`

                Domains the search may include.

                `minItems: 0`, `maxItems: 16384`

              - `context_size?: "low" | "medium" | "high" | null`

                The amount of search context made available to the model. Defaults to `medium`.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `location?: Location | null`

                Approximate location used to localize search results.

                - `city?: string | null`

                  The city name.

                  `minLength: 0`, `maxLength: 1048576`

                - `country?: string | null`

                  The two-letter ISO country code, such as `US`.

                  `minLength: 0`, `maxLength: 1048576`

                - `region?: string | null`

                  The region or state name.

                  `minLength: 0`, `maxLength: 1048576`

                - `timezone?: string | null`

                  The IANA timezone, such as `America/Los_Angeles`.

                  `minLength: 0`, `maxLength: 1048576`

              - `mode?: "disabled" | "cached" | "live" | null`

                The source used for web search results. Defaults to `live`.

                - `"disabled"`

                  Disables web search.

                - `"cached"`

                  Uses cached search results.

                - `"live"`

                  Searches the live web.

            - `AgentToolConfigParamComputerUse`

              Browser use in an OpenAI-hosted session.

              - `type: "computer_use"`

                The type of the object. Always `computer_use`.

                - `"computer_use"`

              - `include_screenshots?: boolean`

                Whether computer tool outputs include screenshots. Defaults to `false`.

            - `AgentToolConfigParamAutomations`

              Lets the agent manage its own scheduled wakeups.

              - `type: "automations"`

                The type of the object. Always `automations`.

                - `"automations"`

        - `agent_id?: string`

          A saved agent ID. Provide exactly one of agent and agent_id.

          `minLength: 0`, `maxLength: 64`

        - `metadata?: Record<string, string> | null`

          Metadata attached to each new session.

        - `vault_ids?: Array<string> | null`

          The IDs of vaults made available to each new session.

          `minItems: 0`, `maxItems: 16384`

      - `AutomationTargetParamExistingSession`

        Deliver instructions to an existing session.

        - `instructions: string`

          Instructions delivered as an automation notification.

          `minLength: 0`, `maxLength: 1048576`

        - `session_id: string`

          The session receiving each invocation.

          `minLength: 0`, `maxLength: 1048576`

        - `type: "existing_session"`

          The type of the object. Always `existing_session`.

          - `"existing_session"`

    - `timezone: string`

      The IANA timezone used to interpret the cron expression.

      `minLength: 1`, `maxLength: 128`

    - `type: "periodic"`

      The type of the object. Always `periodic`.

      - `"periodic"`

    - `metadata?: Record<string, string>`

  - `CreateAutomationParamsPeriodic extends AutomationCreateParamsBase`

  - `CreateAutomationParamsOnce`

    - `name: string`

      A human-readable name for the automation.

      `minLength: 1`, `maxLength: 256`

    - `run_at: number`

      A future Unix timestamp in seconds.

      `format: int64`

    - `target: AutomationTargetParam`

      The session an automation invocation targets.

    - `type: "once"`

      The type of the object. Always `once`.

      - `"once"`

    - `metadata?: Record<string, string>`

### Returns

- `Automation = PeriodicAutomation | OneTimeAutomation`

  A saved automation and its schedule.

  - `PeriodicAutomation`

    Fields shared by periodic and one-time automations.

    - `id: string`

      The automation ID.

      `minLength: 0`

    - `created_at: number`

      The creation time as a Unix timestamp in seconds.

      `format: int64`

    - `created_by: AutomationCreatedBy`

      Service-recorded provenance; callers cannot supply this field.

      - `AutomationCreatedByResourceDeveloper`

        - `type: "developer"`

          The type of the object. Always `developer`.

          - `"developer"`

      - `AutomationCreatedByResourceAgent`

        - `session_id: string`

          The creator session, which is also the automation's target.

          `minLength: 0`

        - `tool_call_id: string`

          The tool call that created the automation.

          `minLength: 0`

        - `type: "agent"`

          The type of the object. Always `agent`.

          - `"agent"`

    - `expression: string`

      The cron expression determining scheduled occurrences.

      `minLength: 0`

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the automation.

    - `name: string`

      The automation's display name.

      `minLength: 0`

    - `object: "agent.automation"`

      Always `agent.automation`.

      - `"agent.automation"`

    - `status: "active" | "paused"`

      Whether scheduled delivery is active or paused.

      - `"active"`

      - `"paused"`

    - `target: AutomationTarget`

      The session configuration or existing session receiving invocations.

      - `AutomationTargetResourceNewSession`

        - `agent: AutomationAgentConfig | null`

          The inline agent configuration, or null when agent_id is configured.

          - `instructions: string | null`

            Custom instructions, or null when absent.

            `minLength: 0`

          - `model: string`

            The requested model name.

            `minLength: 0`

          - `multi_agent: MultiAgentConfig`

            The configuration for creating and coordinating subagents.

            - `enabled: boolean`

              Whether subagent tools are enabled. Defaults to false.

            - `max_concurrent_subagents: number | null`

              Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

              `format: int64`, `minimum: 1`, `maximum: 4294967295`

          - `reasoning: AgentReasoning`

            The configured reasoning policy.

            - `effort: "none" | "minimal" | "low" | 4 more | null`

              The requested reasoning effort, or `null` when the model selects its own default.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

            - `summary: "concise" | "detailed" | "auto" | null`

              The requested reasoning summary format, or `null` when summaries are disabled.

              - `"concise"`

                Returns a concise reasoning summary when supported.

              - `"detailed"`

                Returns a detailed reasoning summary when supported.

              - `"auto"`

                Automatically selects the most detailed summary supported by the model.

          - `service_tier: "auto" | "default" | "flex" | 3 more`

            The configured service-tier policy.

            - `"auto"`

            - `"default"`

            - `"flex"`

            - `"priority"`

            - `"fast"`

            - `"ultrafast"`

          - `text: AgentText`

            The configured output format and verbosity.

            - `format: TextFormat`

              The effective output format. Defaults to ordinary text.

              - `TextFormatResourceText`

                Generates ordinary text without a structured-output constraint.

                - `type: "text"`

                  The type of the object. Always `text`.

                  - `"text"`

              - `TextFormatResourceJSONSchema`

                Constrains generated text to a JSON Schema.

                - `schema: Record<string, unknown>`

                  The JSON Schema that generated text must match.

                - `type: "json_schema"`

                  The type of the object. Always `json_schema`.

                  - `"json_schema"`

            - `verbosity: "low" | "medium" | "high"`

              The amount of text produced by the agent. Defaults to `medium`.

              - `"low"`

              - `"medium"`

              - `"high"`

          - `tools: Array<AgentTool>`

            Configured tools, excluding confidential credentials.

            `minItems: 0`, `maxItems: 2000`

            - `AgentToolResourceFunction`

              A function defined by the application.

              - `defer_loading: boolean`

                Whether the function is deferred and discovered through tool search.

              - `description: string`

                A description of what the function does.

                `minLength: 0`

              - `name: string`

                The name of the function.

                `minLength: 0`

              - `parameters: Record<string, unknown>`

                A JSON Schema object describing the function's arguments.

              - `type: "function"`

                The type of the object. Always `function`.

                - `"function"`

              - `async?: boolean`

                Whether the agent continues without waiting for the function result.

            - `AgentToolResourceProgrammaticToolCalling`

              Enables calling tools from model-generated code.

              - `enabled: boolean`

                Whether tools can be called from model-generated code.

              - `type: "programmatic_tool_calling"`

                The type of the object. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `AgentToolResourceMcp`

              Tools provided by a remote MCP server.

              - `allowed_tools: Array<string> | null`

                The MCP tools the agent may call.

                `minItems: 0`, `maxItems: 2000`

              - `connection_origin: "service" | "environment"`

                Where outbound MCP HTTP connections originate.

                - `"service"`

                - `"environment"`

              - `credential_id: string | null`

                The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

                `minLength: 0`

              - `request_metadata: Record<string, unknown>`

                Metadata included with requests to this MCP server.

              - `required: boolean`

                Whether this MCP server must initialize before the first turn.

              - `server_label: string`

                A label used to identify the MCP server in tool calls.

                `minLength: 0`

              - `transport: McpTransport`

                The transport used to connect to the MCP server.

                - `McpTransportResourceHTTP`

                  Connects to an MCP server over HTTP.

                  - `server_url: string`

                    The URL of the MCP server.

                    `minLength: 0`

                  - `type: "http"`

                    The type of the object. Always `http`.

                    - `"http"`

                - `McpTransportResourceStdio`

                  Starts an MCP server as a local process.

                  - `args: Array<string>`

                    Arguments passed to the MCP server command.

                    `minItems: 0`, `maxItems: 2000`

                  - `command: string`

                    The command used to start the MCP server.

                    `minLength: 0`

                  - `cwd: string`

                    The working directory used to start the MCP server.

                    `minLength: 0`

                  - `env_vars: Array<string>`

                    Environment variable names inherited from the execution environment.

                    `minItems: 0`, `maxItems: 2000`

                  - `type: "stdio"`

                    The type of the object. Always `stdio`.

                    - `"stdio"`

              - `type: "mcp"`

                The type of the object. Always `mcp`.

                - `"mcp"`

            - `AgentToolResourceWebSearch`

              Web search.

              - `allowed_domains: Array<string> | null`

                Allowed search domains, or `null` when the search is unrestricted.

                `minItems: 0`, `maxItems: 2000`

              - `context_size: "low" | "medium" | "high"`

                The amount of search context made available to the model. Defaults to `medium`.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `location: Location | null`

                Approximate location used to localize search results, if provided.

                - `city: string | null`

                  The city name.

                  `minLength: 0`

                - `country: string | null`

                  The two-letter ISO country code, such as `US`.

                  `minLength: 0`

                - `region: string | null`

                  The region or state name.

                  `minLength: 0`

                - `timezone: string | null`

                  The IANA timezone, such as `America/Los_Angeles`.

                  `minLength: 0`

              - `mode: "disabled" | "cached" | "live"`

                The source used for web search results.

                - `"disabled"`

                - `"cached"`

                - `"live"`

              - `type: "web_search"`

                The type of the object. Always `web_search`.

                - `"web_search"`

            - `AgentToolResourceComputerUse`

              Browser use in an OpenAI-hosted session.

              - `include_screenshots: boolean`

                Whether computer tool outputs include screenshots.

              - `type: "computer_use"`

                The type of the object. Always `computer_use`.

                - `"computer_use"`

            - `AgentToolResourceAutomations`

              Lets the agent manage its own scheduled wakeups.

              - `type: "automations"`

                The type of the object. Always `automations`.

                - `"automations"`

          - `compaction?: Compaction`

            The effective context compaction settings.

            - `async: boolean`

              Whether context is compacted in the background. Defaults to true.

          - `experimental?: Experimental`

            The effective experimental settings for the agent.

            - `time_awareness: boolean`

              Whether the model receives periodic current-time reminders.

        - `agent_id: string | null`

          The saved agent reference, or null when an inline agent is configured.

          `minLength: 0`

        - `environment: AutomationEnvironment`

          Configuration or references used to select the execution environment.

          - `AutomationEnvironmentResourceNone`

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `AutomationEnvironmentResourceOpenAIHosted`

            Hosted environment selection with confidential setup commands and variables omitted.

            - `capability_directories: Array<string> | null`

              Directory overrides, or null to inherit the template or creation default.

              `minItems: 0`, `maxItems: 2000`

            - `container_size: "small" | "medium" | "large" | null`

              The configured container size, or null to use the creation default.

              - `"small"`

              - `"medium"`

              - `"large"`

            - `desktop: Desktop | null`

              Desktop overrides, or null to inherit the template or creation default.

              - `enabled: boolean`

                Whether the environment provisions a desktop and browser proxy.

            - `environment_id: string | null`

              An existing environment reference, or null when provisioning a new environment.

              `minLength: 0`

            - `environment_template_id: string | null`

              A template reference, or null when no template is selected.

              `minLength: 0`

            - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

              File overrides, excluding contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `HostedTemplateFileResourceFileID`

                A project-scoped Files API reference resolved separately for each session.

                - `file_id: string`

                  The ID of the uploaded file.

                  `minLength: 0`

                - `path: string`

                  The file's absolute path inside the environment.

                  `minLength: 0`

                - `type: "file_id"`

                  The type of the object. Always `file_id`.

                  - `"file_id"`

              - `HostedTemplateFileResourceInline`

                Metadata for confidential inline file contents.

                - `path: string`

                  The file's absolute path inside the environment.

                  `minLength: 0`

                - `size_bytes: number`

                  The decoded size of the inline file in bytes.

                  `format: int64`, `minimum: 0`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `network: Network | null`

              Network overrides, or null to inherit the template or creation default.

              - `access: "enabled" | "disabled" | "restricted"`

                The environment's network access mode.

                - `"enabled"`

                  Allows unrestricted network access.

                - `"disabled"`

                  Disables network access.

                - `"restricted"`

                  Applies the configured domain restrictions.

              - `allowed_domains: Array<string>`

                Domains the environment may access when network access is restricted.

                `minItems: 0`, `maxItems: 2000`

            - `packages: Packages | null`

              Package overrides, or null to inherit the template or creation default.

              - `npm: Array<string>`

                npm packages installed globally in the environment.

                `minItems: 0`, `maxItems: 16384`

              - `python: Array<string>`

                Python packages installed in the environment.

                `minItems: 0`, `maxItems: 16384`

              - `system: Array<string>`

                System packages installed in the environment.

                `minItems: 0`, `maxItems: 16384`

            - `plugins: Array<HostedPlugin> | null`

              Plugin overrides, excluding archive contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `description: string`

                The installed plugin description.

                `minLength: 0`

              - `name: string`

                The installed plugin name.

                `minLength: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

            - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

              Skill overrides, excluding archive contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `HostedTemplateSkillResourceSkillReference`

                A skill resolved afresh from the Skills API whenever a session starts.

                - `skill_id: string`

                  The referenced skill ID.

                  `minLength: 0`

                - `type: "skill_reference"`

                  The type of the object. Always `skill_reference`.

                  - `"skill_reference"`

                - `version: string | null`

                  The requested version selector, including `latest`.

                  `minLength: 0`

              - `HostedTemplateSkillResourceInline`

                Safe metadata for an inline skill archive.

                - `description: string`

                  The skill description declared in `SKILL.md`.

                  `minLength: 0`

                - `name: string`

                  The skill name declared in `SKILL.md`.

                  `minLength: 0`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `type: "openai_hosted"`

              The type of the object. Always `openai_hosted`.

              - `"openai_hosted"`

          - `AutomationEnvironmentResourceSelfHosted`

            - `capability_directories: Array<string>`

              Directories that expose capabilities to the agent.

              `minItems: 0`, `maxItems: 2000`

            - `environment_id: string | null`

              An existing registration, or null to create a session-owned environment.

              `minLength: 0`

            - `type: "self_hosted"`

              The type of the object. Always `self_hosted`.

              - `"self_hosted"`

            - `workspace_directory: string`

              The absolute project directory in the environment.

              `minLength: 0`

        - `input: Array<Input>`

          Initial input delivered to each new session.

          `minItems: 0`, `maxItems: 2000`

          - `content: Array<InputContent>`

            The content of the message.

            `minItems: 0`, `maxItems: 2000`

            - `InputContentResourceInputText`

              Text input recorded in a session item.

              - `text: string`

                The text supplied to the agent.

                `minLength: 0`

              - `type: "input_text"`

                The type of the object. Always `input_text`.

                - `"input_text"`

            - `InputContentResourceInputImage`

              Image input recorded in a session item.

              - `image_url: string`

                The URL of the image supplied to the agent, which may be a base64-encoded data URL.

                `minLength: 0`

              - `type: "input_image"`

                The type of the object. Always `input_image`.

                - `"input_image"`

          - `role: "user"`

            The role of the message author. Always `user`.

            - `"user"`

          - `type: "message"`

            The type of the input item. Always `message`.

            - `"message"`

        - `metadata: Record<string, string>`

          Metadata attached to each new session.

        - `type: "new_session"`

          The type of the object. Always `new_session`.

          - `"new_session"`

        - `vault_ids: Array<string>`

          Vaults made available to each new session.

          `minItems: 0`, `maxItems: 2000`

      - `AutomationTargetResourceExistingSession`

        - `instructions: string`

          Saved instructions delivered as an automation notification.

          `minLength: 0`

        - `session_id: string`

          The session receiving each invocation.

          `minLength: 0`

        - `type: "existing_session"`

          The type of the object. Always `existing_session`.

          - `"existing_session"`

    - `timezone: string`

      The timezone used to interpret the expression.

      `minLength: 0`

    - `type: "periodic"`

      The type of the object. Always `periodic`.

      - `"periodic"`

  - `OneTimeAutomation`

    Fields shared by periodic and one-time automations.

    - `id: string`

      The automation ID.

      `minLength: 0`

    - `created_at: number`

      The creation time as a Unix timestamp in seconds.

      `format: int64`

    - `created_by: AutomationCreatedBy`

      Service-recorded provenance; callers cannot supply this field.

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the automation.

    - `name: string`

      The automation's display name.

      `minLength: 0`

    - `object: "agent.automation"`

      Always `agent.automation`.

      - `"agent.automation"`

    - `run_at: number`

      The Unix timestamp, in seconds, of the scheduled occurrence.

      `format: int64`

    - `status: "active" | "paused" | "completed"`

      Completion means the schedule has finished, not the agent's work.

      - `"active"`

      - `"paused"`

      - `"completed"`

    - `target: AutomationTarget`

      The session configuration or existing session receiving invocations.

    - `type: "once"`

      The type of the object. Always `once`.

      - `"once"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const automation = await client.beta.agents.automations.create({
  expression: 'x',
  name: 'x',
  target: {
    environment: { type: 'none' },
    input: [{ content: [{ text: 'text', type: 'input_text' }], role: 'user' }],
    type: 'new_session',
  },
  timezone: 'x',
  type: 'periodic',
});

console.log(automation);
```

#### 201 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "created_by": {
    "type": "developer"
  },
  "expression": "expression",
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "agent.automation",
  "status": "active",
  "target": {
    "agent": {
      "instructions": "instructions",
      "model": "model",
      "multi_agent": {
        "enabled": true,
        "max_concurrent_subagents": 1
      },
      "reasoning": {
        "effort": "none",
        "summary": "concise"
      },
      "service_tier": "auto",
      "text": {
        "format": {
          "type": "text"
        },
        "verbosity": "low"
      },
      "tools": [
        {
          "defer_loading": true,
          "description": "description",
          "name": "name",
          "parameters": {
            "foo": "bar"
          },
          "type": "function",
          "async": true
        }
      ],
      "compaction": {
        "async": true
      },
      "experimental": {
        "time_awareness": true
      }
    },
    "agent_id": "agent_id",
    "environment": {
      "type": "none"
    },
    "input": [
      {
        "content": [
          {
            "text": "text",
            "type": "input_text"
          }
        ],
        "role": "user",
        "type": "message"
      }
    ],
    "metadata": {
      "foo": "string"
    },
    "type": "new_session",
    "vault_ids": [
      "string"
    ]
  },
  "timezone": "timezone",
  "type": "periodic"
}
```

## Delete an automation

`client.beta.agents.automations.delete(stringautomationID, RequestOptionsoptions?): AutomationDeleted`

**delete** `/agents/automations/{automation_id}`

Deletes the automation and prevents future invocations without deleting its target session.

### Parameters

- `automationID: string`

  `minLength: 0`, `maxLength: 1048576`

### Returns

- `AutomationDeleted`

  - `id: string`

    The deleted automation ID.

    `minLength: 0`

  - `deleted: boolean`

    Always true.

  - `object: "agent.automation.deleted"`

    Always `agent.automation.deleted`.

    - `"agent.automation.deleted"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const automationDeleted = await client.beta.agents.automations.delete('automation_id');

console.log(automationDeleted.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "deleted": true,
  "object": "agent.automation.deleted"
}
```

## List automations

`client.beta.agents.automations.list(AutomationListParamsquery?, RequestOptionsoptions?): CursorPage<Automation>`

**get** `/agents/automations`

Lists project-owned automations, optionally filtered by target session.

### Parameters

- `query: AutomationListParams`

  - `after?: string`

    Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

  - `session_id?: string`

    Matches existing-session targets, including agent-created automations.

    `minLength: 0`, `maxLength: 1048576`

### Returns

- `Automation = PeriodicAutomation | OneTimeAutomation`

  A saved automation and its schedule.

  - `PeriodicAutomation`

    Fields shared by periodic and one-time automations.

    - `id: string`

      The automation ID.

      `minLength: 0`

    - `created_at: number`

      The creation time as a Unix timestamp in seconds.

      `format: int64`

    - `created_by: AutomationCreatedBy`

      Service-recorded provenance; callers cannot supply this field.

      - `AutomationCreatedByResourceDeveloper`

        - `type: "developer"`

          The type of the object. Always `developer`.

          - `"developer"`

      - `AutomationCreatedByResourceAgent`

        - `session_id: string`

          The creator session, which is also the automation's target.

          `minLength: 0`

        - `tool_call_id: string`

          The tool call that created the automation.

          `minLength: 0`

        - `type: "agent"`

          The type of the object. Always `agent`.

          - `"agent"`

    - `expression: string`

      The cron expression determining scheduled occurrences.

      `minLength: 0`

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the automation.

    - `name: string`

      The automation's display name.

      `minLength: 0`

    - `object: "agent.automation"`

      Always `agent.automation`.

      - `"agent.automation"`

    - `status: "active" | "paused"`

      Whether scheduled delivery is active or paused.

      - `"active"`

      - `"paused"`

    - `target: AutomationTarget`

      The session configuration or existing session receiving invocations.

      - `AutomationTargetResourceNewSession`

        - `agent: AutomationAgentConfig | null`

          The inline agent configuration, or null when agent_id is configured.

          - `instructions: string | null`

            Custom instructions, or null when absent.

            `minLength: 0`

          - `model: string`

            The requested model name.

            `minLength: 0`

          - `multi_agent: MultiAgentConfig`

            The configuration for creating and coordinating subagents.

            - `enabled: boolean`

              Whether subagent tools are enabled. Defaults to false.

            - `max_concurrent_subagents: number | null`

              Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

              `format: int64`, `minimum: 1`, `maximum: 4294967295`

          - `reasoning: AgentReasoning`

            The configured reasoning policy.

            - `effort: "none" | "minimal" | "low" | 4 more | null`

              The requested reasoning effort, or `null` when the model selects its own default.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

            - `summary: "concise" | "detailed" | "auto" | null`

              The requested reasoning summary format, or `null` when summaries are disabled.

              - `"concise"`

                Returns a concise reasoning summary when supported.

              - `"detailed"`

                Returns a detailed reasoning summary when supported.

              - `"auto"`

                Automatically selects the most detailed summary supported by the model.

          - `service_tier: "auto" | "default" | "flex" | 3 more`

            The configured service-tier policy.

            - `"auto"`

            - `"default"`

            - `"flex"`

            - `"priority"`

            - `"fast"`

            - `"ultrafast"`

          - `text: AgentText`

            The configured output format and verbosity.

            - `format: TextFormat`

              The effective output format. Defaults to ordinary text.

              - `TextFormatResourceText`

                Generates ordinary text without a structured-output constraint.

                - `type: "text"`

                  The type of the object. Always `text`.

                  - `"text"`

              - `TextFormatResourceJSONSchema`

                Constrains generated text to a JSON Schema.

                - `schema: Record<string, unknown>`

                  The JSON Schema that generated text must match.

                - `type: "json_schema"`

                  The type of the object. Always `json_schema`.

                  - `"json_schema"`

            - `verbosity: "low" | "medium" | "high"`

              The amount of text produced by the agent. Defaults to `medium`.

              - `"low"`

              - `"medium"`

              - `"high"`

          - `tools: Array<AgentTool>`

            Configured tools, excluding confidential credentials.

            `minItems: 0`, `maxItems: 2000`

            - `AgentToolResourceFunction`

              A function defined by the application.

              - `defer_loading: boolean`

                Whether the function is deferred and discovered through tool search.

              - `description: string`

                A description of what the function does.

                `minLength: 0`

              - `name: string`

                The name of the function.

                `minLength: 0`

              - `parameters: Record<string, unknown>`

                A JSON Schema object describing the function's arguments.

              - `type: "function"`

                The type of the object. Always `function`.

                - `"function"`

              - `async?: boolean`

                Whether the agent continues without waiting for the function result.

            - `AgentToolResourceProgrammaticToolCalling`

              Enables calling tools from model-generated code.

              - `enabled: boolean`

                Whether tools can be called from model-generated code.

              - `type: "programmatic_tool_calling"`

                The type of the object. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `AgentToolResourceMcp`

              Tools provided by a remote MCP server.

              - `allowed_tools: Array<string> | null`

                The MCP tools the agent may call.

                `minItems: 0`, `maxItems: 2000`

              - `connection_origin: "service" | "environment"`

                Where outbound MCP HTTP connections originate.

                - `"service"`

                - `"environment"`

              - `credential_id: string | null`

                The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

                `minLength: 0`

              - `request_metadata: Record<string, unknown>`

                Metadata included with requests to this MCP server.

              - `required: boolean`

                Whether this MCP server must initialize before the first turn.

              - `server_label: string`

                A label used to identify the MCP server in tool calls.

                `minLength: 0`

              - `transport: McpTransport`

                The transport used to connect to the MCP server.

                - `McpTransportResourceHTTP`

                  Connects to an MCP server over HTTP.

                  - `server_url: string`

                    The URL of the MCP server.

                    `minLength: 0`

                  - `type: "http"`

                    The type of the object. Always `http`.

                    - `"http"`

                - `McpTransportResourceStdio`

                  Starts an MCP server as a local process.

                  - `args: Array<string>`

                    Arguments passed to the MCP server command.

                    `minItems: 0`, `maxItems: 2000`

                  - `command: string`

                    The command used to start the MCP server.

                    `minLength: 0`

                  - `cwd: string`

                    The working directory used to start the MCP server.

                    `minLength: 0`

                  - `env_vars: Array<string>`

                    Environment variable names inherited from the execution environment.

                    `minItems: 0`, `maxItems: 2000`

                  - `type: "stdio"`

                    The type of the object. Always `stdio`.

                    - `"stdio"`

              - `type: "mcp"`

                The type of the object. Always `mcp`.

                - `"mcp"`

            - `AgentToolResourceWebSearch`

              Web search.

              - `allowed_domains: Array<string> | null`

                Allowed search domains, or `null` when the search is unrestricted.

                `minItems: 0`, `maxItems: 2000`

              - `context_size: "low" | "medium" | "high"`

                The amount of search context made available to the model. Defaults to `medium`.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `location: Location | null`

                Approximate location used to localize search results, if provided.

                - `city: string | null`

                  The city name.

                  `minLength: 0`

                - `country: string | null`

                  The two-letter ISO country code, such as `US`.

                  `minLength: 0`

                - `region: string | null`

                  The region or state name.

                  `minLength: 0`

                - `timezone: string | null`

                  The IANA timezone, such as `America/Los_Angeles`.

                  `minLength: 0`

              - `mode: "disabled" | "cached" | "live"`

                The source used for web search results.

                - `"disabled"`

                - `"cached"`

                - `"live"`

              - `type: "web_search"`

                The type of the object. Always `web_search`.

                - `"web_search"`

            - `AgentToolResourceComputerUse`

              Browser use in an OpenAI-hosted session.

              - `include_screenshots: boolean`

                Whether computer tool outputs include screenshots.

              - `type: "computer_use"`

                The type of the object. Always `computer_use`.

                - `"computer_use"`

            - `AgentToolResourceAutomations`

              Lets the agent manage its own scheduled wakeups.

              - `type: "automations"`

                The type of the object. Always `automations`.

                - `"automations"`

          - `compaction?: Compaction`

            The effective context compaction settings.

            - `async: boolean`

              Whether context is compacted in the background. Defaults to true.

          - `experimental?: Experimental`

            The effective experimental settings for the agent.

            - `time_awareness: boolean`

              Whether the model receives periodic current-time reminders.

        - `agent_id: string | null`

          The saved agent reference, or null when an inline agent is configured.

          `minLength: 0`

        - `environment: AutomationEnvironment`

          Configuration or references used to select the execution environment.

          - `AutomationEnvironmentResourceNone`

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `AutomationEnvironmentResourceOpenAIHosted`

            Hosted environment selection with confidential setup commands and variables omitted.

            - `capability_directories: Array<string> | null`

              Directory overrides, or null to inherit the template or creation default.

              `minItems: 0`, `maxItems: 2000`

            - `container_size: "small" | "medium" | "large" | null`

              The configured container size, or null to use the creation default.

              - `"small"`

              - `"medium"`

              - `"large"`

            - `desktop: Desktop | null`

              Desktop overrides, or null to inherit the template or creation default.

              - `enabled: boolean`

                Whether the environment provisions a desktop and browser proxy.

            - `environment_id: string | null`

              An existing environment reference, or null when provisioning a new environment.

              `minLength: 0`

            - `environment_template_id: string | null`

              A template reference, or null when no template is selected.

              `minLength: 0`

            - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

              File overrides, excluding contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `HostedTemplateFileResourceFileID`

                A project-scoped Files API reference resolved separately for each session.

                - `file_id: string`

                  The ID of the uploaded file.

                  `minLength: 0`

                - `path: string`

                  The file's absolute path inside the environment.

                  `minLength: 0`

                - `type: "file_id"`

                  The type of the object. Always `file_id`.

                  - `"file_id"`

              - `HostedTemplateFileResourceInline`

                Metadata for confidential inline file contents.

                - `path: string`

                  The file's absolute path inside the environment.

                  `minLength: 0`

                - `size_bytes: number`

                  The decoded size of the inline file in bytes.

                  `format: int64`, `minimum: 0`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `network: Network | null`

              Network overrides, or null to inherit the template or creation default.

              - `access: "enabled" | "disabled" | "restricted"`

                The environment's network access mode.

                - `"enabled"`

                  Allows unrestricted network access.

                - `"disabled"`

                  Disables network access.

                - `"restricted"`

                  Applies the configured domain restrictions.

              - `allowed_domains: Array<string>`

                Domains the environment may access when network access is restricted.

                `minItems: 0`, `maxItems: 2000`

            - `packages: Packages | null`

              Package overrides, or null to inherit the template or creation default.

              - `npm: Array<string>`

                npm packages installed globally in the environment.

                `minItems: 0`, `maxItems: 16384`

              - `python: Array<string>`

                Python packages installed in the environment.

                `minItems: 0`, `maxItems: 16384`

              - `system: Array<string>`

                System packages installed in the environment.

                `minItems: 0`, `maxItems: 16384`

            - `plugins: Array<HostedPlugin> | null`

              Plugin overrides, excluding archive contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `description: string`

                The installed plugin description.

                `minLength: 0`

              - `name: string`

                The installed plugin name.

                `minLength: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

            - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

              Skill overrides, excluding archive contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `HostedTemplateSkillResourceSkillReference`

                A skill resolved afresh from the Skills API whenever a session starts.

                - `skill_id: string`

                  The referenced skill ID.

                  `minLength: 0`

                - `type: "skill_reference"`

                  The type of the object. Always `skill_reference`.

                  - `"skill_reference"`

                - `version: string | null`

                  The requested version selector, including `latest`.

                  `minLength: 0`

              - `HostedTemplateSkillResourceInline`

                Safe metadata for an inline skill archive.

                - `description: string`

                  The skill description declared in `SKILL.md`.

                  `minLength: 0`

                - `name: string`

                  The skill name declared in `SKILL.md`.

                  `minLength: 0`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `type: "openai_hosted"`

              The type of the object. Always `openai_hosted`.

              - `"openai_hosted"`

          - `AutomationEnvironmentResourceSelfHosted`

            - `capability_directories: Array<string>`

              Directories that expose capabilities to the agent.

              `minItems: 0`, `maxItems: 2000`

            - `environment_id: string | null`

              An existing registration, or null to create a session-owned environment.

              `minLength: 0`

            - `type: "self_hosted"`

              The type of the object. Always `self_hosted`.

              - `"self_hosted"`

            - `workspace_directory: string`

              The absolute project directory in the environment.

              `minLength: 0`

        - `input: Array<Input>`

          Initial input delivered to each new session.

          `minItems: 0`, `maxItems: 2000`

          - `content: Array<InputContent>`

            The content of the message.

            `minItems: 0`, `maxItems: 2000`

            - `InputContentResourceInputText`

              Text input recorded in a session item.

              - `text: string`

                The text supplied to the agent.

                `minLength: 0`

              - `type: "input_text"`

                The type of the object. Always `input_text`.

                - `"input_text"`

            - `InputContentResourceInputImage`

              Image input recorded in a session item.

              - `image_url: string`

                The URL of the image supplied to the agent, which may be a base64-encoded data URL.

                `minLength: 0`

              - `type: "input_image"`

                The type of the object. Always `input_image`.

                - `"input_image"`

          - `role: "user"`

            The role of the message author. Always `user`.

            - `"user"`

          - `type: "message"`

            The type of the input item. Always `message`.

            - `"message"`

        - `metadata: Record<string, string>`

          Metadata attached to each new session.

        - `type: "new_session"`

          The type of the object. Always `new_session`.

          - `"new_session"`

        - `vault_ids: Array<string>`

          Vaults made available to each new session.

          `minItems: 0`, `maxItems: 2000`

      - `AutomationTargetResourceExistingSession`

        - `instructions: string`

          Saved instructions delivered as an automation notification.

          `minLength: 0`

        - `session_id: string`

          The session receiving each invocation.

          `minLength: 0`

        - `type: "existing_session"`

          The type of the object. Always `existing_session`.

          - `"existing_session"`

    - `timezone: string`

      The timezone used to interpret the expression.

      `minLength: 0`

    - `type: "periodic"`

      The type of the object. Always `periodic`.

      - `"periodic"`

  - `OneTimeAutomation`

    Fields shared by periodic and one-time automations.

    - `id: string`

      The automation ID.

      `minLength: 0`

    - `created_at: number`

      The creation time as a Unix timestamp in seconds.

      `format: int64`

    - `created_by: AutomationCreatedBy`

      Service-recorded provenance; callers cannot supply this field.

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the automation.

    - `name: string`

      The automation's display name.

      `minLength: 0`

    - `object: "agent.automation"`

      Always `agent.automation`.

      - `"agent.automation"`

    - `run_at: number`

      The Unix timestamp, in seconds, of the scheduled occurrence.

      `format: int64`

    - `status: "active" | "paused" | "completed"`

      Completion means the schedule has finished, not the agent's work.

      - `"active"`

      - `"paused"`

      - `"completed"`

    - `target: AutomationTarget`

      The session configuration or existing session receiving invocations.

    - `type: "once"`

      The type of the object. Always `once`.

      - `"once"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const automation of client.beta.agents.automations.list()) {
  console.log(automation);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "created_by": {
        "type": "developer"
      },
      "expression": "expression",
      "metadata": {
        "foo": "string"
      },
      "name": "name",
      "object": "agent.automation",
      "status": "active",
      "target": {
        "agent": {
          "instructions": "instructions",
          "model": "model",
          "multi_agent": {
            "enabled": true,
            "max_concurrent_subagents": 1
          },
          "reasoning": {
            "effort": "none",
            "summary": "concise"
          },
          "service_tier": "auto",
          "text": {
            "format": {
              "type": "text"
            },
            "verbosity": "low"
          },
          "tools": [
            {
              "defer_loading": true,
              "description": "description",
              "name": "name",
              "parameters": {
                "foo": "bar"
              },
              "type": "function",
              "async": true
            }
          ],
          "compaction": {
            "async": true
          },
          "experimental": {
            "time_awareness": true
          }
        },
        "agent_id": "agent_id",
        "environment": {
          "type": "none"
        },
        "input": [
          {
            "content": [
              {
                "text": "text",
                "type": "input_text"
              }
            ],
            "role": "user",
            "type": "message"
          }
        ],
        "metadata": {
          "foo": "string"
        },
        "type": "new_session",
        "vault_ids": [
          "string"
        ]
      },
      "timezone": "timezone",
      "type": "periodic"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Pause an automation

`client.beta.agents.automations.pause(stringautomationID, RequestOptionsoptions?): Automation`

**post** `/agents/automations/{automation_id}/pause`

Pauses future scheduled delivery without stopping an active session.

### Parameters

- `automationID: string`

  `minLength: 0`, `maxLength: 1048576`

### Returns

- `Automation = PeriodicAutomation | OneTimeAutomation`

  A saved automation and its schedule.

  - `PeriodicAutomation`

    Fields shared by periodic and one-time automations.

    - `id: string`

      The automation ID.

      `minLength: 0`

    - `created_at: number`

      The creation time as a Unix timestamp in seconds.

      `format: int64`

    - `created_by: AutomationCreatedBy`

      Service-recorded provenance; callers cannot supply this field.

      - `AutomationCreatedByResourceDeveloper`

        - `type: "developer"`

          The type of the object. Always `developer`.

          - `"developer"`

      - `AutomationCreatedByResourceAgent`

        - `session_id: string`

          The creator session, which is also the automation's target.

          `minLength: 0`

        - `tool_call_id: string`

          The tool call that created the automation.

          `minLength: 0`

        - `type: "agent"`

          The type of the object. Always `agent`.

          - `"agent"`

    - `expression: string`

      The cron expression determining scheduled occurrences.

      `minLength: 0`

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the automation.

    - `name: string`

      The automation's display name.

      `minLength: 0`

    - `object: "agent.automation"`

      Always `agent.automation`.

      - `"agent.automation"`

    - `status: "active" | "paused"`

      Whether scheduled delivery is active or paused.

      - `"active"`

      - `"paused"`

    - `target: AutomationTarget`

      The session configuration or existing session receiving invocations.

      - `AutomationTargetResourceNewSession`

        - `agent: AutomationAgentConfig | null`

          The inline agent configuration, or null when agent_id is configured.

          - `instructions: string | null`

            Custom instructions, or null when absent.

            `minLength: 0`

          - `model: string`

            The requested model name.

            `minLength: 0`

          - `multi_agent: MultiAgentConfig`

            The configuration for creating and coordinating subagents.

            - `enabled: boolean`

              Whether subagent tools are enabled. Defaults to false.

            - `max_concurrent_subagents: number | null`

              Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

              `format: int64`, `minimum: 1`, `maximum: 4294967295`

          - `reasoning: AgentReasoning`

            The configured reasoning policy.

            - `effort: "none" | "minimal" | "low" | 4 more | null`

              The requested reasoning effort, or `null` when the model selects its own default.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

            - `summary: "concise" | "detailed" | "auto" | null`

              The requested reasoning summary format, or `null` when summaries are disabled.

              - `"concise"`

                Returns a concise reasoning summary when supported.

              - `"detailed"`

                Returns a detailed reasoning summary when supported.

              - `"auto"`

                Automatically selects the most detailed summary supported by the model.

          - `service_tier: "auto" | "default" | "flex" | 3 more`

            The configured service-tier policy.

            - `"auto"`

            - `"default"`

            - `"flex"`

            - `"priority"`

            - `"fast"`

            - `"ultrafast"`

          - `text: AgentText`

            The configured output format and verbosity.

            - `format: TextFormat`

              The effective output format. Defaults to ordinary text.

              - `TextFormatResourceText`

                Generates ordinary text without a structured-output constraint.

                - `type: "text"`

                  The type of the object. Always `text`.

                  - `"text"`

              - `TextFormatResourceJSONSchema`

                Constrains generated text to a JSON Schema.

                - `schema: Record<string, unknown>`

                  The JSON Schema that generated text must match.

                - `type: "json_schema"`

                  The type of the object. Always `json_schema`.

                  - `"json_schema"`

            - `verbosity: "low" | "medium" | "high"`

              The amount of text produced by the agent. Defaults to `medium`.

              - `"low"`

              - `"medium"`

              - `"high"`

          - `tools: Array<AgentTool>`

            Configured tools, excluding confidential credentials.

            `minItems: 0`, `maxItems: 2000`

            - `AgentToolResourceFunction`

              A function defined by the application.

              - `defer_loading: boolean`

                Whether the function is deferred and discovered through tool search.

              - `description: string`

                A description of what the function does.

                `minLength: 0`

              - `name: string`

                The name of the function.

                `minLength: 0`

              - `parameters: Record<string, unknown>`

                A JSON Schema object describing the function's arguments.

              - `type: "function"`

                The type of the object. Always `function`.

                - `"function"`

              - `async?: boolean`

                Whether the agent continues without waiting for the function result.

            - `AgentToolResourceProgrammaticToolCalling`

              Enables calling tools from model-generated code.

              - `enabled: boolean`

                Whether tools can be called from model-generated code.

              - `type: "programmatic_tool_calling"`

                The type of the object. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `AgentToolResourceMcp`

              Tools provided by a remote MCP server.

              - `allowed_tools: Array<string> | null`

                The MCP tools the agent may call.

                `minItems: 0`, `maxItems: 2000`

              - `connection_origin: "service" | "environment"`

                Where outbound MCP HTTP connections originate.

                - `"service"`

                - `"environment"`

              - `credential_id: string | null`

                The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

                `minLength: 0`

              - `request_metadata: Record<string, unknown>`

                Metadata included with requests to this MCP server.

              - `required: boolean`

                Whether this MCP server must initialize before the first turn.

              - `server_label: string`

                A label used to identify the MCP server in tool calls.

                `minLength: 0`

              - `transport: McpTransport`

                The transport used to connect to the MCP server.

                - `McpTransportResourceHTTP`

                  Connects to an MCP server over HTTP.

                  - `server_url: string`

                    The URL of the MCP server.

                    `minLength: 0`

                  - `type: "http"`

                    The type of the object. Always `http`.

                    - `"http"`

                - `McpTransportResourceStdio`

                  Starts an MCP server as a local process.

                  - `args: Array<string>`

                    Arguments passed to the MCP server command.

                    `minItems: 0`, `maxItems: 2000`

                  - `command: string`

                    The command used to start the MCP server.

                    `minLength: 0`

                  - `cwd: string`

                    The working directory used to start the MCP server.

                    `minLength: 0`

                  - `env_vars: Array<string>`

                    Environment variable names inherited from the execution environment.

                    `minItems: 0`, `maxItems: 2000`

                  - `type: "stdio"`

                    The type of the object. Always `stdio`.

                    - `"stdio"`

              - `type: "mcp"`

                The type of the object. Always `mcp`.

                - `"mcp"`

            - `AgentToolResourceWebSearch`

              Web search.

              - `allowed_domains: Array<string> | null`

                Allowed search domains, or `null` when the search is unrestricted.

                `minItems: 0`, `maxItems: 2000`

              - `context_size: "low" | "medium" | "high"`

                The amount of search context made available to the model. Defaults to `medium`.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `location: Location | null`

                Approximate location used to localize search results, if provided.

                - `city: string | null`

                  The city name.

                  `minLength: 0`

                - `country: string | null`

                  The two-letter ISO country code, such as `US`.

                  `minLength: 0`

                - `region: string | null`

                  The region or state name.

                  `minLength: 0`

                - `timezone: string | null`

                  The IANA timezone, such as `America/Los_Angeles`.

                  `minLength: 0`

              - `mode: "disabled" | "cached" | "live"`

                The source used for web search results.

                - `"disabled"`

                - `"cached"`

                - `"live"`

              - `type: "web_search"`

                The type of the object. Always `web_search`.

                - `"web_search"`

            - `AgentToolResourceComputerUse`

              Browser use in an OpenAI-hosted session.

              - `include_screenshots: boolean`

                Whether computer tool outputs include screenshots.

              - `type: "computer_use"`

                The type of the object. Always `computer_use`.

                - `"computer_use"`

            - `AgentToolResourceAutomations`

              Lets the agent manage its own scheduled wakeups.

              - `type: "automations"`

                The type of the object. Always `automations`.

                - `"automations"`

          - `compaction?: Compaction`

            The effective context compaction settings.

            - `async: boolean`

              Whether context is compacted in the background. Defaults to true.

          - `experimental?: Experimental`

            The effective experimental settings for the agent.

            - `time_awareness: boolean`

              Whether the model receives periodic current-time reminders.

        - `agent_id: string | null`

          The saved agent reference, or null when an inline agent is configured.

          `minLength: 0`

        - `environment: AutomationEnvironment`

          Configuration or references used to select the execution environment.

          - `AutomationEnvironmentResourceNone`

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `AutomationEnvironmentResourceOpenAIHosted`

            Hosted environment selection with confidential setup commands and variables omitted.

            - `capability_directories: Array<string> | null`

              Directory overrides, or null to inherit the template or creation default.

              `minItems: 0`, `maxItems: 2000`

            - `container_size: "small" | "medium" | "large" | null`

              The configured container size, or null to use the creation default.

              - `"small"`

              - `"medium"`

              - `"large"`

            - `desktop: Desktop | null`

              Desktop overrides, or null to inherit the template or creation default.

              - `enabled: boolean`

                Whether the environment provisions a desktop and browser proxy.

            - `environment_id: string | null`

              An existing environment reference, or null when provisioning a new environment.

              `minLength: 0`

            - `environment_template_id: string | null`

              A template reference, or null when no template is selected.

              `minLength: 0`

            - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

              File overrides, excluding contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `HostedTemplateFileResourceFileID`

                A project-scoped Files API reference resolved separately for each session.

                - `file_id: string`

                  The ID of the uploaded file.

                  `minLength: 0`

                - `path: string`

                  The file's absolute path inside the environment.

                  `minLength: 0`

                - `type: "file_id"`

                  The type of the object. Always `file_id`.

                  - `"file_id"`

              - `HostedTemplateFileResourceInline`

                Metadata for confidential inline file contents.

                - `path: string`

                  The file's absolute path inside the environment.

                  `minLength: 0`

                - `size_bytes: number`

                  The decoded size of the inline file in bytes.

                  `format: int64`, `minimum: 0`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `network: Network | null`

              Network overrides, or null to inherit the template or creation default.

              - `access: "enabled" | "disabled" | "restricted"`

                The environment's network access mode.

                - `"enabled"`

                  Allows unrestricted network access.

                - `"disabled"`

                  Disables network access.

                - `"restricted"`

                  Applies the configured domain restrictions.

              - `allowed_domains: Array<string>`

                Domains the environment may access when network access is restricted.

                `minItems: 0`, `maxItems: 2000`

            - `packages: Packages | null`

              Package overrides, or null to inherit the template or creation default.

              - `npm: Array<string>`

                npm packages installed globally in the environment.

                `minItems: 0`, `maxItems: 16384`

              - `python: Array<string>`

                Python packages installed in the environment.

                `minItems: 0`, `maxItems: 16384`

              - `system: Array<string>`

                System packages installed in the environment.

                `minItems: 0`, `maxItems: 16384`

            - `plugins: Array<HostedPlugin> | null`

              Plugin overrides, excluding archive contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `description: string`

                The installed plugin description.

                `minLength: 0`

              - `name: string`

                The installed plugin name.

                `minLength: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

            - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

              Skill overrides, excluding archive contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `HostedTemplateSkillResourceSkillReference`

                A skill resolved afresh from the Skills API whenever a session starts.

                - `skill_id: string`

                  The referenced skill ID.

                  `minLength: 0`

                - `type: "skill_reference"`

                  The type of the object. Always `skill_reference`.

                  - `"skill_reference"`

                - `version: string | null`

                  The requested version selector, including `latest`.

                  `minLength: 0`

              - `HostedTemplateSkillResourceInline`

                Safe metadata for an inline skill archive.

                - `description: string`

                  The skill description declared in `SKILL.md`.

                  `minLength: 0`

                - `name: string`

                  The skill name declared in `SKILL.md`.

                  `minLength: 0`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `type: "openai_hosted"`

              The type of the object. Always `openai_hosted`.

              - `"openai_hosted"`

          - `AutomationEnvironmentResourceSelfHosted`

            - `capability_directories: Array<string>`

              Directories that expose capabilities to the agent.

              `minItems: 0`, `maxItems: 2000`

            - `environment_id: string | null`

              An existing registration, or null to create a session-owned environment.

              `minLength: 0`

            - `type: "self_hosted"`

              The type of the object. Always `self_hosted`.

              - `"self_hosted"`

            - `workspace_directory: string`

              The absolute project directory in the environment.

              `minLength: 0`

        - `input: Array<Input>`

          Initial input delivered to each new session.

          `minItems: 0`, `maxItems: 2000`

          - `content: Array<InputContent>`

            The content of the message.

            `minItems: 0`, `maxItems: 2000`

            - `InputContentResourceInputText`

              Text input recorded in a session item.

              - `text: string`

                The text supplied to the agent.

                `minLength: 0`

              - `type: "input_text"`

                The type of the object. Always `input_text`.

                - `"input_text"`

            - `InputContentResourceInputImage`

              Image input recorded in a session item.

              - `image_url: string`

                The URL of the image supplied to the agent, which may be a base64-encoded data URL.

                `minLength: 0`

              - `type: "input_image"`

                The type of the object. Always `input_image`.

                - `"input_image"`

          - `role: "user"`

            The role of the message author. Always `user`.

            - `"user"`

          - `type: "message"`

            The type of the input item. Always `message`.

            - `"message"`

        - `metadata: Record<string, string>`

          Metadata attached to each new session.

        - `type: "new_session"`

          The type of the object. Always `new_session`.

          - `"new_session"`

        - `vault_ids: Array<string>`

          Vaults made available to each new session.

          `minItems: 0`, `maxItems: 2000`

      - `AutomationTargetResourceExistingSession`

        - `instructions: string`

          Saved instructions delivered as an automation notification.

          `minLength: 0`

        - `session_id: string`

          The session receiving each invocation.

          `minLength: 0`

        - `type: "existing_session"`

          The type of the object. Always `existing_session`.

          - `"existing_session"`

    - `timezone: string`

      The timezone used to interpret the expression.

      `minLength: 0`

    - `type: "periodic"`

      The type of the object. Always `periodic`.

      - `"periodic"`

  - `OneTimeAutomation`

    Fields shared by periodic and one-time automations.

    - `id: string`

      The automation ID.

      `minLength: 0`

    - `created_at: number`

      The creation time as a Unix timestamp in seconds.

      `format: int64`

    - `created_by: AutomationCreatedBy`

      Service-recorded provenance; callers cannot supply this field.

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the automation.

    - `name: string`

      The automation's display name.

      `minLength: 0`

    - `object: "agent.automation"`

      Always `agent.automation`.

      - `"agent.automation"`

    - `run_at: number`

      The Unix timestamp, in seconds, of the scheduled occurrence.

      `format: int64`

    - `status: "active" | "paused" | "completed"`

      Completion means the schedule has finished, not the agent's work.

      - `"active"`

      - `"paused"`

      - `"completed"`

    - `target: AutomationTarget`

      The session configuration or existing session receiving invocations.

    - `type: "once"`

      The type of the object. Always `once`.

      - `"once"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const automation = await client.beta.agents.automations.pause('automation_id');

console.log(automation);
```

#### 200 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "created_by": {
    "type": "developer"
  },
  "expression": "expression",
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "agent.automation",
  "status": "active",
  "target": {
    "agent": {
      "instructions": "instructions",
      "model": "model",
      "multi_agent": {
        "enabled": true,
        "max_concurrent_subagents": 1
      },
      "reasoning": {
        "effort": "none",
        "summary": "concise"
      },
      "service_tier": "auto",
      "text": {
        "format": {
          "type": "text"
        },
        "verbosity": "low"
      },
      "tools": [
        {
          "defer_loading": true,
          "description": "description",
          "name": "name",
          "parameters": {
            "foo": "bar"
          },
          "type": "function",
          "async": true
        }
      ],
      "compaction": {
        "async": true
      },
      "experimental": {
        "time_awareness": true
      }
    },
    "agent_id": "agent_id",
    "environment": {
      "type": "none"
    },
    "input": [
      {
        "content": [
          {
            "text": "text",
            "type": "input_text"
          }
        ],
        "role": "user",
        "type": "message"
      }
    ],
    "metadata": {
      "foo": "string"
    },
    "type": "new_session",
    "vault_ids": [
      "string"
    ]
  },
  "timezone": "timezone",
  "type": "periodic"
}
```

## Resume an automation

`client.beta.agents.automations.resume(stringautomationID, RequestOptionsoptions?): Automation`

**post** `/agents/automations/{automation_id}/resume`

Resumes scheduled delivery; one-time automations without a pending invocation require a future run_at.

### Parameters

- `automationID: string`

  `minLength: 0`, `maxLength: 1048576`

### Returns

- `Automation = PeriodicAutomation | OneTimeAutomation`

  A saved automation and its schedule.

  - `PeriodicAutomation`

    Fields shared by periodic and one-time automations.

    - `id: string`

      The automation ID.

      `minLength: 0`

    - `created_at: number`

      The creation time as a Unix timestamp in seconds.

      `format: int64`

    - `created_by: AutomationCreatedBy`

      Service-recorded provenance; callers cannot supply this field.

      - `AutomationCreatedByResourceDeveloper`

        - `type: "developer"`

          The type of the object. Always `developer`.

          - `"developer"`

      - `AutomationCreatedByResourceAgent`

        - `session_id: string`

          The creator session, which is also the automation's target.

          `minLength: 0`

        - `tool_call_id: string`

          The tool call that created the automation.

          `minLength: 0`

        - `type: "agent"`

          The type of the object. Always `agent`.

          - `"agent"`

    - `expression: string`

      The cron expression determining scheduled occurrences.

      `minLength: 0`

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the automation.

    - `name: string`

      The automation's display name.

      `minLength: 0`

    - `object: "agent.automation"`

      Always `agent.automation`.

      - `"agent.automation"`

    - `status: "active" | "paused"`

      Whether scheduled delivery is active or paused.

      - `"active"`

      - `"paused"`

    - `target: AutomationTarget`

      The session configuration or existing session receiving invocations.

      - `AutomationTargetResourceNewSession`

        - `agent: AutomationAgentConfig | null`

          The inline agent configuration, or null when agent_id is configured.

          - `instructions: string | null`

            Custom instructions, or null when absent.

            `minLength: 0`

          - `model: string`

            The requested model name.

            `minLength: 0`

          - `multi_agent: MultiAgentConfig`

            The configuration for creating and coordinating subagents.

            - `enabled: boolean`

              Whether subagent tools are enabled. Defaults to false.

            - `max_concurrent_subagents: number | null`

              Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

              `format: int64`, `minimum: 1`, `maximum: 4294967295`

          - `reasoning: AgentReasoning`

            The configured reasoning policy.

            - `effort: "none" | "minimal" | "low" | 4 more | null`

              The requested reasoning effort, or `null` when the model selects its own default.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

            - `summary: "concise" | "detailed" | "auto" | null`

              The requested reasoning summary format, or `null` when summaries are disabled.

              - `"concise"`

                Returns a concise reasoning summary when supported.

              - `"detailed"`

                Returns a detailed reasoning summary when supported.

              - `"auto"`

                Automatically selects the most detailed summary supported by the model.

          - `service_tier: "auto" | "default" | "flex" | 3 more`

            The configured service-tier policy.

            - `"auto"`

            - `"default"`

            - `"flex"`

            - `"priority"`

            - `"fast"`

            - `"ultrafast"`

          - `text: AgentText`

            The configured output format and verbosity.

            - `format: TextFormat`

              The effective output format. Defaults to ordinary text.

              - `TextFormatResourceText`

                Generates ordinary text without a structured-output constraint.

                - `type: "text"`

                  The type of the object. Always `text`.

                  - `"text"`

              - `TextFormatResourceJSONSchema`

                Constrains generated text to a JSON Schema.

                - `schema: Record<string, unknown>`

                  The JSON Schema that generated text must match.

                - `type: "json_schema"`

                  The type of the object. Always `json_schema`.

                  - `"json_schema"`

            - `verbosity: "low" | "medium" | "high"`

              The amount of text produced by the agent. Defaults to `medium`.

              - `"low"`

              - `"medium"`

              - `"high"`

          - `tools: Array<AgentTool>`

            Configured tools, excluding confidential credentials.

            `minItems: 0`, `maxItems: 2000`

            - `AgentToolResourceFunction`

              A function defined by the application.

              - `defer_loading: boolean`

                Whether the function is deferred and discovered through tool search.

              - `description: string`

                A description of what the function does.

                `minLength: 0`

              - `name: string`

                The name of the function.

                `minLength: 0`

              - `parameters: Record<string, unknown>`

                A JSON Schema object describing the function's arguments.

              - `type: "function"`

                The type of the object. Always `function`.

                - `"function"`

              - `async?: boolean`

                Whether the agent continues without waiting for the function result.

            - `AgentToolResourceProgrammaticToolCalling`

              Enables calling tools from model-generated code.

              - `enabled: boolean`

                Whether tools can be called from model-generated code.

              - `type: "programmatic_tool_calling"`

                The type of the object. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `AgentToolResourceMcp`

              Tools provided by a remote MCP server.

              - `allowed_tools: Array<string> | null`

                The MCP tools the agent may call.

                `minItems: 0`, `maxItems: 2000`

              - `connection_origin: "service" | "environment"`

                Where outbound MCP HTTP connections originate.

                - `"service"`

                - `"environment"`

              - `credential_id: string | null`

                The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

                `minLength: 0`

              - `request_metadata: Record<string, unknown>`

                Metadata included with requests to this MCP server.

              - `required: boolean`

                Whether this MCP server must initialize before the first turn.

              - `server_label: string`

                A label used to identify the MCP server in tool calls.

                `minLength: 0`

              - `transport: McpTransport`

                The transport used to connect to the MCP server.

                - `McpTransportResourceHTTP`

                  Connects to an MCP server over HTTP.

                  - `server_url: string`

                    The URL of the MCP server.

                    `minLength: 0`

                  - `type: "http"`

                    The type of the object. Always `http`.

                    - `"http"`

                - `McpTransportResourceStdio`

                  Starts an MCP server as a local process.

                  - `args: Array<string>`

                    Arguments passed to the MCP server command.

                    `minItems: 0`, `maxItems: 2000`

                  - `command: string`

                    The command used to start the MCP server.

                    `minLength: 0`

                  - `cwd: string`

                    The working directory used to start the MCP server.

                    `minLength: 0`

                  - `env_vars: Array<string>`

                    Environment variable names inherited from the execution environment.

                    `minItems: 0`, `maxItems: 2000`

                  - `type: "stdio"`

                    The type of the object. Always `stdio`.

                    - `"stdio"`

              - `type: "mcp"`

                The type of the object. Always `mcp`.

                - `"mcp"`

            - `AgentToolResourceWebSearch`

              Web search.

              - `allowed_domains: Array<string> | null`

                Allowed search domains, or `null` when the search is unrestricted.

                `minItems: 0`, `maxItems: 2000`

              - `context_size: "low" | "medium" | "high"`

                The amount of search context made available to the model. Defaults to `medium`.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `location: Location | null`

                Approximate location used to localize search results, if provided.

                - `city: string | null`

                  The city name.

                  `minLength: 0`

                - `country: string | null`

                  The two-letter ISO country code, such as `US`.

                  `minLength: 0`

                - `region: string | null`

                  The region or state name.

                  `minLength: 0`

                - `timezone: string | null`

                  The IANA timezone, such as `America/Los_Angeles`.

                  `minLength: 0`

              - `mode: "disabled" | "cached" | "live"`

                The source used for web search results.

                - `"disabled"`

                - `"cached"`

                - `"live"`

              - `type: "web_search"`

                The type of the object. Always `web_search`.

                - `"web_search"`

            - `AgentToolResourceComputerUse`

              Browser use in an OpenAI-hosted session.

              - `include_screenshots: boolean`

                Whether computer tool outputs include screenshots.

              - `type: "computer_use"`

                The type of the object. Always `computer_use`.

                - `"computer_use"`

            - `AgentToolResourceAutomations`

              Lets the agent manage its own scheduled wakeups.

              - `type: "automations"`

                The type of the object. Always `automations`.

                - `"automations"`

          - `compaction?: Compaction`

            The effective context compaction settings.

            - `async: boolean`

              Whether context is compacted in the background. Defaults to true.

          - `experimental?: Experimental`

            The effective experimental settings for the agent.

            - `time_awareness: boolean`

              Whether the model receives periodic current-time reminders.

        - `agent_id: string | null`

          The saved agent reference, or null when an inline agent is configured.

          `minLength: 0`

        - `environment: AutomationEnvironment`

          Configuration or references used to select the execution environment.

          - `AutomationEnvironmentResourceNone`

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `AutomationEnvironmentResourceOpenAIHosted`

            Hosted environment selection with confidential setup commands and variables omitted.

            - `capability_directories: Array<string> | null`

              Directory overrides, or null to inherit the template or creation default.

              `minItems: 0`, `maxItems: 2000`

            - `container_size: "small" | "medium" | "large" | null`

              The configured container size, or null to use the creation default.

              - `"small"`

              - `"medium"`

              - `"large"`

            - `desktop: Desktop | null`

              Desktop overrides, or null to inherit the template or creation default.

              - `enabled: boolean`

                Whether the environment provisions a desktop and browser proxy.

            - `environment_id: string | null`

              An existing environment reference, or null when provisioning a new environment.

              `minLength: 0`

            - `environment_template_id: string | null`

              A template reference, or null when no template is selected.

              `minLength: 0`

            - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

              File overrides, excluding contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `HostedTemplateFileResourceFileID`

                A project-scoped Files API reference resolved separately for each session.

                - `file_id: string`

                  The ID of the uploaded file.

                  `minLength: 0`

                - `path: string`

                  The file's absolute path inside the environment.

                  `minLength: 0`

                - `type: "file_id"`

                  The type of the object. Always `file_id`.

                  - `"file_id"`

              - `HostedTemplateFileResourceInline`

                Metadata for confidential inline file contents.

                - `path: string`

                  The file's absolute path inside the environment.

                  `minLength: 0`

                - `size_bytes: number`

                  The decoded size of the inline file in bytes.

                  `format: int64`, `minimum: 0`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `network: Network | null`

              Network overrides, or null to inherit the template or creation default.

              - `access: "enabled" | "disabled" | "restricted"`

                The environment's network access mode.

                - `"enabled"`

                  Allows unrestricted network access.

                - `"disabled"`

                  Disables network access.

                - `"restricted"`

                  Applies the configured domain restrictions.

              - `allowed_domains: Array<string>`

                Domains the environment may access when network access is restricted.

                `minItems: 0`, `maxItems: 2000`

            - `packages: Packages | null`

              Package overrides, or null to inherit the template or creation default.

              - `npm: Array<string>`

                npm packages installed globally in the environment.

                `minItems: 0`, `maxItems: 16384`

              - `python: Array<string>`

                Python packages installed in the environment.

                `minItems: 0`, `maxItems: 16384`

              - `system: Array<string>`

                System packages installed in the environment.

                `minItems: 0`, `maxItems: 16384`

            - `plugins: Array<HostedPlugin> | null`

              Plugin overrides, excluding archive contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `description: string`

                The installed plugin description.

                `minLength: 0`

              - `name: string`

                The installed plugin name.

                `minLength: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

            - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

              Skill overrides, excluding archive contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `HostedTemplateSkillResourceSkillReference`

                A skill resolved afresh from the Skills API whenever a session starts.

                - `skill_id: string`

                  The referenced skill ID.

                  `minLength: 0`

                - `type: "skill_reference"`

                  The type of the object. Always `skill_reference`.

                  - `"skill_reference"`

                - `version: string | null`

                  The requested version selector, including `latest`.

                  `minLength: 0`

              - `HostedTemplateSkillResourceInline`

                Safe metadata for an inline skill archive.

                - `description: string`

                  The skill description declared in `SKILL.md`.

                  `minLength: 0`

                - `name: string`

                  The skill name declared in `SKILL.md`.

                  `minLength: 0`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `type: "openai_hosted"`

              The type of the object. Always `openai_hosted`.

              - `"openai_hosted"`

          - `AutomationEnvironmentResourceSelfHosted`

            - `capability_directories: Array<string>`

              Directories that expose capabilities to the agent.

              `minItems: 0`, `maxItems: 2000`

            - `environment_id: string | null`

              An existing registration, or null to create a session-owned environment.

              `minLength: 0`

            - `type: "self_hosted"`

              The type of the object. Always `self_hosted`.

              - `"self_hosted"`

            - `workspace_directory: string`

              The absolute project directory in the environment.

              `minLength: 0`

        - `input: Array<Input>`

          Initial input delivered to each new session.

          `minItems: 0`, `maxItems: 2000`

          - `content: Array<InputContent>`

            The content of the message.

            `minItems: 0`, `maxItems: 2000`

            - `InputContentResourceInputText`

              Text input recorded in a session item.

              - `text: string`

                The text supplied to the agent.

                `minLength: 0`

              - `type: "input_text"`

                The type of the object. Always `input_text`.

                - `"input_text"`

            - `InputContentResourceInputImage`

              Image input recorded in a session item.

              - `image_url: string`

                The URL of the image supplied to the agent, which may be a base64-encoded data URL.

                `minLength: 0`

              - `type: "input_image"`

                The type of the object. Always `input_image`.

                - `"input_image"`

          - `role: "user"`

            The role of the message author. Always `user`.

            - `"user"`

          - `type: "message"`

            The type of the input item. Always `message`.

            - `"message"`

        - `metadata: Record<string, string>`

          Metadata attached to each new session.

        - `type: "new_session"`

          The type of the object. Always `new_session`.

          - `"new_session"`

        - `vault_ids: Array<string>`

          Vaults made available to each new session.

          `minItems: 0`, `maxItems: 2000`

      - `AutomationTargetResourceExistingSession`

        - `instructions: string`

          Saved instructions delivered as an automation notification.

          `minLength: 0`

        - `session_id: string`

          The session receiving each invocation.

          `minLength: 0`

        - `type: "existing_session"`

          The type of the object. Always `existing_session`.

          - `"existing_session"`

    - `timezone: string`

      The timezone used to interpret the expression.

      `minLength: 0`

    - `type: "periodic"`

      The type of the object. Always `periodic`.

      - `"periodic"`

  - `OneTimeAutomation`

    Fields shared by periodic and one-time automations.

    - `id: string`

      The automation ID.

      `minLength: 0`

    - `created_at: number`

      The creation time as a Unix timestamp in seconds.

      `format: int64`

    - `created_by: AutomationCreatedBy`

      Service-recorded provenance; callers cannot supply this field.

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the automation.

    - `name: string`

      The automation's display name.

      `minLength: 0`

    - `object: "agent.automation"`

      Always `agent.automation`.

      - `"agent.automation"`

    - `run_at: number`

      The Unix timestamp, in seconds, of the scheduled occurrence.

      `format: int64`

    - `status: "active" | "paused" | "completed"`

      Completion means the schedule has finished, not the agent's work.

      - `"active"`

      - `"paused"`

      - `"completed"`

    - `target: AutomationTarget`

      The session configuration or existing session receiving invocations.

    - `type: "once"`

      The type of the object. Always `once`.

      - `"once"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const automation = await client.beta.agents.automations.resume('automation_id');

console.log(automation);
```

#### 200 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "created_by": {
    "type": "developer"
  },
  "expression": "expression",
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "agent.automation",
  "status": "active",
  "target": {
    "agent": {
      "instructions": "instructions",
      "model": "model",
      "multi_agent": {
        "enabled": true,
        "max_concurrent_subagents": 1
      },
      "reasoning": {
        "effort": "none",
        "summary": "concise"
      },
      "service_tier": "auto",
      "text": {
        "format": {
          "type": "text"
        },
        "verbosity": "low"
      },
      "tools": [
        {
          "defer_loading": true,
          "description": "description",
          "name": "name",
          "parameters": {
            "foo": "bar"
          },
          "type": "function",
          "async": true
        }
      ],
      "compaction": {
        "async": true
      },
      "experimental": {
        "time_awareness": true
      }
    },
    "agent_id": "agent_id",
    "environment": {
      "type": "none"
    },
    "input": [
      {
        "content": [
          {
            "text": "text",
            "type": "input_text"
          }
        ],
        "role": "user",
        "type": "message"
      }
    ],
    "metadata": {
      "foo": "string"
    },
    "type": "new_session",
    "vault_ids": [
      "string"
    ]
  },
  "timezone": "timezone",
  "type": "periodic"
}
```

## Get an automation

`client.beta.agents.automations.retrieve(stringautomationID, RequestOptionsoptions?): Automation`

**get** `/agents/automations/{automation_id}`

Retrieves a project-owned automation.

### Parameters

- `automationID: string`

  `minLength: 0`, `maxLength: 1048576`

### Returns

- `Automation = PeriodicAutomation | OneTimeAutomation`

  A saved automation and its schedule.

  - `PeriodicAutomation`

    Fields shared by periodic and one-time automations.

    - `id: string`

      The automation ID.

      `minLength: 0`

    - `created_at: number`

      The creation time as a Unix timestamp in seconds.

      `format: int64`

    - `created_by: AutomationCreatedBy`

      Service-recorded provenance; callers cannot supply this field.

      - `AutomationCreatedByResourceDeveloper`

        - `type: "developer"`

          The type of the object. Always `developer`.

          - `"developer"`

      - `AutomationCreatedByResourceAgent`

        - `session_id: string`

          The creator session, which is also the automation's target.

          `minLength: 0`

        - `tool_call_id: string`

          The tool call that created the automation.

          `minLength: 0`

        - `type: "agent"`

          The type of the object. Always `agent`.

          - `"agent"`

    - `expression: string`

      The cron expression determining scheduled occurrences.

      `minLength: 0`

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the automation.

    - `name: string`

      The automation's display name.

      `minLength: 0`

    - `object: "agent.automation"`

      Always `agent.automation`.

      - `"agent.automation"`

    - `status: "active" | "paused"`

      Whether scheduled delivery is active or paused.

      - `"active"`

      - `"paused"`

    - `target: AutomationTarget`

      The session configuration or existing session receiving invocations.

      - `AutomationTargetResourceNewSession`

        - `agent: AutomationAgentConfig | null`

          The inline agent configuration, or null when agent_id is configured.

          - `instructions: string | null`

            Custom instructions, or null when absent.

            `minLength: 0`

          - `model: string`

            The requested model name.

            `minLength: 0`

          - `multi_agent: MultiAgentConfig`

            The configuration for creating and coordinating subagents.

            - `enabled: boolean`

              Whether subagent tools are enabled. Defaults to false.

            - `max_concurrent_subagents: number | null`

              Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

              `format: int64`, `minimum: 1`, `maximum: 4294967295`

          - `reasoning: AgentReasoning`

            The configured reasoning policy.

            - `effort: "none" | "minimal" | "low" | 4 more | null`

              The requested reasoning effort, or `null` when the model selects its own default.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

            - `summary: "concise" | "detailed" | "auto" | null`

              The requested reasoning summary format, or `null` when summaries are disabled.

              - `"concise"`

                Returns a concise reasoning summary when supported.

              - `"detailed"`

                Returns a detailed reasoning summary when supported.

              - `"auto"`

                Automatically selects the most detailed summary supported by the model.

          - `service_tier: "auto" | "default" | "flex" | 3 more`

            The configured service-tier policy.

            - `"auto"`

            - `"default"`

            - `"flex"`

            - `"priority"`

            - `"fast"`

            - `"ultrafast"`

          - `text: AgentText`

            The configured output format and verbosity.

            - `format: TextFormat`

              The effective output format. Defaults to ordinary text.

              - `TextFormatResourceText`

                Generates ordinary text without a structured-output constraint.

                - `type: "text"`

                  The type of the object. Always `text`.

                  - `"text"`

              - `TextFormatResourceJSONSchema`

                Constrains generated text to a JSON Schema.

                - `schema: Record<string, unknown>`

                  The JSON Schema that generated text must match.

                - `type: "json_schema"`

                  The type of the object. Always `json_schema`.

                  - `"json_schema"`

            - `verbosity: "low" | "medium" | "high"`

              The amount of text produced by the agent. Defaults to `medium`.

              - `"low"`

              - `"medium"`

              - `"high"`

          - `tools: Array<AgentTool>`

            Configured tools, excluding confidential credentials.

            `minItems: 0`, `maxItems: 2000`

            - `AgentToolResourceFunction`

              A function defined by the application.

              - `defer_loading: boolean`

                Whether the function is deferred and discovered through tool search.

              - `description: string`

                A description of what the function does.

                `minLength: 0`

              - `name: string`

                The name of the function.

                `minLength: 0`

              - `parameters: Record<string, unknown>`

                A JSON Schema object describing the function's arguments.

              - `type: "function"`

                The type of the object. Always `function`.

                - `"function"`

              - `async?: boolean`

                Whether the agent continues without waiting for the function result.

            - `AgentToolResourceProgrammaticToolCalling`

              Enables calling tools from model-generated code.

              - `enabled: boolean`

                Whether tools can be called from model-generated code.

              - `type: "programmatic_tool_calling"`

                The type of the object. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `AgentToolResourceMcp`

              Tools provided by a remote MCP server.

              - `allowed_tools: Array<string> | null`

                The MCP tools the agent may call.

                `minItems: 0`, `maxItems: 2000`

              - `connection_origin: "service" | "environment"`

                Where outbound MCP HTTP connections originate.

                - `"service"`

                - `"environment"`

              - `credential_id: string | null`

                The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

                `minLength: 0`

              - `request_metadata: Record<string, unknown>`

                Metadata included with requests to this MCP server.

              - `required: boolean`

                Whether this MCP server must initialize before the first turn.

              - `server_label: string`

                A label used to identify the MCP server in tool calls.

                `minLength: 0`

              - `transport: McpTransport`

                The transport used to connect to the MCP server.

                - `McpTransportResourceHTTP`

                  Connects to an MCP server over HTTP.

                  - `server_url: string`

                    The URL of the MCP server.

                    `minLength: 0`

                  - `type: "http"`

                    The type of the object. Always `http`.

                    - `"http"`

                - `McpTransportResourceStdio`

                  Starts an MCP server as a local process.

                  - `args: Array<string>`

                    Arguments passed to the MCP server command.

                    `minItems: 0`, `maxItems: 2000`

                  - `command: string`

                    The command used to start the MCP server.

                    `minLength: 0`

                  - `cwd: string`

                    The working directory used to start the MCP server.

                    `minLength: 0`

                  - `env_vars: Array<string>`

                    Environment variable names inherited from the execution environment.

                    `minItems: 0`, `maxItems: 2000`

                  - `type: "stdio"`

                    The type of the object. Always `stdio`.

                    - `"stdio"`

              - `type: "mcp"`

                The type of the object. Always `mcp`.

                - `"mcp"`

            - `AgentToolResourceWebSearch`

              Web search.

              - `allowed_domains: Array<string> | null`

                Allowed search domains, or `null` when the search is unrestricted.

                `minItems: 0`, `maxItems: 2000`

              - `context_size: "low" | "medium" | "high"`

                The amount of search context made available to the model. Defaults to `medium`.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `location: Location | null`

                Approximate location used to localize search results, if provided.

                - `city: string | null`

                  The city name.

                  `minLength: 0`

                - `country: string | null`

                  The two-letter ISO country code, such as `US`.

                  `minLength: 0`

                - `region: string | null`

                  The region or state name.

                  `minLength: 0`

                - `timezone: string | null`

                  The IANA timezone, such as `America/Los_Angeles`.

                  `minLength: 0`

              - `mode: "disabled" | "cached" | "live"`

                The source used for web search results.

                - `"disabled"`

                - `"cached"`

                - `"live"`

              - `type: "web_search"`

                The type of the object. Always `web_search`.

                - `"web_search"`

            - `AgentToolResourceComputerUse`

              Browser use in an OpenAI-hosted session.

              - `include_screenshots: boolean`

                Whether computer tool outputs include screenshots.

              - `type: "computer_use"`

                The type of the object. Always `computer_use`.

                - `"computer_use"`

            - `AgentToolResourceAutomations`

              Lets the agent manage its own scheduled wakeups.

              - `type: "automations"`

                The type of the object. Always `automations`.

                - `"automations"`

          - `compaction?: Compaction`

            The effective context compaction settings.

            - `async: boolean`

              Whether context is compacted in the background. Defaults to true.

          - `experimental?: Experimental`

            The effective experimental settings for the agent.

            - `time_awareness: boolean`

              Whether the model receives periodic current-time reminders.

        - `agent_id: string | null`

          The saved agent reference, or null when an inline agent is configured.

          `minLength: 0`

        - `environment: AutomationEnvironment`

          Configuration or references used to select the execution environment.

          - `AutomationEnvironmentResourceNone`

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `AutomationEnvironmentResourceOpenAIHosted`

            Hosted environment selection with confidential setup commands and variables omitted.

            - `capability_directories: Array<string> | null`

              Directory overrides, or null to inherit the template or creation default.

              `minItems: 0`, `maxItems: 2000`

            - `container_size: "small" | "medium" | "large" | null`

              The configured container size, or null to use the creation default.

              - `"small"`

              - `"medium"`

              - `"large"`

            - `desktop: Desktop | null`

              Desktop overrides, or null to inherit the template or creation default.

              - `enabled: boolean`

                Whether the environment provisions a desktop and browser proxy.

            - `environment_id: string | null`

              An existing environment reference, or null when provisioning a new environment.

              `minLength: 0`

            - `environment_template_id: string | null`

              A template reference, or null when no template is selected.

              `minLength: 0`

            - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

              File overrides, excluding contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `HostedTemplateFileResourceFileID`

                A project-scoped Files API reference resolved separately for each session.

                - `file_id: string`

                  The ID of the uploaded file.

                  `minLength: 0`

                - `path: string`

                  The file's absolute path inside the environment.

                  `minLength: 0`

                - `type: "file_id"`

                  The type of the object. Always `file_id`.

                  - `"file_id"`

              - `HostedTemplateFileResourceInline`

                Metadata for confidential inline file contents.

                - `path: string`

                  The file's absolute path inside the environment.

                  `minLength: 0`

                - `size_bytes: number`

                  The decoded size of the inline file in bytes.

                  `format: int64`, `minimum: 0`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `network: Network | null`

              Network overrides, or null to inherit the template or creation default.

              - `access: "enabled" | "disabled" | "restricted"`

                The environment's network access mode.

                - `"enabled"`

                  Allows unrestricted network access.

                - `"disabled"`

                  Disables network access.

                - `"restricted"`

                  Applies the configured domain restrictions.

              - `allowed_domains: Array<string>`

                Domains the environment may access when network access is restricted.

                `minItems: 0`, `maxItems: 2000`

            - `packages: Packages | null`

              Package overrides, or null to inherit the template or creation default.

              - `npm: Array<string>`

                npm packages installed globally in the environment.

                `minItems: 0`, `maxItems: 16384`

              - `python: Array<string>`

                Python packages installed in the environment.

                `minItems: 0`, `maxItems: 16384`

              - `system: Array<string>`

                System packages installed in the environment.

                `minItems: 0`, `maxItems: 16384`

            - `plugins: Array<HostedPlugin> | null`

              Plugin overrides, excluding archive contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `description: string`

                The installed plugin description.

                `minLength: 0`

              - `name: string`

                The installed plugin name.

                `minLength: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

            - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

              Skill overrides, excluding archive contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `HostedTemplateSkillResourceSkillReference`

                A skill resolved afresh from the Skills API whenever a session starts.

                - `skill_id: string`

                  The referenced skill ID.

                  `minLength: 0`

                - `type: "skill_reference"`

                  The type of the object. Always `skill_reference`.

                  - `"skill_reference"`

                - `version: string | null`

                  The requested version selector, including `latest`.

                  `minLength: 0`

              - `HostedTemplateSkillResourceInline`

                Safe metadata for an inline skill archive.

                - `description: string`

                  The skill description declared in `SKILL.md`.

                  `minLength: 0`

                - `name: string`

                  The skill name declared in `SKILL.md`.

                  `minLength: 0`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `type: "openai_hosted"`

              The type of the object. Always `openai_hosted`.

              - `"openai_hosted"`

          - `AutomationEnvironmentResourceSelfHosted`

            - `capability_directories: Array<string>`

              Directories that expose capabilities to the agent.

              `minItems: 0`, `maxItems: 2000`

            - `environment_id: string | null`

              An existing registration, or null to create a session-owned environment.

              `minLength: 0`

            - `type: "self_hosted"`

              The type of the object. Always `self_hosted`.

              - `"self_hosted"`

            - `workspace_directory: string`

              The absolute project directory in the environment.

              `minLength: 0`

        - `input: Array<Input>`

          Initial input delivered to each new session.

          `minItems: 0`, `maxItems: 2000`

          - `content: Array<InputContent>`

            The content of the message.

            `minItems: 0`, `maxItems: 2000`

            - `InputContentResourceInputText`

              Text input recorded in a session item.

              - `text: string`

                The text supplied to the agent.

                `minLength: 0`

              - `type: "input_text"`

                The type of the object. Always `input_text`.

                - `"input_text"`

            - `InputContentResourceInputImage`

              Image input recorded in a session item.

              - `image_url: string`

                The URL of the image supplied to the agent, which may be a base64-encoded data URL.

                `minLength: 0`

              - `type: "input_image"`

                The type of the object. Always `input_image`.

                - `"input_image"`

          - `role: "user"`

            The role of the message author. Always `user`.

            - `"user"`

          - `type: "message"`

            The type of the input item. Always `message`.

            - `"message"`

        - `metadata: Record<string, string>`

          Metadata attached to each new session.

        - `type: "new_session"`

          The type of the object. Always `new_session`.

          - `"new_session"`

        - `vault_ids: Array<string>`

          Vaults made available to each new session.

          `minItems: 0`, `maxItems: 2000`

      - `AutomationTargetResourceExistingSession`

        - `instructions: string`

          Saved instructions delivered as an automation notification.

          `minLength: 0`

        - `session_id: string`

          The session receiving each invocation.

          `minLength: 0`

        - `type: "existing_session"`

          The type of the object. Always `existing_session`.

          - `"existing_session"`

    - `timezone: string`

      The timezone used to interpret the expression.

      `minLength: 0`

    - `type: "periodic"`

      The type of the object. Always `periodic`.

      - `"periodic"`

  - `OneTimeAutomation`

    Fields shared by periodic and one-time automations.

    - `id: string`

      The automation ID.

      `minLength: 0`

    - `created_at: number`

      The creation time as a Unix timestamp in seconds.

      `format: int64`

    - `created_by: AutomationCreatedBy`

      Service-recorded provenance; callers cannot supply this field.

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the automation.

    - `name: string`

      The automation's display name.

      `minLength: 0`

    - `object: "agent.automation"`

      Always `agent.automation`.

      - `"agent.automation"`

    - `run_at: number`

      The Unix timestamp, in seconds, of the scheduled occurrence.

      `format: int64`

    - `status: "active" | "paused" | "completed"`

      Completion means the schedule has finished, not the agent's work.

      - `"active"`

      - `"paused"`

      - `"completed"`

    - `target: AutomationTarget`

      The session configuration or existing session receiving invocations.

    - `type: "once"`

      The type of the object. Always `once`.

      - `"once"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const automation = await client.beta.agents.automations.retrieve('automation_id');

console.log(automation);
```

#### 200 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "created_by": {
    "type": "developer"
  },
  "expression": "expression",
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "agent.automation",
  "status": "active",
  "target": {
    "agent": {
      "instructions": "instructions",
      "model": "model",
      "multi_agent": {
        "enabled": true,
        "max_concurrent_subagents": 1
      },
      "reasoning": {
        "effort": "none",
        "summary": "concise"
      },
      "service_tier": "auto",
      "text": {
        "format": {
          "type": "text"
        },
        "verbosity": "low"
      },
      "tools": [
        {
          "defer_loading": true,
          "description": "description",
          "name": "name",
          "parameters": {
            "foo": "bar"
          },
          "type": "function",
          "async": true
        }
      ],
      "compaction": {
        "async": true
      },
      "experimental": {
        "time_awareness": true
      }
    },
    "agent_id": "agent_id",
    "environment": {
      "type": "none"
    },
    "input": [
      {
        "content": [
          {
            "text": "text",
            "type": "input_text"
          }
        ],
        "role": "user",
        "type": "message"
      }
    ],
    "metadata": {
      "foo": "string"
    },
    "type": "new_session",
    "vault_ids": [
      "string"
    ]
  },
  "timezone": "timezone",
  "type": "periodic"
}
```

## Update an automation

`client.beta.agents.automations.update(stringautomationID, AutomationUpdateParamsbody, RequestOptionsoptions?): Automation`

**post** `/agents/automations/{automation_id}`

Updates supplied fields; target and metadata replace the whole field.

### Parameters

- `automationID: string`

  `minLength: 0`, `maxLength: 1048576`

- `body: AutomationUpdateParams`

  - `expression?: string`

    Only accepted for periodic automations.

    `minLength: 1`, `maxLength: 256`

  - `metadata?: Record<string, string>`

    Replaces all metadata; omit to leave unchanged.

  - `name?: string`

    `minLength: 1`, `maxLength: 256`

  - `run_at?: number`

    A future Unix timestamp in seconds; accepted only before a one-time scheduled invocation exists.

    `format: int64`

  - `target?: AutomationTargetParam`

    Replaces the complete target, retaining its type and any creator session.

    - `AutomationTargetParamNewSession`

      Create a session for each invocation.

      - `environment: EnvironmentParam`

        The execution environment for each new session.

        - `EnvironmentParamNone`

          Runs the agent without an execution environment.

          - `type: "none"`

            The type of the object. Always `none`.

            - `"none"`

        - `EnvironmentParamOpenAIHosted`

          An existing OpenAI-hosted environment or new inline/template-based hosted configuration.

          - `type: "openai_hosted"`

            The type of the object. Always `openai_hosted`.

            - `"openai_hosted"`

          - `capability_directories?: Array<string> | null`

            Directories that contain capabilities exposed to the agent. Defaults to an empty list.

            `minItems: 0`, `maxItems: 16384`

          - `container_size?: "small" | "medium" | "large"`

            The hosted container size. Omission selects the medium tier.

            - `"small"`

            - `"medium"`

            - `"large"`

          - `desktop?: Desktop | null`

            Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled.

            - `enabled: boolean`

              Whether to provision the desktop and its browser proxy.

          - `env?: Record<string, string> | null`

            Environment variables made available to the agent.

          - `environment_id?: string`

            An existing prewarmed environment. Cannot be combined with a template or inline configuration.

            `minLength: 9`, `maxLength: 256`

          - `environment_template_id?: string`

            A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy.

            `minLength: 0`, `maxLength: 64`

          - `files?: Array<HostedEnvironmentFileParam> | null`

            Files available before the agent starts. Defaults to an empty list.

            `minItems: 0`, `maxItems: 50`

            - `HostedEnvironmentFileParamFileID`

              A file previously uploaded through the OpenAI Files API.

              - `file_id: string`

                The ID of the uploaded file.

                `minLength: 1`, `maxLength: 256`

              - `path: string`

                The absolute destination path inside `/workspace`.

                `minLength: 1`, `maxLength: 4096`

              - `type: "file_id"`

                The type of the object. Always `file_id`.

                - `"file_id"`

            - `HostedEnvironmentFileParamInline`

              A file supplied directly as standard-base64 data.

              - `data: string`

                The standard-base64-encoded file contents.

                `minLength: 0`, `maxLength: 6990508`

              - `path: string`

                The absolute destination path inside `/workspace`.

                `minLength: 1`, `maxLength: 4096`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

          - `network?: Network | null`

            Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled.

            - `access: "enabled" | "disabled" | "restricted"`

              The environment's network access mode.

              - `"enabled"`

                Allows unrestricted network access.

              - `"disabled"`

                Disables network access.

              - `"restricted"`

                Applies the configured domain restrictions.

            - `allowed_domains?: Array<string> | null`

              Domains the environment may access when network access is restricted.

              `minItems: 0`, `maxItems: 16384`

            - `blocked_domains?: Array<string> | null`

              Domains blocked for both executor and browser when access is restricted. A nonempty list requires `access: restricted` and cannot be combined with nonempty `allowed_domains`. Wildcard domains are not supported.

              `minItems: 0`, `maxItems: 100`

          - `packages?: Packages | null`

            Packages to install in the environment. Defaults to empty package lists.

            - `npm?: Array<string> | null`

              npm packages to install globally. Defaults to an empty list.

              `minItems: 0`, `maxItems: 16384`

            - `python?: Array<string> | null`

              Python packages to install. Defaults to an empty list.

              `minItems: 0`, `maxItems: 16384`

            - `system?: Array<string> | null`

              System packages to install. Defaults to an empty list.

              `minItems: 0`, `maxItems: 16384`

          - `plugins?: Array<HostedPluginParam> | null`

            Plugins provided as inline ZIP archives. Defaults to an empty list.

            `minItems: 0`, `maxItems: 32`

            - `description: string`

              The plugin description declared in `.codex-plugin/plugin.json`.

              `minLength: 0`, `maxLength: 1048576`

            - `name: string`

              The plugin name declared in `.codex-plugin/plugin.json`.

              `minLength: 1`, `maxLength: 64`

            - `source: InlineCapabilitySourceParam`

              Provides ZIP bytes encoded with standard base64.

              - `data: string`

                Standard-base64 encoded ZIP archive bytes.

                `minLength: 1`, `maxLength: 70254592`

              - `media_type: "application/zip"`

                The archive media type, always `application/zip`.

                - `"application/zip"`

              - `type: "base64"`

                The type of the object. Always `base64`.

                - `"base64"`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

          - `setup_commands?: Array<SetupCommandParam> | null`

            Ordered, confidential setup commands. Command bodies are never returned.

            `minItems: 0`, `maxItems: 16`

            - `command: string`

              The shell command to execute.

              `minLength: 0`, `maxLength: 65536`

            - `cwd?: string | null`

              The absolute working directory. Defaults to `/workspace`.

              `minLength: 0`, `maxLength: 4096`

          - `skills?: Array<HostedSkillParam> | null`

            Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.

            `minItems: 0`, `maxItems: 200`

            - `HostedSkillParamSkillReference`

              References a skill uploaded through the Skills API.

              - `skill_id: string`

                The ID of the skill created through `/v1/skills`.

                `minLength: 1`, `maxLength: 64`

              - `type: "skill_reference"`

                The type of the object. Always `skill_reference`.

                - `"skill_reference"`

              - `version?: string | null`

                The skill version, a positive integer or `latest`; omission selects the default.

                `minLength: 0`, `maxLength: 1048576`

            - `HostedSkillParamInline`

              Supplies a skill ZIP directly in the session request.

              - `description: string`

                The skill description declared in `SKILL.md`.

                `minLength: 0`, `maxLength: 1048576`

              - `name: string`

                The skill name declared in `SKILL.md`.

                `minLength: 1`, `maxLength: 64`

              - `source: InlineCapabilitySourceParam`

                Provides ZIP bytes encoded with standard base64.

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

        - `EnvironmentParamSelfHosted`

          An application-hosted environment configured inline.

          - `type: "self_hosted"`

            The type of the object. Always `self_hosted`.

            - `"self_hosted"`

          - `workspace_directory: string`

            Absolute project directory inside the self-hosted environment.

            `minLength: 0`, `maxLength: 1048576`

          - `capability_directories?: Array<string> | null`

            Directories that contain capabilities exposed to the agent. Defaults to an empty list.

            `minItems: 0`, `maxItems: 16384`

      - `input: Array<AgentSessionInputMessageParam>`

        Initial user messages submitted with each new session.

        `minItems: 0`, `maxItems: 16384`

        - `content: Array<InputContentParam>`

          The content of the message.

          `minItems: 0`, `maxItems: 16384`

          - `InputContentParamInputText`

            Text input to the model.

            - `text: string`

              The text sent to the model.

              `minLength: 0`, `maxLength: 1048576`

            - `type: "input_text"`

              The type of the object. Always `input_text`.

              - `"input_text"`

          - `InputContentParamInputImage`

            Image input to the model.

            - `image_url: string`

              The URL of the image sent to the model.

              `minLength: 0`, `maxLength: 1048576`

            - `type: "input_image"`

              The type of the object. Always `input_image`.

              - `"input_image"`

        - `role: "user"`

          The role of the message author. Always `user`.

          - `"user"`

        - `type?: "message"`

          The type of the input item. Always `message`.

          - `"message"`

      - `type: "new_session"`

        The type of the object. Always `new_session`.

        - `"new_session"`

      - `agent?: Agent`

        Inline agent configuration. Provide exactly one of agent and agent_id.

        - `compaction?: Compaction | null`

          Context compaction settings. Omit to keep the current settings. A supplied object replaces the settings; null or an empty object enables background compaction.

          - `async?: boolean | null`

            Whether to compact context in the background. Omission or null defaults to true. Set to false to use blocking compaction. Background compaction may increase token usage.

        - `experimental?: Experimental`

          Experimental settings to merge by key. Omitted settings keep their current values.

          - `time_awareness?: boolean`

            Whether to give the model periodic current-time reminders. Omit to keep the current setting.

        - `instructions?: string | null`

          Additional instructions appended to the agent's default base instructions. Omit to leave unchanged.

          `minLength: 0`, `maxLength: 1048576`

        - `model?: string`

          The model to use for the agent. The requested model name is preserved.

          `minLength: 0`, `maxLength: 1048576`

        - `multi_agent?: MultiAgentConfigParam | null`

          Configuration for creating and coordinating subagents.

          - `enabled: boolean`

            Whether subagent tools are enabled.

          - `max_concurrent_subagents?: number`

            Maximum number of subagents that may run concurrently. Defaults to 6.

            `format: int64`, `minimum: 1`, `maximum: 4294967295`

        - `reasoning?: AgentReasoningParam | null`

          Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort.

          - `effort?: "none" | "minimal" | "low" | 4 more | null`

            The amount of reasoning effort the model should use. Omission lets the model select it.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

          - `summary?: "concise" | "detailed" | "auto" | null`

            Controls whether the response includes a reasoning summary.

            - `"concise"`

              Returns a concise reasoning summary when supported.

            - `"detailed"`

              Returns a detailed reasoning summary when supported.

            - `"auto"`

              Automatically selects the most detailed summary supported by the model.

        - `service_tier?: "auto" | "default" | "flex" | 3 more | null`

          The service tier used for model requests.

          - `"auto"`

            Selects the service tier automatically.

          - `"default"`

            Uses the default service tier.

          - `"flex"`

            Uses the flex service tier.

          - `"priority"`

            Uses the priority service tier.

          - `"fast"`

            Uses the fast service tier.

          - `"ultrafast"`

            Uses the ultrafast service tier.

        - `text?: AgentTextParam | null`

          Configuration for text generated by the agent.

          - `format?: TextFormatParam | null`

            The output format. Omission uses ordinary text (`{"type": "text"}`).

            - `TextFormatParamText`

              Generates ordinary text without a structured-output constraint.

              - `type: "text"`

                The type of the object. Always `text`.

                - `"text"`

            - `TextFormatParamJSONSchema`

              Constrains generated text to a JSON Schema.

              - `schema: Record<string, unknown>`

                The JSON Schema that generated text must match.

              - `type: "json_schema"`

                The type of the object. Always `json_schema`.

                - `"json_schema"`

          - `verbosity?: "low" | "medium" | "high" | null`

            The amount of text the model should produce. Defaults to `medium`, matching Responses.

            - `"low"`

              Produces less text.

            - `"medium"`

              Uses the default amount of text.

            - `"high"`

              Produces more text.

        - `tools?: Array<AgentToolParam> | null`

          Tools available to the agent. Omit to inherit, or pass null to clear them. The resolved tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON.

          `minItems: 0`, `maxItems: 16384`

          - `AgentToolConfigParamFunction`

            A function defined by the application.

            - `description: string`

              A description of what the function does.

              `minLength: 0`, `maxLength: 1048576`

            - `name: string`

              The name of the function.

              `minLength: 0`, `maxLength: 1048576`

            - `parameters: Record<string, unknown>`

              A JSON Schema object describing the function's arguments.

            - `type: "function"`

              The type of the object. Always `function`.

              - `"function"`

            - `async?: boolean`

              Whether the agent continues without waiting for the function result. Defaults to `false`.

            - `defer_loading?: boolean`

              Whether this function is deferred and discovered through tool search. Defaults to `false`.

          - `AgentToolConfigParamToolSearch`

            Discovers deferred function tools and loads them into the model context.

            - `type: "tool_search"`

              The type of the object. Always `tool_search`.

              - `"tool_search"`

          - `AgentToolConfigParamProgrammaticToolCalling`

            Enables calling tools from model-generated code.

            - `type: "programmatic_tool_calling"`

              The type of the object. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

            - `enabled?: boolean`

              Whether tools can be called from model-generated code. Defaults to `true`.

          - `AgentToolConfigParamMcp`

            Tools provided by a remote MCP server.

            - `server_label: string`

              A label used to identify the MCP server in tool calls.

              `minLength: 0`, `maxLength: 1048576`

            - `transport: McpTransportParam`

              The transport used to connect to the MCP server.

              - `McpTransportConfigParamHTTP`

                Connects to an MCP server over HTTP.

                - `server_url: string`

                  The URL of the MCP server.

                  `minLength: 0`, `maxLength: 1048576`

                - `type: "http"`

                  The type of the object. Always `http`.

                  - `"http"`

                - `authorization?: string | null`

                  The authorization value sent to the MCP server, if any.

                  `minLength: 0`, `maxLength: 1048576`

                - `headers?: Record<string, string> | null`

                  Additional HTTP headers sent to the MCP server.

              - `McpTransportConfigParamStdio`

                Starts an MCP server as a local process.

                - `command: string`

                  The command used to start the MCP server.

                  `minLength: 0`, `maxLength: 1048576`

                - `cwd: string`

                  The working directory used to start the MCP server.

                  `minLength: 0`, `maxLength: 1048576`

                - `type: "stdio"`

                  The type of the object. Always `stdio`.

                  - `"stdio"`

                - `args?: Array<string> | null`

                  Arguments passed to the MCP server command.

                  `minItems: 0`, `maxItems: 16384`

                - `env?: Record<string, string> | null`

                  Environment variables set for the MCP server process.

                - `env_vars?: Array<string> | null`

                  Environment variable names to inherit from the selected execution environment.

                  `minItems: 0`, `maxItems: 16384`

            - `type: "mcp"`

              The type of the object. Always `mcp`.

              - `"mcp"`

            - `allowed_tools?: Array<string> | null`

              The MCP tools the agent may call. All server tools are allowed when omitted.

              `minItems: 0`, `maxItems: 16384`

            - `connection_origin?: "service" | "environment" | null`

              Selects where outbound MCP HTTP connections originate. Omitted or `service` uses the Managed Agents service network; `environment` uses the session's selected environment.

              - `"service"`

                Uses the Managed Agents service network.

              - `"environment"`

                Uses the session's execution environment.

            - `credential_id?: string | null`

              The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL.

              `minLength: 0`, `maxLength: 1048576`

            - `request_metadata?: Record<string, unknown> | null`

              Metadata included with requests to this MCP server.

            - `required?: boolean`

              Whether this MCP server must initialize before the first turn. Defaults to `false`.

          - `AgentToolConfigParamWebSearch`

            Web search.

            - `type: "web_search"`

              The type of the object. Always `web_search`.

              - `"web_search"`

            - `allowed_domains?: Array<string> | null`

              Domains the search may include.

              `minItems: 0`, `maxItems: 16384`

            - `context_size?: "low" | "medium" | "high" | null`

              The amount of search context made available to the model. Defaults to `medium`.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `location?: Location | null`

              Approximate location used to localize search results.

              - `city?: string | null`

                The city name.

                `minLength: 0`, `maxLength: 1048576`

              - `country?: string | null`

                The two-letter ISO country code, such as `US`.

                `minLength: 0`, `maxLength: 1048576`

              - `region?: string | null`

                The region or state name.

                `minLength: 0`, `maxLength: 1048576`

              - `timezone?: string | null`

                The IANA timezone, such as `America/Los_Angeles`.

                `minLength: 0`, `maxLength: 1048576`

            - `mode?: "disabled" | "cached" | "live" | null`

              The source used for web search results. Defaults to `live`.

              - `"disabled"`

                Disables web search.

              - `"cached"`

                Uses cached search results.

              - `"live"`

                Searches the live web.

          - `AgentToolConfigParamComputerUse`

            Browser use in an OpenAI-hosted session.

            - `type: "computer_use"`

              The type of the object. Always `computer_use`.

              - `"computer_use"`

            - `include_screenshots?: boolean`

              Whether computer tool outputs include screenshots. Defaults to `false`.

          - `AgentToolConfigParamAutomations`

            Lets the agent manage its own scheduled wakeups.

            - `type: "automations"`

              The type of the object. Always `automations`.

              - `"automations"`

      - `agent_id?: string`

        A saved agent ID. Provide exactly one of agent and agent_id.

        `minLength: 0`, `maxLength: 64`

      - `metadata?: Record<string, string> | null`

        Metadata attached to each new session.

      - `vault_ids?: Array<string> | null`

        The IDs of vaults made available to each new session.

        `minItems: 0`, `maxItems: 16384`

    - `AutomationTargetParamExistingSession`

      Deliver instructions to an existing session.

      - `instructions: string`

        Instructions delivered as an automation notification.

        `minLength: 0`, `maxLength: 1048576`

      - `session_id: string`

        The session receiving each invocation.

        `minLength: 0`, `maxLength: 1048576`

      - `type: "existing_session"`

        The type of the object. Always `existing_session`.

        - `"existing_session"`

  - `timezone?: string`

    Only accepted for periodic automations.

    `minLength: 1`, `maxLength: 128`

### Returns

- `Automation = PeriodicAutomation | OneTimeAutomation`

  A saved automation and its schedule.

  - `PeriodicAutomation`

    Fields shared by periodic and one-time automations.

    - `id: string`

      The automation ID.

      `minLength: 0`

    - `created_at: number`

      The creation time as a Unix timestamp in seconds.

      `format: int64`

    - `created_by: AutomationCreatedBy`

      Service-recorded provenance; callers cannot supply this field.

      - `AutomationCreatedByResourceDeveloper`

        - `type: "developer"`

          The type of the object. Always `developer`.

          - `"developer"`

      - `AutomationCreatedByResourceAgent`

        - `session_id: string`

          The creator session, which is also the automation's target.

          `minLength: 0`

        - `tool_call_id: string`

          The tool call that created the automation.

          `minLength: 0`

        - `type: "agent"`

          The type of the object. Always `agent`.

          - `"agent"`

    - `expression: string`

      The cron expression determining scheduled occurrences.

      `minLength: 0`

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the automation.

    - `name: string`

      The automation's display name.

      `minLength: 0`

    - `object: "agent.automation"`

      Always `agent.automation`.

      - `"agent.automation"`

    - `status: "active" | "paused"`

      Whether scheduled delivery is active or paused.

      - `"active"`

      - `"paused"`

    - `target: AutomationTarget`

      The session configuration or existing session receiving invocations.

      - `AutomationTargetResourceNewSession`

        - `agent: AutomationAgentConfig | null`

          The inline agent configuration, or null when agent_id is configured.

          - `instructions: string | null`

            Custom instructions, or null when absent.

            `minLength: 0`

          - `model: string`

            The requested model name.

            `minLength: 0`

          - `multi_agent: MultiAgentConfig`

            The configuration for creating and coordinating subagents.

            - `enabled: boolean`

              Whether subagent tools are enabled. Defaults to false.

            - `max_concurrent_subagents: number | null`

              Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

              `format: int64`, `minimum: 1`, `maximum: 4294967295`

          - `reasoning: AgentReasoning`

            The configured reasoning policy.

            - `effort: "none" | "minimal" | "low" | 4 more | null`

              The requested reasoning effort, or `null` when the model selects its own default.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

            - `summary: "concise" | "detailed" | "auto" | null`

              The requested reasoning summary format, or `null` when summaries are disabled.

              - `"concise"`

                Returns a concise reasoning summary when supported.

              - `"detailed"`

                Returns a detailed reasoning summary when supported.

              - `"auto"`

                Automatically selects the most detailed summary supported by the model.

          - `service_tier: "auto" | "default" | "flex" | 3 more`

            The configured service-tier policy.

            - `"auto"`

            - `"default"`

            - `"flex"`

            - `"priority"`

            - `"fast"`

            - `"ultrafast"`

          - `text: AgentText`

            The configured output format and verbosity.

            - `format: TextFormat`

              The effective output format. Defaults to ordinary text.

              - `TextFormatResourceText`

                Generates ordinary text without a structured-output constraint.

                - `type: "text"`

                  The type of the object. Always `text`.

                  - `"text"`

              - `TextFormatResourceJSONSchema`

                Constrains generated text to a JSON Schema.

                - `schema: Record<string, unknown>`

                  The JSON Schema that generated text must match.

                - `type: "json_schema"`

                  The type of the object. Always `json_schema`.

                  - `"json_schema"`

            - `verbosity: "low" | "medium" | "high"`

              The amount of text produced by the agent. Defaults to `medium`.

              - `"low"`

              - `"medium"`

              - `"high"`

          - `tools: Array<AgentTool>`

            Configured tools, excluding confidential credentials.

            `minItems: 0`, `maxItems: 2000`

            - `AgentToolResourceFunction`

              A function defined by the application.

              - `defer_loading: boolean`

                Whether the function is deferred and discovered through tool search.

              - `description: string`

                A description of what the function does.

                `minLength: 0`

              - `name: string`

                The name of the function.

                `minLength: 0`

              - `parameters: Record<string, unknown>`

                A JSON Schema object describing the function's arguments.

              - `type: "function"`

                The type of the object. Always `function`.

                - `"function"`

              - `async?: boolean`

                Whether the agent continues without waiting for the function result.

            - `AgentToolResourceProgrammaticToolCalling`

              Enables calling tools from model-generated code.

              - `enabled: boolean`

                Whether tools can be called from model-generated code.

              - `type: "programmatic_tool_calling"`

                The type of the object. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `AgentToolResourceMcp`

              Tools provided by a remote MCP server.

              - `allowed_tools: Array<string> | null`

                The MCP tools the agent may call.

                `minItems: 0`, `maxItems: 2000`

              - `connection_origin: "service" | "environment"`

                Where outbound MCP HTTP connections originate.

                - `"service"`

                - `"environment"`

              - `credential_id: string | null`

                The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

                `minLength: 0`

              - `request_metadata: Record<string, unknown>`

                Metadata included with requests to this MCP server.

              - `required: boolean`

                Whether this MCP server must initialize before the first turn.

              - `server_label: string`

                A label used to identify the MCP server in tool calls.

                `minLength: 0`

              - `transport: McpTransport`

                The transport used to connect to the MCP server.

                - `McpTransportResourceHTTP`

                  Connects to an MCP server over HTTP.

                  - `server_url: string`

                    The URL of the MCP server.

                    `minLength: 0`

                  - `type: "http"`

                    The type of the object. Always `http`.

                    - `"http"`

                - `McpTransportResourceStdio`

                  Starts an MCP server as a local process.

                  - `args: Array<string>`

                    Arguments passed to the MCP server command.

                    `minItems: 0`, `maxItems: 2000`

                  - `command: string`

                    The command used to start the MCP server.

                    `minLength: 0`

                  - `cwd: string`

                    The working directory used to start the MCP server.

                    `minLength: 0`

                  - `env_vars: Array<string>`

                    Environment variable names inherited from the execution environment.

                    `minItems: 0`, `maxItems: 2000`

                  - `type: "stdio"`

                    The type of the object. Always `stdio`.

                    - `"stdio"`

              - `type: "mcp"`

                The type of the object. Always `mcp`.

                - `"mcp"`

            - `AgentToolResourceWebSearch`

              Web search.

              - `allowed_domains: Array<string> | null`

                Allowed search domains, or `null` when the search is unrestricted.

                `minItems: 0`, `maxItems: 2000`

              - `context_size: "low" | "medium" | "high"`

                The amount of search context made available to the model. Defaults to `medium`.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `location: Location | null`

                Approximate location used to localize search results, if provided.

                - `city: string | null`

                  The city name.

                  `minLength: 0`

                - `country: string | null`

                  The two-letter ISO country code, such as `US`.

                  `minLength: 0`

                - `region: string | null`

                  The region or state name.

                  `minLength: 0`

                - `timezone: string | null`

                  The IANA timezone, such as `America/Los_Angeles`.

                  `minLength: 0`

              - `mode: "disabled" | "cached" | "live"`

                The source used for web search results.

                - `"disabled"`

                - `"cached"`

                - `"live"`

              - `type: "web_search"`

                The type of the object. Always `web_search`.

                - `"web_search"`

            - `AgentToolResourceComputerUse`

              Browser use in an OpenAI-hosted session.

              - `include_screenshots: boolean`

                Whether computer tool outputs include screenshots.

              - `type: "computer_use"`

                The type of the object. Always `computer_use`.

                - `"computer_use"`

            - `AgentToolResourceAutomations`

              Lets the agent manage its own scheduled wakeups.

              - `type: "automations"`

                The type of the object. Always `automations`.

                - `"automations"`

          - `compaction?: Compaction`

            The effective context compaction settings.

            - `async: boolean`

              Whether context is compacted in the background. Defaults to true.

          - `experimental?: Experimental`

            The effective experimental settings for the agent.

            - `time_awareness: boolean`

              Whether the model receives periodic current-time reminders.

        - `agent_id: string | null`

          The saved agent reference, or null when an inline agent is configured.

          `minLength: 0`

        - `environment: AutomationEnvironment`

          Configuration or references used to select the execution environment.

          - `AutomationEnvironmentResourceNone`

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `AutomationEnvironmentResourceOpenAIHosted`

            Hosted environment selection with confidential setup commands and variables omitted.

            - `capability_directories: Array<string> | null`

              Directory overrides, or null to inherit the template or creation default.

              `minItems: 0`, `maxItems: 2000`

            - `container_size: "small" | "medium" | "large" | null`

              The configured container size, or null to use the creation default.

              - `"small"`

              - `"medium"`

              - `"large"`

            - `desktop: Desktop | null`

              Desktop overrides, or null to inherit the template or creation default.

              - `enabled: boolean`

                Whether the environment provisions a desktop and browser proxy.

            - `environment_id: string | null`

              An existing environment reference, or null when provisioning a new environment.

              `minLength: 0`

            - `environment_template_id: string | null`

              A template reference, or null when no template is selected.

              `minLength: 0`

            - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

              File overrides, excluding contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `HostedTemplateFileResourceFileID`

                A project-scoped Files API reference resolved separately for each session.

                - `file_id: string`

                  The ID of the uploaded file.

                  `minLength: 0`

                - `path: string`

                  The file's absolute path inside the environment.

                  `minLength: 0`

                - `type: "file_id"`

                  The type of the object. Always `file_id`.

                  - `"file_id"`

              - `HostedTemplateFileResourceInline`

                Metadata for confidential inline file contents.

                - `path: string`

                  The file's absolute path inside the environment.

                  `minLength: 0`

                - `size_bytes: number`

                  The decoded size of the inline file in bytes.

                  `format: int64`, `minimum: 0`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `network: Network | null`

              Network overrides, or null to inherit the template or creation default.

              - `access: "enabled" | "disabled" | "restricted"`

                The environment's network access mode.

                - `"enabled"`

                  Allows unrestricted network access.

                - `"disabled"`

                  Disables network access.

                - `"restricted"`

                  Applies the configured domain restrictions.

              - `allowed_domains: Array<string>`

                Domains the environment may access when network access is restricted.

                `minItems: 0`, `maxItems: 2000`

            - `packages: Packages | null`

              Package overrides, or null to inherit the template or creation default.

              - `npm: Array<string>`

                npm packages installed globally in the environment.

                `minItems: 0`, `maxItems: 16384`

              - `python: Array<string>`

                Python packages installed in the environment.

                `minItems: 0`, `maxItems: 16384`

              - `system: Array<string>`

                System packages installed in the environment.

                `minItems: 0`, `maxItems: 16384`

            - `plugins: Array<HostedPlugin> | null`

              Plugin overrides, excluding archive contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `description: string`

                The installed plugin description.

                `minLength: 0`

              - `name: string`

                The installed plugin name.

                `minLength: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

            - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

              Skill overrides, excluding archive contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `HostedTemplateSkillResourceSkillReference`

                A skill resolved afresh from the Skills API whenever a session starts.

                - `skill_id: string`

                  The referenced skill ID.

                  `minLength: 0`

                - `type: "skill_reference"`

                  The type of the object. Always `skill_reference`.

                  - `"skill_reference"`

                - `version: string | null`

                  The requested version selector, including `latest`.

                  `minLength: 0`

              - `HostedTemplateSkillResourceInline`

                Safe metadata for an inline skill archive.

                - `description: string`

                  The skill description declared in `SKILL.md`.

                  `minLength: 0`

                - `name: string`

                  The skill name declared in `SKILL.md`.

                  `minLength: 0`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `type: "openai_hosted"`

              The type of the object. Always `openai_hosted`.

              - `"openai_hosted"`

          - `AutomationEnvironmentResourceSelfHosted`

            - `capability_directories: Array<string>`

              Directories that expose capabilities to the agent.

              `minItems: 0`, `maxItems: 2000`

            - `environment_id: string | null`

              An existing registration, or null to create a session-owned environment.

              `minLength: 0`

            - `type: "self_hosted"`

              The type of the object. Always `self_hosted`.

              - `"self_hosted"`

            - `workspace_directory: string`

              The absolute project directory in the environment.

              `minLength: 0`

        - `input: Array<Input>`

          Initial input delivered to each new session.

          `minItems: 0`, `maxItems: 2000`

          - `content: Array<InputContent>`

            The content of the message.

            `minItems: 0`, `maxItems: 2000`

            - `InputContentResourceInputText`

              Text input recorded in a session item.

              - `text: string`

                The text supplied to the agent.

                `minLength: 0`

              - `type: "input_text"`

                The type of the object. Always `input_text`.

                - `"input_text"`

            - `InputContentResourceInputImage`

              Image input recorded in a session item.

              - `image_url: string`

                The URL of the image supplied to the agent, which may be a base64-encoded data URL.

                `minLength: 0`

              - `type: "input_image"`

                The type of the object. Always `input_image`.

                - `"input_image"`

          - `role: "user"`

            The role of the message author. Always `user`.

            - `"user"`

          - `type: "message"`

            The type of the input item. Always `message`.

            - `"message"`

        - `metadata: Record<string, string>`

          Metadata attached to each new session.

        - `type: "new_session"`

          The type of the object. Always `new_session`.

          - `"new_session"`

        - `vault_ids: Array<string>`

          Vaults made available to each new session.

          `minItems: 0`, `maxItems: 2000`

      - `AutomationTargetResourceExistingSession`

        - `instructions: string`

          Saved instructions delivered as an automation notification.

          `minLength: 0`

        - `session_id: string`

          The session receiving each invocation.

          `minLength: 0`

        - `type: "existing_session"`

          The type of the object. Always `existing_session`.

          - `"existing_session"`

    - `timezone: string`

      The timezone used to interpret the expression.

      `minLength: 0`

    - `type: "periodic"`

      The type of the object. Always `periodic`.

      - `"periodic"`

  - `OneTimeAutomation`

    Fields shared by periodic and one-time automations.

    - `id: string`

      The automation ID.

      `minLength: 0`

    - `created_at: number`

      The creation time as a Unix timestamp in seconds.

      `format: int64`

    - `created_by: AutomationCreatedBy`

      Service-recorded provenance; callers cannot supply this field.

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the automation.

    - `name: string`

      The automation's display name.

      `minLength: 0`

    - `object: "agent.automation"`

      Always `agent.automation`.

      - `"agent.automation"`

    - `run_at: number`

      The Unix timestamp, in seconds, of the scheduled occurrence.

      `format: int64`

    - `status: "active" | "paused" | "completed"`

      Completion means the schedule has finished, not the agent's work.

      - `"active"`

      - `"paused"`

      - `"completed"`

    - `target: AutomationTarget`

      The session configuration or existing session receiving invocations.

    - `type: "once"`

      The type of the object. Always `once`.

      - `"once"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const automation = await client.beta.agents.automations.update('automation_id');

console.log(automation);
```

#### 200 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "created_by": {
    "type": "developer"
  },
  "expression": "expression",
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "agent.automation",
  "status": "active",
  "target": {
    "agent": {
      "instructions": "instructions",
      "model": "model",
      "multi_agent": {
        "enabled": true,
        "max_concurrent_subagents": 1
      },
      "reasoning": {
        "effort": "none",
        "summary": "concise"
      },
      "service_tier": "auto",
      "text": {
        "format": {
          "type": "text"
        },
        "verbosity": "low"
      },
      "tools": [
        {
          "defer_loading": true,
          "description": "description",
          "name": "name",
          "parameters": {
            "foo": "bar"
          },
          "type": "function",
          "async": true
        }
      ],
      "compaction": {
        "async": true
      },
      "experimental": {
        "time_awareness": true
      }
    },
    "agent_id": "agent_id",
    "environment": {
      "type": "none"
    },
    "input": [
      {
        "content": [
          {
            "text": "text",
            "type": "input_text"
          }
        ],
        "role": "user",
        "type": "message"
      }
    ],
    "metadata": {
      "foo": "string"
    },
    "type": "new_session",
    "vault_ids": [
      "string"
    ]
  },
  "timezone": "timezone",
  "type": "periodic"
}
```

## Domain Types

### Automation

- `Automation = PeriodicAutomation | OneTimeAutomation`

  A saved automation and its schedule.

  - `PeriodicAutomation`

    Fields shared by periodic and one-time automations.

    - `id: string`

      The automation ID.

      `minLength: 0`

    - `created_at: number`

      The creation time as a Unix timestamp in seconds.

      `format: int64`

    - `created_by: AutomationCreatedBy`

      Service-recorded provenance; callers cannot supply this field.

      - `AutomationCreatedByResourceDeveloper`

        - `type: "developer"`

          The type of the object. Always `developer`.

          - `"developer"`

      - `AutomationCreatedByResourceAgent`

        - `session_id: string`

          The creator session, which is also the automation's target.

          `minLength: 0`

        - `tool_call_id: string`

          The tool call that created the automation.

          `minLength: 0`

        - `type: "agent"`

          The type of the object. Always `agent`.

          - `"agent"`

    - `expression: string`

      The cron expression determining scheduled occurrences.

      `minLength: 0`

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the automation.

    - `name: string`

      The automation's display name.

      `minLength: 0`

    - `object: "agent.automation"`

      Always `agent.automation`.

      - `"agent.automation"`

    - `status: "active" | "paused"`

      Whether scheduled delivery is active or paused.

      - `"active"`

      - `"paused"`

    - `target: AutomationTarget`

      The session configuration or existing session receiving invocations.

      - `AutomationTargetResourceNewSession`

        - `agent: AutomationAgentConfig | null`

          The inline agent configuration, or null when agent_id is configured.

          - `instructions: string | null`

            Custom instructions, or null when absent.

            `minLength: 0`

          - `model: string`

            The requested model name.

            `minLength: 0`

          - `multi_agent: MultiAgentConfig`

            The configuration for creating and coordinating subagents.

            - `enabled: boolean`

              Whether subagent tools are enabled. Defaults to false.

            - `max_concurrent_subagents: number | null`

              Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

              `format: int64`, `minimum: 1`, `maximum: 4294967295`

          - `reasoning: AgentReasoning`

            The configured reasoning policy.

            - `effort: "none" | "minimal" | "low" | 4 more | null`

              The requested reasoning effort, or `null` when the model selects its own default.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

            - `summary: "concise" | "detailed" | "auto" | null`

              The requested reasoning summary format, or `null` when summaries are disabled.

              - `"concise"`

                Returns a concise reasoning summary when supported.

              - `"detailed"`

                Returns a detailed reasoning summary when supported.

              - `"auto"`

                Automatically selects the most detailed summary supported by the model.

          - `service_tier: "auto" | "default" | "flex" | 3 more`

            The configured service-tier policy.

            - `"auto"`

            - `"default"`

            - `"flex"`

            - `"priority"`

            - `"fast"`

            - `"ultrafast"`

          - `text: AgentText`

            The configured output format and verbosity.

            - `format: TextFormat`

              The effective output format. Defaults to ordinary text.

              - `TextFormatResourceText`

                Generates ordinary text without a structured-output constraint.

                - `type: "text"`

                  The type of the object. Always `text`.

                  - `"text"`

              - `TextFormatResourceJSONSchema`

                Constrains generated text to a JSON Schema.

                - `schema: Record<string, unknown>`

                  The JSON Schema that generated text must match.

                - `type: "json_schema"`

                  The type of the object. Always `json_schema`.

                  - `"json_schema"`

            - `verbosity: "low" | "medium" | "high"`

              The amount of text produced by the agent. Defaults to `medium`.

              - `"low"`

              - `"medium"`

              - `"high"`

          - `tools: Array<AgentTool>`

            Configured tools, excluding confidential credentials.

            `minItems: 0`, `maxItems: 2000`

            - `AgentToolResourceFunction`

              A function defined by the application.

              - `defer_loading: boolean`

                Whether the function is deferred and discovered through tool search.

              - `description: string`

                A description of what the function does.

                `minLength: 0`

              - `name: string`

                The name of the function.

                `minLength: 0`

              - `parameters: Record<string, unknown>`

                A JSON Schema object describing the function's arguments.

              - `type: "function"`

                The type of the object. Always `function`.

                - `"function"`

              - `async?: boolean`

                Whether the agent continues without waiting for the function result.

            - `AgentToolResourceProgrammaticToolCalling`

              Enables calling tools from model-generated code.

              - `enabled: boolean`

                Whether tools can be called from model-generated code.

              - `type: "programmatic_tool_calling"`

                The type of the object. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `AgentToolResourceMcp`

              Tools provided by a remote MCP server.

              - `allowed_tools: Array<string> | null`

                The MCP tools the agent may call.

                `minItems: 0`, `maxItems: 2000`

              - `connection_origin: "service" | "environment"`

                Where outbound MCP HTTP connections originate.

                - `"service"`

                - `"environment"`

              - `credential_id: string | null`

                The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

                `minLength: 0`

              - `request_metadata: Record<string, unknown>`

                Metadata included with requests to this MCP server.

              - `required: boolean`

                Whether this MCP server must initialize before the first turn.

              - `server_label: string`

                A label used to identify the MCP server in tool calls.

                `minLength: 0`

              - `transport: McpTransport`

                The transport used to connect to the MCP server.

                - `McpTransportResourceHTTP`

                  Connects to an MCP server over HTTP.

                  - `server_url: string`

                    The URL of the MCP server.

                    `minLength: 0`

                  - `type: "http"`

                    The type of the object. Always `http`.

                    - `"http"`

                - `McpTransportResourceStdio`

                  Starts an MCP server as a local process.

                  - `args: Array<string>`

                    Arguments passed to the MCP server command.

                    `minItems: 0`, `maxItems: 2000`

                  - `command: string`

                    The command used to start the MCP server.

                    `minLength: 0`

                  - `cwd: string`

                    The working directory used to start the MCP server.

                    `minLength: 0`

                  - `env_vars: Array<string>`

                    Environment variable names inherited from the execution environment.

                    `minItems: 0`, `maxItems: 2000`

                  - `type: "stdio"`

                    The type of the object. Always `stdio`.

                    - `"stdio"`

              - `type: "mcp"`

                The type of the object. Always `mcp`.

                - `"mcp"`

            - `AgentToolResourceWebSearch`

              Web search.

              - `allowed_domains: Array<string> | null`

                Allowed search domains, or `null` when the search is unrestricted.

                `minItems: 0`, `maxItems: 2000`

              - `context_size: "low" | "medium" | "high"`

                The amount of search context made available to the model. Defaults to `medium`.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `location: Location | null`

                Approximate location used to localize search results, if provided.

                - `city: string | null`

                  The city name.

                  `minLength: 0`

                - `country: string | null`

                  The two-letter ISO country code, such as `US`.

                  `minLength: 0`

                - `region: string | null`

                  The region or state name.

                  `minLength: 0`

                - `timezone: string | null`

                  The IANA timezone, such as `America/Los_Angeles`.

                  `minLength: 0`

              - `mode: "disabled" | "cached" | "live"`

                The source used for web search results.

                - `"disabled"`

                - `"cached"`

                - `"live"`

              - `type: "web_search"`

                The type of the object. Always `web_search`.

                - `"web_search"`

            - `AgentToolResourceComputerUse`

              Browser use in an OpenAI-hosted session.

              - `include_screenshots: boolean`

                Whether computer tool outputs include screenshots.

              - `type: "computer_use"`

                The type of the object. Always `computer_use`.

                - `"computer_use"`

            - `AgentToolResourceAutomations`

              Lets the agent manage its own scheduled wakeups.

              - `type: "automations"`

                The type of the object. Always `automations`.

                - `"automations"`

          - `compaction?: Compaction`

            The effective context compaction settings.

            - `async: boolean`

              Whether context is compacted in the background. Defaults to true.

          - `experimental?: Experimental`

            The effective experimental settings for the agent.

            - `time_awareness: boolean`

              Whether the model receives periodic current-time reminders.

        - `agent_id: string | null`

          The saved agent reference, or null when an inline agent is configured.

          `minLength: 0`

        - `environment: AutomationEnvironment`

          Configuration or references used to select the execution environment.

          - `AutomationEnvironmentResourceNone`

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `AutomationEnvironmentResourceOpenAIHosted`

            Hosted environment selection with confidential setup commands and variables omitted.

            - `capability_directories: Array<string> | null`

              Directory overrides, or null to inherit the template or creation default.

              `minItems: 0`, `maxItems: 2000`

            - `container_size: "small" | "medium" | "large" | null`

              The configured container size, or null to use the creation default.

              - `"small"`

              - `"medium"`

              - `"large"`

            - `desktop: Desktop | null`

              Desktop overrides, or null to inherit the template or creation default.

              - `enabled: boolean`

                Whether the environment provisions a desktop and browser proxy.

            - `environment_id: string | null`

              An existing environment reference, or null when provisioning a new environment.

              `minLength: 0`

            - `environment_template_id: string | null`

              A template reference, or null when no template is selected.

              `minLength: 0`

            - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

              File overrides, excluding contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `HostedTemplateFileResourceFileID`

                A project-scoped Files API reference resolved separately for each session.

                - `file_id: string`

                  The ID of the uploaded file.

                  `minLength: 0`

                - `path: string`

                  The file's absolute path inside the environment.

                  `minLength: 0`

                - `type: "file_id"`

                  The type of the object. Always `file_id`.

                  - `"file_id"`

              - `HostedTemplateFileResourceInline`

                Metadata for confidential inline file contents.

                - `path: string`

                  The file's absolute path inside the environment.

                  `minLength: 0`

                - `size_bytes: number`

                  The decoded size of the inline file in bytes.

                  `format: int64`, `minimum: 0`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `network: Network | null`

              Network overrides, or null to inherit the template or creation default.

              - `access: "enabled" | "disabled" | "restricted"`

                The environment's network access mode.

                - `"enabled"`

                  Allows unrestricted network access.

                - `"disabled"`

                  Disables network access.

                - `"restricted"`

                  Applies the configured domain restrictions.

              - `allowed_domains: Array<string>`

                Domains the environment may access when network access is restricted.

                `minItems: 0`, `maxItems: 2000`

            - `packages: Packages | null`

              Package overrides, or null to inherit the template or creation default.

              - `npm: Array<string>`

                npm packages installed globally in the environment.

                `minItems: 0`, `maxItems: 16384`

              - `python: Array<string>`

                Python packages installed in the environment.

                `minItems: 0`, `maxItems: 16384`

              - `system: Array<string>`

                System packages installed in the environment.

                `minItems: 0`, `maxItems: 16384`

            - `plugins: Array<HostedPlugin> | null`

              Plugin overrides, excluding archive contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `description: string`

                The installed plugin description.

                `minLength: 0`

              - `name: string`

                The installed plugin name.

                `minLength: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

            - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

              Skill overrides, excluding archive contents, or null to inherit.

              `minItems: 0`, `maxItems: 2000`

              - `HostedTemplateSkillResourceSkillReference`

                A skill resolved afresh from the Skills API whenever a session starts.

                - `skill_id: string`

                  The referenced skill ID.

                  `minLength: 0`

                - `type: "skill_reference"`

                  The type of the object. Always `skill_reference`.

                  - `"skill_reference"`

                - `version: string | null`

                  The requested version selector, including `latest`.

                  `minLength: 0`

              - `HostedTemplateSkillResourceInline`

                Safe metadata for an inline skill archive.

                - `description: string`

                  The skill description declared in `SKILL.md`.

                  `minLength: 0`

                - `name: string`

                  The skill name declared in `SKILL.md`.

                  `minLength: 0`

                - `type: "inline"`

                  The type of the object. Always `inline`.

                  - `"inline"`

            - `type: "openai_hosted"`

              The type of the object. Always `openai_hosted`.

              - `"openai_hosted"`

          - `AutomationEnvironmentResourceSelfHosted`

            - `capability_directories: Array<string>`

              Directories that expose capabilities to the agent.

              `minItems: 0`, `maxItems: 2000`

            - `environment_id: string | null`

              An existing registration, or null to create a session-owned environment.

              `minLength: 0`

            - `type: "self_hosted"`

              The type of the object. Always `self_hosted`.

              - `"self_hosted"`

            - `workspace_directory: string`

              The absolute project directory in the environment.

              `minLength: 0`

        - `input: Array<Input>`

          Initial input delivered to each new session.

          `minItems: 0`, `maxItems: 2000`

          - `content: Array<InputContent>`

            The content of the message.

            `minItems: 0`, `maxItems: 2000`

            - `InputContentResourceInputText`

              Text input recorded in a session item.

              - `text: string`

                The text supplied to the agent.

                `minLength: 0`

              - `type: "input_text"`

                The type of the object. Always `input_text`.

                - `"input_text"`

            - `InputContentResourceInputImage`

              Image input recorded in a session item.

              - `image_url: string`

                The URL of the image supplied to the agent, which may be a base64-encoded data URL.

                `minLength: 0`

              - `type: "input_image"`

                The type of the object. Always `input_image`.

                - `"input_image"`

          - `role: "user"`

            The role of the message author. Always `user`.

            - `"user"`

          - `type: "message"`

            The type of the input item. Always `message`.

            - `"message"`

        - `metadata: Record<string, string>`

          Metadata attached to each new session.

        - `type: "new_session"`

          The type of the object. Always `new_session`.

          - `"new_session"`

        - `vault_ids: Array<string>`

          Vaults made available to each new session.

          `minItems: 0`, `maxItems: 2000`

      - `AutomationTargetResourceExistingSession`

        - `instructions: string`

          Saved instructions delivered as an automation notification.

          `minLength: 0`

        - `session_id: string`

          The session receiving each invocation.

          `minLength: 0`

        - `type: "existing_session"`

          The type of the object. Always `existing_session`.

          - `"existing_session"`

    - `timezone: string`

      The timezone used to interpret the expression.

      `minLength: 0`

    - `type: "periodic"`

      The type of the object. Always `periodic`.

      - `"periodic"`

  - `OneTimeAutomation`

    Fields shared by periodic and one-time automations.

    - `id: string`

      The automation ID.

      `minLength: 0`

    - `created_at: number`

      The creation time as a Unix timestamp in seconds.

      `format: int64`

    - `created_by: AutomationCreatedBy`

      Service-recorded provenance; callers cannot supply this field.

    - `metadata: Record<string, string>`

      Custom string key-value pairs attached to the automation.

    - `name: string`

      The automation's display name.

      `minLength: 0`

    - `object: "agent.automation"`

      Always `agent.automation`.

      - `"agent.automation"`

    - `run_at: number`

      The Unix timestamp, in seconds, of the scheduled occurrence.

      `format: int64`

    - `status: "active" | "paused" | "completed"`

      Completion means the schedule has finished, not the agent's work.

      - `"active"`

      - `"paused"`

      - `"completed"`

    - `target: AutomationTarget`

      The session configuration or existing session receiving invocations.

    - `type: "once"`

      The type of the object. Always `once`.

      - `"once"`

### Automation Agent Config

- `AutomationAgentConfig`

  Inline agent configuration without a generated session-local identity.

  - `instructions: string | null`

    Custom instructions, or null when absent.

    `minLength: 0`

  - `model: string`

    The requested model name.

    `minLength: 0`

  - `multi_agent: MultiAgentConfig`

    The configuration for creating and coordinating subagents.

    - `enabled: boolean`

      Whether subagent tools are enabled. Defaults to false.

    - `max_concurrent_subagents: number | null`

      Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

      `format: int64`, `minimum: 1`, `maximum: 4294967295`

  - `reasoning: AgentReasoning`

    The configured reasoning policy.

    - `effort: "none" | "minimal" | "low" | 4 more | null`

      The requested reasoning effort, or `null` when the model selects its own default.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `summary: "concise" | "detailed" | "auto" | null`

      The requested reasoning summary format, or `null` when summaries are disabled.

      - `"concise"`

        Returns a concise reasoning summary when supported.

      - `"detailed"`

        Returns a detailed reasoning summary when supported.

      - `"auto"`

        Automatically selects the most detailed summary supported by the model.

  - `service_tier: "auto" | "default" | "flex" | 3 more`

    The configured service-tier policy.

    - `"auto"`

    - `"default"`

    - `"flex"`

    - `"priority"`

    - `"fast"`

    - `"ultrafast"`

  - `text: AgentText`

    The configured output format and verbosity.

    - `format: TextFormat`

      The effective output format. Defaults to ordinary text.

      - `TextFormatResourceText`

        Generates ordinary text without a structured-output constraint.

        - `type: "text"`

          The type of the object. Always `text`.

          - `"text"`

      - `TextFormatResourceJSONSchema`

        Constrains generated text to a JSON Schema.

        - `schema: Record<string, unknown>`

          The JSON Schema that generated text must match.

        - `type: "json_schema"`

          The type of the object. Always `json_schema`.

          - `"json_schema"`

    - `verbosity: "low" | "medium" | "high"`

      The amount of text produced by the agent. Defaults to `medium`.

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tools: Array<AgentTool>`

    Configured tools, excluding confidential credentials.

    `minItems: 0`, `maxItems: 2000`

    - `AgentToolResourceFunction`

      A function defined by the application.

      - `defer_loading: boolean`

        Whether the function is deferred and discovered through tool search.

      - `description: string`

        A description of what the function does.

        `minLength: 0`

      - `name: string`

        The name of the function.

        `minLength: 0`

      - `parameters: Record<string, unknown>`

        A JSON Schema object describing the function's arguments.

      - `type: "function"`

        The type of the object. Always `function`.

        - `"function"`

      - `async?: boolean`

        Whether the agent continues without waiting for the function result.

    - `AgentToolResourceProgrammaticToolCalling`

      Enables calling tools from model-generated code.

      - `enabled: boolean`

        Whether tools can be called from model-generated code.

      - `type: "programmatic_tool_calling"`

        The type of the object. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `AgentToolResourceMcp`

      Tools provided by a remote MCP server.

      - `allowed_tools: Array<string> | null`

        The MCP tools the agent may call.

        `minItems: 0`, `maxItems: 2000`

      - `connection_origin: "service" | "environment"`

        Where outbound MCP HTTP connections originate.

        - `"service"`

        - `"environment"`

      - `credential_id: string | null`

        The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

        `minLength: 0`

      - `request_metadata: Record<string, unknown>`

        Metadata included with requests to this MCP server.

      - `required: boolean`

        Whether this MCP server must initialize before the first turn.

      - `server_label: string`

        A label used to identify the MCP server in tool calls.

        `minLength: 0`

      - `transport: McpTransport`

        The transport used to connect to the MCP server.

        - `McpTransportResourceHTTP`

          Connects to an MCP server over HTTP.

          - `server_url: string`

            The URL of the MCP server.

            `minLength: 0`

          - `type: "http"`

            The type of the object. Always `http`.

            - `"http"`

        - `McpTransportResourceStdio`

          Starts an MCP server as a local process.

          - `args: Array<string>`

            Arguments passed to the MCP server command.

            `minItems: 0`, `maxItems: 2000`

          - `command: string`

            The command used to start the MCP server.

            `minLength: 0`

          - `cwd: string`

            The working directory used to start the MCP server.

            `minLength: 0`

          - `env_vars: Array<string>`

            Environment variable names inherited from the execution environment.

            `minItems: 0`, `maxItems: 2000`

          - `type: "stdio"`

            The type of the object. Always `stdio`.

            - `"stdio"`

      - `type: "mcp"`

        The type of the object. Always `mcp`.

        - `"mcp"`

    - `AgentToolResourceWebSearch`

      Web search.

      - `allowed_domains: Array<string> | null`

        Allowed search domains, or `null` when the search is unrestricted.

        `minItems: 0`, `maxItems: 2000`

      - `context_size: "low" | "medium" | "high"`

        The amount of search context made available to the model. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

      - `location: Location | null`

        Approximate location used to localize search results, if provided.

        - `city: string | null`

          The city name.

          `minLength: 0`

        - `country: string | null`

          The two-letter ISO country code, such as `US`.

          `minLength: 0`

        - `region: string | null`

          The region or state name.

          `minLength: 0`

        - `timezone: string | null`

          The IANA timezone, such as `America/Los_Angeles`.

          `minLength: 0`

      - `mode: "disabled" | "cached" | "live"`

        The source used for web search results.

        - `"disabled"`

        - `"cached"`

        - `"live"`

      - `type: "web_search"`

        The type of the object. Always `web_search`.

        - `"web_search"`

    - `AgentToolResourceComputerUse`

      Browser use in an OpenAI-hosted session.

      - `include_screenshots: boolean`

        Whether computer tool outputs include screenshots.

      - `type: "computer_use"`

        The type of the object. Always `computer_use`.

        - `"computer_use"`

    - `AgentToolResourceAutomations`

      Lets the agent manage its own scheduled wakeups.

      - `type: "automations"`

        The type of the object. Always `automations`.

        - `"automations"`

  - `compaction?: Compaction`

    The effective context compaction settings.

    - `async: boolean`

      Whether context is compacted in the background. Defaults to true.

  - `experimental?: Experimental`

    The effective experimental settings for the agent.

    - `time_awareness: boolean`

      Whether the model receives periodic current-time reminders.

### Automation Created By

- `AutomationCreatedBy = AutomationCreatedByResourceDeveloper | AutomationCreatedByResourceAgent`

  How the automation was created, independently of how an invocation started.

  - `AutomationCreatedByResourceDeveloper`

    - `type: "developer"`

      The type of the object. Always `developer`.

      - `"developer"`

  - `AutomationCreatedByResourceAgent`

    - `session_id: string`

      The creator session, which is also the automation's target.

      `minLength: 0`

    - `tool_call_id: string`

      The tool call that created the automation.

      `minLength: 0`

    - `type: "agent"`

      The type of the object. Always `agent`.

      - `"agent"`

### Automation Deleted

- `AutomationDeleted`

  - `id: string`

    The deleted automation ID.

    `minLength: 0`

  - `deleted: boolean`

    Always true.

  - `object: "agent.automation.deleted"`

    Always `agent.automation.deleted`.

    - `"agent.automation.deleted"`

### Automation Environment

- `AutomationEnvironment = AutomationEnvironmentResourceNone | AutomationEnvironmentResourceOpenAIHosted | AutomationEnvironmentResourceSelfHosted`

  Environment selection saved before an invocation creates its session.

  - `AutomationEnvironmentResourceNone`

    - `type: "none"`

      The type of the object. Always `none`.

      - `"none"`

  - `AutomationEnvironmentResourceOpenAIHosted`

    Hosted environment selection with confidential setup commands and variables omitted.

    - `capability_directories: Array<string> | null`

      Directory overrides, or null to inherit the template or creation default.

      `minItems: 0`, `maxItems: 2000`

    - `container_size: "small" | "medium" | "large" | null`

      The configured container size, or null to use the creation default.

      - `"small"`

      - `"medium"`

      - `"large"`

    - `desktop: Desktop | null`

      Desktop overrides, or null to inherit the template or creation default.

      - `enabled: boolean`

        Whether the environment provisions a desktop and browser proxy.

    - `environment_id: string | null`

      An existing environment reference, or null when provisioning a new environment.

      `minLength: 0`

    - `environment_template_id: string | null`

      A template reference, or null when no template is selected.

      `minLength: 0`

    - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

      File overrides, excluding contents, or null to inherit.

      `minItems: 0`, `maxItems: 2000`

      - `HostedTemplateFileResourceFileID`

        A project-scoped Files API reference resolved separately for each session.

        - `file_id: string`

          The ID of the uploaded file.

          `minLength: 0`

        - `path: string`

          The file's absolute path inside the environment.

          `minLength: 0`

        - `type: "file_id"`

          The type of the object. Always `file_id`.

          - `"file_id"`

      - `HostedTemplateFileResourceInline`

        Metadata for confidential inline file contents.

        - `path: string`

          The file's absolute path inside the environment.

          `minLength: 0`

        - `size_bytes: number`

          The decoded size of the inline file in bytes.

          `format: int64`, `minimum: 0`

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

    - `network: Network | null`

      Network overrides, or null to inherit the template or creation default.

      - `access: "enabled" | "disabled" | "restricted"`

        The environment's network access mode.

        - `"enabled"`

          Allows unrestricted network access.

        - `"disabled"`

          Disables network access.

        - `"restricted"`

          Applies the configured domain restrictions.

      - `allowed_domains: Array<string>`

        Domains the environment may access when network access is restricted.

        `minItems: 0`, `maxItems: 2000`

    - `packages: Packages | null`

      Package overrides, or null to inherit the template or creation default.

      - `npm: Array<string>`

        npm packages installed globally in the environment.

        `minItems: 0`, `maxItems: 16384`

      - `python: Array<string>`

        Python packages installed in the environment.

        `minItems: 0`, `maxItems: 16384`

      - `system: Array<string>`

        System packages installed in the environment.

        `minItems: 0`, `maxItems: 16384`

    - `plugins: Array<HostedPlugin> | null`

      Plugin overrides, excluding archive contents, or null to inherit.

      `minItems: 0`, `maxItems: 2000`

      - `description: string`

        The installed plugin description.

        `minLength: 0`

      - `name: string`

        The installed plugin name.

        `minLength: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

    - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

      Skill overrides, excluding archive contents, or null to inherit.

      `minItems: 0`, `maxItems: 2000`

      - `HostedTemplateSkillResourceSkillReference`

        A skill resolved afresh from the Skills API whenever a session starts.

        - `skill_id: string`

          The referenced skill ID.

          `minLength: 0`

        - `type: "skill_reference"`

          The type of the object. Always `skill_reference`.

          - `"skill_reference"`

        - `version: string | null`

          The requested version selector, including `latest`.

          `minLength: 0`

      - `HostedTemplateSkillResourceInline`

        Safe metadata for an inline skill archive.

        - `description: string`

          The skill description declared in `SKILL.md`.

          `minLength: 0`

        - `name: string`

          The skill name declared in `SKILL.md`.

          `minLength: 0`

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

    - `type: "openai_hosted"`

      The type of the object. Always `openai_hosted`.

      - `"openai_hosted"`

  - `AutomationEnvironmentResourceSelfHosted`

    - `capability_directories: Array<string>`

      Directories that expose capabilities to the agent.

      `minItems: 0`, `maxItems: 2000`

    - `environment_id: string | null`

      An existing registration, or null to create a session-owned environment.

      `minLength: 0`

    - `type: "self_hosted"`

      The type of the object. Always `self_hosted`.

      - `"self_hosted"`

    - `workspace_directory: string`

      The absolute project directory in the environment.

      `minLength: 0`

### Automation Target

- `AutomationTarget = AutomationTargetResourceNewSession | AutomationTargetResourceExistingSession`

  Saved target configuration, excluding confidential request-only values.

  - `AutomationTargetResourceNewSession`

    - `agent: AutomationAgentConfig | null`

      The inline agent configuration, or null when agent_id is configured.

      - `instructions: string | null`

        Custom instructions, or null when absent.

        `minLength: 0`

      - `model: string`

        The requested model name.

        `minLength: 0`

      - `multi_agent: MultiAgentConfig`

        The configuration for creating and coordinating subagents.

        - `enabled: boolean`

          Whether subagent tools are enabled. Defaults to false.

        - `max_concurrent_subagents: number | null`

          Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

          `format: int64`, `minimum: 1`, `maximum: 4294967295`

      - `reasoning: AgentReasoning`

        The configured reasoning policy.

        - `effort: "none" | "minimal" | "low" | 4 more | null`

          The requested reasoning effort, or `null` when the model selects its own default.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

        - `summary: "concise" | "detailed" | "auto" | null`

          The requested reasoning summary format, or `null` when summaries are disabled.

          - `"concise"`

            Returns a concise reasoning summary when supported.

          - `"detailed"`

            Returns a detailed reasoning summary when supported.

          - `"auto"`

            Automatically selects the most detailed summary supported by the model.

      - `service_tier: "auto" | "default" | "flex" | 3 more`

        The configured service-tier policy.

        - `"auto"`

        - `"default"`

        - `"flex"`

        - `"priority"`

        - `"fast"`

        - `"ultrafast"`

      - `text: AgentText`

        The configured output format and verbosity.

        - `format: TextFormat`

          The effective output format. Defaults to ordinary text.

          - `TextFormatResourceText`

            Generates ordinary text without a structured-output constraint.

            - `type: "text"`

              The type of the object. Always `text`.

              - `"text"`

          - `TextFormatResourceJSONSchema`

            Constrains generated text to a JSON Schema.

            - `schema: Record<string, unknown>`

              The JSON Schema that generated text must match.

            - `type: "json_schema"`

              The type of the object. Always `json_schema`.

              - `"json_schema"`

        - `verbosity: "low" | "medium" | "high"`

          The amount of text produced by the agent. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

      - `tools: Array<AgentTool>`

        Configured tools, excluding confidential credentials.

        `minItems: 0`, `maxItems: 2000`

        - `AgentToolResourceFunction`

          A function defined by the application.

          - `defer_loading: boolean`

            Whether the function is deferred and discovered through tool search.

          - `description: string`

            A description of what the function does.

            `minLength: 0`

          - `name: string`

            The name of the function.

            `minLength: 0`

          - `parameters: Record<string, unknown>`

            A JSON Schema object describing the function's arguments.

          - `type: "function"`

            The type of the object. Always `function`.

            - `"function"`

          - `async?: boolean`

            Whether the agent continues without waiting for the function result.

        - `AgentToolResourceProgrammaticToolCalling`

          Enables calling tools from model-generated code.

          - `enabled: boolean`

            Whether tools can be called from model-generated code.

          - `type: "programmatic_tool_calling"`

            The type of the object. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `AgentToolResourceMcp`

          Tools provided by a remote MCP server.

          - `allowed_tools: Array<string> | null`

            The MCP tools the agent may call.

            `minItems: 0`, `maxItems: 2000`

          - `connection_origin: "service" | "environment"`

            Where outbound MCP HTTP connections originate.

            - `"service"`

            - `"environment"`

          - `credential_id: string | null`

            The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

            `minLength: 0`

          - `request_metadata: Record<string, unknown>`

            Metadata included with requests to this MCP server.

          - `required: boolean`

            Whether this MCP server must initialize before the first turn.

          - `server_label: string`

            A label used to identify the MCP server in tool calls.

            `minLength: 0`

          - `transport: McpTransport`

            The transport used to connect to the MCP server.

            - `McpTransportResourceHTTP`

              Connects to an MCP server over HTTP.

              - `server_url: string`

                The URL of the MCP server.

                `minLength: 0`

              - `type: "http"`

                The type of the object. Always `http`.

                - `"http"`

            - `McpTransportResourceStdio`

              Starts an MCP server as a local process.

              - `args: Array<string>`

                Arguments passed to the MCP server command.

                `minItems: 0`, `maxItems: 2000`

              - `command: string`

                The command used to start the MCP server.

                `minLength: 0`

              - `cwd: string`

                The working directory used to start the MCP server.

                `minLength: 0`

              - `env_vars: Array<string>`

                Environment variable names inherited from the execution environment.

                `minItems: 0`, `maxItems: 2000`

              - `type: "stdio"`

                The type of the object. Always `stdio`.

                - `"stdio"`

          - `type: "mcp"`

            The type of the object. Always `mcp`.

            - `"mcp"`

        - `AgentToolResourceWebSearch`

          Web search.

          - `allowed_domains: Array<string> | null`

            Allowed search domains, or `null` when the search is unrestricted.

            `minItems: 0`, `maxItems: 2000`

          - `context_size: "low" | "medium" | "high"`

            The amount of search context made available to the model. Defaults to `medium`.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `location: Location | null`

            Approximate location used to localize search results, if provided.

            - `city: string | null`

              The city name.

              `minLength: 0`

            - `country: string | null`

              The two-letter ISO country code, such as `US`.

              `minLength: 0`

            - `region: string | null`

              The region or state name.

              `minLength: 0`

            - `timezone: string | null`

              The IANA timezone, such as `America/Los_Angeles`.

              `minLength: 0`

          - `mode: "disabled" | "cached" | "live"`

            The source used for web search results.

            - `"disabled"`

            - `"cached"`

            - `"live"`

          - `type: "web_search"`

            The type of the object. Always `web_search`.

            - `"web_search"`

        - `AgentToolResourceComputerUse`

          Browser use in an OpenAI-hosted session.

          - `include_screenshots: boolean`

            Whether computer tool outputs include screenshots.

          - `type: "computer_use"`

            The type of the object. Always `computer_use`.

            - `"computer_use"`

        - `AgentToolResourceAutomations`

          Lets the agent manage its own scheduled wakeups.

          - `type: "automations"`

            The type of the object. Always `automations`.

            - `"automations"`

      - `compaction?: Compaction`

        The effective context compaction settings.

        - `async: boolean`

          Whether context is compacted in the background. Defaults to true.

      - `experimental?: Experimental`

        The effective experimental settings for the agent.

        - `time_awareness: boolean`

          Whether the model receives periodic current-time reminders.

    - `agent_id: string | null`

      The saved agent reference, or null when an inline agent is configured.

      `minLength: 0`

    - `environment: AutomationEnvironment`

      Configuration or references used to select the execution environment.

      - `AutomationEnvironmentResourceNone`

        - `type: "none"`

          The type of the object. Always `none`.

          - `"none"`

      - `AutomationEnvironmentResourceOpenAIHosted`

        Hosted environment selection with confidential setup commands and variables omitted.

        - `capability_directories: Array<string> | null`

          Directory overrides, or null to inherit the template or creation default.

          `minItems: 0`, `maxItems: 2000`

        - `container_size: "small" | "medium" | "large" | null`

          The configured container size, or null to use the creation default.

          - `"small"`

          - `"medium"`

          - `"large"`

        - `desktop: Desktop | null`

          Desktop overrides, or null to inherit the template or creation default.

          - `enabled: boolean`

            Whether the environment provisions a desktop and browser proxy.

        - `environment_id: string | null`

          An existing environment reference, or null when provisioning a new environment.

          `minLength: 0`

        - `environment_template_id: string | null`

          A template reference, or null when no template is selected.

          `minLength: 0`

        - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

          File overrides, excluding contents, or null to inherit.

          `minItems: 0`, `maxItems: 2000`

          - `HostedTemplateFileResourceFileID`

            A project-scoped Files API reference resolved separately for each session.

            - `file_id: string`

              The ID of the uploaded file.

              `minLength: 0`

            - `path: string`

              The file's absolute path inside the environment.

              `minLength: 0`

            - `type: "file_id"`

              The type of the object. Always `file_id`.

              - `"file_id"`

          - `HostedTemplateFileResourceInline`

            Metadata for confidential inline file contents.

            - `path: string`

              The file's absolute path inside the environment.

              `minLength: 0`

            - `size_bytes: number`

              The decoded size of the inline file in bytes.

              `format: int64`, `minimum: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `network: Network | null`

          Network overrides, or null to inherit the template or creation default.

          - `access: "enabled" | "disabled" | "restricted"`

            The environment's network access mode.

            - `"enabled"`

              Allows unrestricted network access.

            - `"disabled"`

              Disables network access.

            - `"restricted"`

              Applies the configured domain restrictions.

          - `allowed_domains: Array<string>`

            Domains the environment may access when network access is restricted.

            `minItems: 0`, `maxItems: 2000`

        - `packages: Packages | null`

          Package overrides, or null to inherit the template or creation default.

          - `npm: Array<string>`

            npm packages installed globally in the environment.

            `minItems: 0`, `maxItems: 16384`

          - `python: Array<string>`

            Python packages installed in the environment.

            `minItems: 0`, `maxItems: 16384`

          - `system: Array<string>`

            System packages installed in the environment.

            `minItems: 0`, `maxItems: 16384`

        - `plugins: Array<HostedPlugin> | null`

          Plugin overrides, excluding archive contents, or null to inherit.

          `minItems: 0`, `maxItems: 2000`

          - `description: string`

            The installed plugin description.

            `minLength: 0`

          - `name: string`

            The installed plugin name.

            `minLength: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

        - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

          Skill overrides, excluding archive contents, or null to inherit.

          `minItems: 0`, `maxItems: 2000`

          - `HostedTemplateSkillResourceSkillReference`

            A skill resolved afresh from the Skills API whenever a session starts.

            - `skill_id: string`

              The referenced skill ID.

              `minLength: 0`

            - `type: "skill_reference"`

              The type of the object. Always `skill_reference`.

              - `"skill_reference"`

            - `version: string | null`

              The requested version selector, including `latest`.

              `minLength: 0`

          - `HostedTemplateSkillResourceInline`

            Safe metadata for an inline skill archive.

            - `description: string`

              The skill description declared in `SKILL.md`.

              `minLength: 0`

            - `name: string`

              The skill name declared in `SKILL.md`.

              `minLength: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `type: "openai_hosted"`

          The type of the object. Always `openai_hosted`.

          - `"openai_hosted"`

      - `AutomationEnvironmentResourceSelfHosted`

        - `capability_directories: Array<string>`

          Directories that expose capabilities to the agent.

          `minItems: 0`, `maxItems: 2000`

        - `environment_id: string | null`

          An existing registration, or null to create a session-owned environment.

          `minLength: 0`

        - `type: "self_hosted"`

          The type of the object. Always `self_hosted`.

          - `"self_hosted"`

        - `workspace_directory: string`

          The absolute project directory in the environment.

          `minLength: 0`

    - `input: Array<Input>`

      Initial input delivered to each new session.

      `minItems: 0`, `maxItems: 2000`

      - `content: Array<InputContent>`

        The content of the message.

        `minItems: 0`, `maxItems: 2000`

        - `InputContentResourceInputText`

          Text input recorded in a session item.

          - `text: string`

            The text supplied to the agent.

            `minLength: 0`

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputContentResourceInputImage`

          Image input recorded in a session item.

          - `image_url: string`

            The URL of the image supplied to the agent, which may be a base64-encoded data URL.

            `minLength: 0`

          - `type: "input_image"`

            The type of the object. Always `input_image`.

            - `"input_image"`

      - `role: "user"`

        The role of the message author. Always `user`.

        - `"user"`

      - `type: "message"`

        The type of the input item. Always `message`.

        - `"message"`

    - `metadata: Record<string, string>`

      Metadata attached to each new session.

    - `type: "new_session"`

      The type of the object. Always `new_session`.

      - `"new_session"`

    - `vault_ids: Array<string>`

      Vaults made available to each new session.

      `minItems: 0`, `maxItems: 2000`

  - `AutomationTargetResourceExistingSession`

    - `instructions: string`

      Saved instructions delivered as an automation notification.

      `minLength: 0`

    - `session_id: string`

      The session receiving each invocation.

      `minLength: 0`

    - `type: "existing_session"`

      The type of the object. Always `existing_session`.

      - `"existing_session"`

### Automation Target Param

- `AutomationTargetParam = AutomationTargetParamNewSession | AutomationTargetParamExistingSession`

  The session an automation invocation targets.

  - `AutomationTargetParamNewSession`

    Create a session for each invocation.

    - `environment: EnvironmentParam`

      The execution environment for each new session.

      - `EnvironmentParamNone`

        Runs the agent without an execution environment.

        - `type: "none"`

          The type of the object. Always `none`.

          - `"none"`

      - `EnvironmentParamOpenAIHosted`

        An existing OpenAI-hosted environment or new inline/template-based hosted configuration.

        - `type: "openai_hosted"`

          The type of the object. Always `openai_hosted`.

          - `"openai_hosted"`

        - `capability_directories?: Array<string> | null`

          Directories that contain capabilities exposed to the agent. Defaults to an empty list.

          `minItems: 0`, `maxItems: 16384`

        - `container_size?: "small" | "medium" | "large"`

          The hosted container size. Omission selects the medium tier.

          - `"small"`

          - `"medium"`

          - `"large"`

        - `desktop?: Desktop | null`

          Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled.

          - `enabled: boolean`

            Whether to provision the desktop and its browser proxy.

        - `env?: Record<string, string> | null`

          Environment variables made available to the agent.

        - `environment_id?: string`

          An existing prewarmed environment. Cannot be combined with a template or inline configuration.

          `minLength: 9`, `maxLength: 256`

        - `environment_template_id?: string`

          A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy.

          `minLength: 0`, `maxLength: 64`

        - `files?: Array<HostedEnvironmentFileParam> | null`

          Files available before the agent starts. Defaults to an empty list.

          `minItems: 0`, `maxItems: 50`

          - `HostedEnvironmentFileParamFileID`

            A file previously uploaded through the OpenAI Files API.

            - `file_id: string`

              The ID of the uploaded file.

              `minLength: 1`, `maxLength: 256`

            - `path: string`

              The absolute destination path inside `/workspace`.

              `minLength: 1`, `maxLength: 4096`

            - `type: "file_id"`

              The type of the object. Always `file_id`.

              - `"file_id"`

          - `HostedEnvironmentFileParamInline`

            A file supplied directly as standard-base64 data.

            - `data: string`

              The standard-base64-encoded file contents.

              `minLength: 0`, `maxLength: 6990508`

            - `path: string`

              The absolute destination path inside `/workspace`.

              `minLength: 1`, `maxLength: 4096`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `network?: Network | null`

          Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled.

          - `access: "enabled" | "disabled" | "restricted"`

            The environment's network access mode.

            - `"enabled"`

              Allows unrestricted network access.

            - `"disabled"`

              Disables network access.

            - `"restricted"`

              Applies the configured domain restrictions.

          - `allowed_domains?: Array<string> | null`

            Domains the environment may access when network access is restricted.

            `minItems: 0`, `maxItems: 16384`

          - `blocked_domains?: Array<string> | null`

            Domains blocked for both executor and browser when access is restricted. A nonempty list requires `access: restricted` and cannot be combined with nonempty `allowed_domains`. Wildcard domains are not supported.

            `minItems: 0`, `maxItems: 100`

        - `packages?: Packages | null`

          Packages to install in the environment. Defaults to empty package lists.

          - `npm?: Array<string> | null`

            npm packages to install globally. Defaults to an empty list.

            `minItems: 0`, `maxItems: 16384`

          - `python?: Array<string> | null`

            Python packages to install. Defaults to an empty list.

            `minItems: 0`, `maxItems: 16384`

          - `system?: Array<string> | null`

            System packages to install. Defaults to an empty list.

            `minItems: 0`, `maxItems: 16384`

        - `plugins?: Array<HostedPluginParam> | null`

          Plugins provided as inline ZIP archives. Defaults to an empty list.

          `minItems: 0`, `maxItems: 32`

          - `description: string`

            The plugin description declared in `.codex-plugin/plugin.json`.

            `minLength: 0`, `maxLength: 1048576`

          - `name: string`

            The plugin name declared in `.codex-plugin/plugin.json`.

            `minLength: 1`, `maxLength: 64`

          - `source: InlineCapabilitySourceParam`

            Provides ZIP bytes encoded with standard base64.

            - `data: string`

              Standard-base64 encoded ZIP archive bytes.

              `minLength: 1`, `maxLength: 70254592`

            - `media_type: "application/zip"`

              The archive media type, always `application/zip`.

              - `"application/zip"`

            - `type: "base64"`

              The type of the object. Always `base64`.

              - `"base64"`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

        - `setup_commands?: Array<SetupCommandParam> | null`

          Ordered, confidential setup commands. Command bodies are never returned.

          `minItems: 0`, `maxItems: 16`

          - `command: string`

            The shell command to execute.

            `minLength: 0`, `maxLength: 65536`

          - `cwd?: string | null`

            The absolute working directory. Defaults to `/workspace`.

            `minLength: 0`, `maxLength: 4096`

        - `skills?: Array<HostedSkillParam> | null`

          Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.

          `minItems: 0`, `maxItems: 200`

          - `HostedSkillParamSkillReference`

            References a skill uploaded through the Skills API.

            - `skill_id: string`

              The ID of the skill created through `/v1/skills`.

              `minLength: 1`, `maxLength: 64`

            - `type: "skill_reference"`

              The type of the object. Always `skill_reference`.

              - `"skill_reference"`

            - `version?: string | null`

              The skill version, a positive integer or `latest`; omission selects the default.

              `minLength: 0`, `maxLength: 1048576`

          - `HostedSkillParamInline`

            Supplies a skill ZIP directly in the session request.

            - `description: string`

              The skill description declared in `SKILL.md`.

              `minLength: 0`, `maxLength: 1048576`

            - `name: string`

              The skill name declared in `SKILL.md`.

              `minLength: 1`, `maxLength: 64`

            - `source: InlineCapabilitySourceParam`

              Provides ZIP bytes encoded with standard base64.

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

      - `EnvironmentParamSelfHosted`

        An application-hosted environment configured inline.

        - `type: "self_hosted"`

          The type of the object. Always `self_hosted`.

          - `"self_hosted"`

        - `workspace_directory: string`

          Absolute project directory inside the self-hosted environment.

          `minLength: 0`, `maxLength: 1048576`

        - `capability_directories?: Array<string> | null`

          Directories that contain capabilities exposed to the agent. Defaults to an empty list.

          `minItems: 0`, `maxItems: 16384`

    - `input: Array<AgentSessionInputMessageParam>`

      Initial user messages submitted with each new session.

      `minItems: 0`, `maxItems: 16384`

      - `content: Array<InputContentParam>`

        The content of the message.

        `minItems: 0`, `maxItems: 16384`

        - `InputContentParamInputText`

          Text input to the model.

          - `text: string`

            The text sent to the model.

            `minLength: 0`, `maxLength: 1048576`

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputContentParamInputImage`

          Image input to the model.

          - `image_url: string`

            The URL of the image sent to the model.

            `minLength: 0`, `maxLength: 1048576`

          - `type: "input_image"`

            The type of the object. Always `input_image`.

            - `"input_image"`

      - `role: "user"`

        The role of the message author. Always `user`.

        - `"user"`

      - `type?: "message"`

        The type of the input item. Always `message`.

        - `"message"`

    - `type: "new_session"`

      The type of the object. Always `new_session`.

      - `"new_session"`

    - `agent?: Agent`

      Inline agent configuration. Provide exactly one of agent and agent_id.

      - `compaction?: Compaction | null`

        Context compaction settings. Omit to keep the current settings. A supplied object replaces the settings; null or an empty object enables background compaction.

        - `async?: boolean | null`

          Whether to compact context in the background. Omission or null defaults to true. Set to false to use blocking compaction. Background compaction may increase token usage.

      - `experimental?: Experimental`

        Experimental settings to merge by key. Omitted settings keep their current values.

        - `time_awareness?: boolean`

          Whether to give the model periodic current-time reminders. Omit to keep the current setting.

      - `instructions?: string | null`

        Additional instructions appended to the agent's default base instructions. Omit to leave unchanged.

        `minLength: 0`, `maxLength: 1048576`

      - `model?: string`

        The model to use for the agent. The requested model name is preserved.

        `minLength: 0`, `maxLength: 1048576`

      - `multi_agent?: MultiAgentConfigParam | null`

        Configuration for creating and coordinating subagents.

        - `enabled: boolean`

          Whether subagent tools are enabled.

        - `max_concurrent_subagents?: number`

          Maximum number of subagents that may run concurrently. Defaults to 6.

          `format: int64`, `minimum: 1`, `maximum: 4294967295`

      - `reasoning?: AgentReasoningParam | null`

        Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort.

        - `effort?: "none" | "minimal" | "low" | 4 more | null`

          The amount of reasoning effort the model should use. Omission lets the model select it.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

        - `summary?: "concise" | "detailed" | "auto" | null`

          Controls whether the response includes a reasoning summary.

          - `"concise"`

            Returns a concise reasoning summary when supported.

          - `"detailed"`

            Returns a detailed reasoning summary when supported.

          - `"auto"`

            Automatically selects the most detailed summary supported by the model.

      - `service_tier?: "auto" | "default" | "flex" | 3 more | null`

        The service tier used for model requests.

        - `"auto"`

          Selects the service tier automatically.

        - `"default"`

          Uses the default service tier.

        - `"flex"`

          Uses the flex service tier.

        - `"priority"`

          Uses the priority service tier.

        - `"fast"`

          Uses the fast service tier.

        - `"ultrafast"`

          Uses the ultrafast service tier.

      - `text?: AgentTextParam | null`

        Configuration for text generated by the agent.

        - `format?: TextFormatParam | null`

          The output format. Omission uses ordinary text (`{"type": "text"}`).

          - `TextFormatParamText`

            Generates ordinary text without a structured-output constraint.

            - `type: "text"`

              The type of the object. Always `text`.

              - `"text"`

          - `TextFormatParamJSONSchema`

            Constrains generated text to a JSON Schema.

            - `schema: Record<string, unknown>`

              The JSON Schema that generated text must match.

            - `type: "json_schema"`

              The type of the object. Always `json_schema`.

              - `"json_schema"`

        - `verbosity?: "low" | "medium" | "high" | null`

          The amount of text the model should produce. Defaults to `medium`, matching Responses.

          - `"low"`

            Produces less text.

          - `"medium"`

            Uses the default amount of text.

          - `"high"`

            Produces more text.

      - `tools?: Array<AgentToolParam> | null`

        Tools available to the agent. Omit to inherit, or pass null to clear them. The resolved tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON.

        `minItems: 0`, `maxItems: 16384`

        - `AgentToolConfigParamFunction`

          A function defined by the application.

          - `description: string`

            A description of what the function does.

            `minLength: 0`, `maxLength: 1048576`

          - `name: string`

            The name of the function.

            `minLength: 0`, `maxLength: 1048576`

          - `parameters: Record<string, unknown>`

            A JSON Schema object describing the function's arguments.

          - `type: "function"`

            The type of the object. Always `function`.

            - `"function"`

          - `async?: boolean`

            Whether the agent continues without waiting for the function result. Defaults to `false`.

          - `defer_loading?: boolean`

            Whether this function is deferred and discovered through tool search. Defaults to `false`.

        - `AgentToolConfigParamToolSearch`

          Discovers deferred function tools and loads them into the model context.

          - `type: "tool_search"`

            The type of the object. Always `tool_search`.

            - `"tool_search"`

        - `AgentToolConfigParamProgrammaticToolCalling`

          Enables calling tools from model-generated code.

          - `type: "programmatic_tool_calling"`

            The type of the object. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

          - `enabled?: boolean`

            Whether tools can be called from model-generated code. Defaults to `true`.

        - `AgentToolConfigParamMcp`

          Tools provided by a remote MCP server.

          - `server_label: string`

            A label used to identify the MCP server in tool calls.

            `minLength: 0`, `maxLength: 1048576`

          - `transport: McpTransportParam`

            The transport used to connect to the MCP server.

            - `McpTransportConfigParamHTTP`

              Connects to an MCP server over HTTP.

              - `server_url: string`

                The URL of the MCP server.

                `minLength: 0`, `maxLength: 1048576`

              - `type: "http"`

                The type of the object. Always `http`.

                - `"http"`

              - `authorization?: string | null`

                The authorization value sent to the MCP server, if any.

                `minLength: 0`, `maxLength: 1048576`

              - `headers?: Record<string, string> | null`

                Additional HTTP headers sent to the MCP server.

            - `McpTransportConfigParamStdio`

              Starts an MCP server as a local process.

              - `command: string`

                The command used to start the MCP server.

                `minLength: 0`, `maxLength: 1048576`

              - `cwd: string`

                The working directory used to start the MCP server.

                `minLength: 0`, `maxLength: 1048576`

              - `type: "stdio"`

                The type of the object. Always `stdio`.

                - `"stdio"`

              - `args?: Array<string> | null`

                Arguments passed to the MCP server command.

                `minItems: 0`, `maxItems: 16384`

              - `env?: Record<string, string> | null`

                Environment variables set for the MCP server process.

              - `env_vars?: Array<string> | null`

                Environment variable names to inherit from the selected execution environment.

                `minItems: 0`, `maxItems: 16384`

          - `type: "mcp"`

            The type of the object. Always `mcp`.

            - `"mcp"`

          - `allowed_tools?: Array<string> | null`

            The MCP tools the agent may call. All server tools are allowed when omitted.

            `minItems: 0`, `maxItems: 16384`

          - `connection_origin?: "service" | "environment" | null`

            Selects where outbound MCP HTTP connections originate. Omitted or `service` uses the Managed Agents service network; `environment` uses the session's selected environment.

            - `"service"`

              Uses the Managed Agents service network.

            - `"environment"`

              Uses the session's execution environment.

          - `credential_id?: string | null`

            The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL.

            `minLength: 0`, `maxLength: 1048576`

          - `request_metadata?: Record<string, unknown> | null`

            Metadata included with requests to this MCP server.

          - `required?: boolean`

            Whether this MCP server must initialize before the first turn. Defaults to `false`.

        - `AgentToolConfigParamWebSearch`

          Web search.

          - `type: "web_search"`

            The type of the object. Always `web_search`.

            - `"web_search"`

          - `allowed_domains?: Array<string> | null`

            Domains the search may include.

            `minItems: 0`, `maxItems: 16384`

          - `context_size?: "low" | "medium" | "high" | null`

            The amount of search context made available to the model. Defaults to `medium`.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `location?: Location | null`

            Approximate location used to localize search results.

            - `city?: string | null`

              The city name.

              `minLength: 0`, `maxLength: 1048576`

            - `country?: string | null`

              The two-letter ISO country code, such as `US`.

              `minLength: 0`, `maxLength: 1048576`

            - `region?: string | null`

              The region or state name.

              `minLength: 0`, `maxLength: 1048576`

            - `timezone?: string | null`

              The IANA timezone, such as `America/Los_Angeles`.

              `minLength: 0`, `maxLength: 1048576`

          - `mode?: "disabled" | "cached" | "live" | null`

            The source used for web search results. Defaults to `live`.

            - `"disabled"`

              Disables web search.

            - `"cached"`

              Uses cached search results.

            - `"live"`

              Searches the live web.

        - `AgentToolConfigParamComputerUse`

          Browser use in an OpenAI-hosted session.

          - `type: "computer_use"`

            The type of the object. Always `computer_use`.

            - `"computer_use"`

          - `include_screenshots?: boolean`

            Whether computer tool outputs include screenshots. Defaults to `false`.

        - `AgentToolConfigParamAutomations`

          Lets the agent manage its own scheduled wakeups.

          - `type: "automations"`

            The type of the object. Always `automations`.

            - `"automations"`

    - `agent_id?: string`

      A saved agent ID. Provide exactly one of agent and agent_id.

      `minLength: 0`, `maxLength: 64`

    - `metadata?: Record<string, string> | null`

      Metadata attached to each new session.

    - `vault_ids?: Array<string> | null`

      The IDs of vaults made available to each new session.

      `minItems: 0`, `maxItems: 16384`

  - `AutomationTargetParamExistingSession`

    Deliver instructions to an existing session.

    - `instructions: string`

      Instructions delivered as an automation notification.

      `minLength: 0`, `maxLength: 1048576`

    - `session_id: string`

      The session receiving each invocation.

      `minLength: 0`, `maxLength: 1048576`

    - `type: "existing_session"`

      The type of the object. Always `existing_session`.

      - `"existing_session"`

### One Time Automation

- `OneTimeAutomation`

  Fields shared by periodic and one-time automations.

  - `id: string`

    The automation ID.

    `minLength: 0`

  - `created_at: number`

    The creation time as a Unix timestamp in seconds.

    `format: int64`

  - `created_by: AutomationCreatedBy`

    Service-recorded provenance; callers cannot supply this field.

    - `AutomationCreatedByResourceDeveloper`

      - `type: "developer"`

        The type of the object. Always `developer`.

        - `"developer"`

    - `AutomationCreatedByResourceAgent`

      - `session_id: string`

        The creator session, which is also the automation's target.

        `minLength: 0`

      - `tool_call_id: string`

        The tool call that created the automation.

        `minLength: 0`

      - `type: "agent"`

        The type of the object. Always `agent`.

        - `"agent"`

  - `metadata: Record<string, string>`

    Custom string key-value pairs attached to the automation.

  - `name: string`

    The automation's display name.

    `minLength: 0`

  - `object: "agent.automation"`

    Always `agent.automation`.

    - `"agent.automation"`

  - `run_at: number`

    The Unix timestamp, in seconds, of the scheduled occurrence.

    `format: int64`

  - `status: "active" | "paused" | "completed"`

    Completion means the schedule has finished, not the agent's work.

    - `"active"`

    - `"paused"`

    - `"completed"`

  - `target: AutomationTarget`

    The session configuration or existing session receiving invocations.

    - `AutomationTargetResourceNewSession`

      - `agent: AutomationAgentConfig | null`

        The inline agent configuration, or null when agent_id is configured.

        - `instructions: string | null`

          Custom instructions, or null when absent.

          `minLength: 0`

        - `model: string`

          The requested model name.

          `minLength: 0`

        - `multi_agent: MultiAgentConfig`

          The configuration for creating and coordinating subagents.

          - `enabled: boolean`

            Whether subagent tools are enabled. Defaults to false.

          - `max_concurrent_subagents: number | null`

            Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

            `format: int64`, `minimum: 1`, `maximum: 4294967295`

        - `reasoning: AgentReasoning`

          The configured reasoning policy.

          - `effort: "none" | "minimal" | "low" | 4 more | null`

            The requested reasoning effort, or `null` when the model selects its own default.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

          - `summary: "concise" | "detailed" | "auto" | null`

            The requested reasoning summary format, or `null` when summaries are disabled.

            - `"concise"`

              Returns a concise reasoning summary when supported.

            - `"detailed"`

              Returns a detailed reasoning summary when supported.

            - `"auto"`

              Automatically selects the most detailed summary supported by the model.

        - `service_tier: "auto" | "default" | "flex" | 3 more`

          The configured service-tier policy.

          - `"auto"`

          - `"default"`

          - `"flex"`

          - `"priority"`

          - `"fast"`

          - `"ultrafast"`

        - `text: AgentText`

          The configured output format and verbosity.

          - `format: TextFormat`

            The effective output format. Defaults to ordinary text.

            - `TextFormatResourceText`

              Generates ordinary text without a structured-output constraint.

              - `type: "text"`

                The type of the object. Always `text`.

                - `"text"`

            - `TextFormatResourceJSONSchema`

              Constrains generated text to a JSON Schema.

              - `schema: Record<string, unknown>`

                The JSON Schema that generated text must match.

              - `type: "json_schema"`

                The type of the object. Always `json_schema`.

                - `"json_schema"`

          - `verbosity: "low" | "medium" | "high"`

            The amount of text produced by the agent. Defaults to `medium`.

            - `"low"`

            - `"medium"`

            - `"high"`

        - `tools: Array<AgentTool>`

          Configured tools, excluding confidential credentials.

          `minItems: 0`, `maxItems: 2000`

          - `AgentToolResourceFunction`

            A function defined by the application.

            - `defer_loading: boolean`

              Whether the function is deferred and discovered through tool search.

            - `description: string`

              A description of what the function does.

              `minLength: 0`

            - `name: string`

              The name of the function.

              `minLength: 0`

            - `parameters: Record<string, unknown>`

              A JSON Schema object describing the function's arguments.

            - `type: "function"`

              The type of the object. Always `function`.

              - `"function"`

            - `async?: boolean`

              Whether the agent continues without waiting for the function result.

          - `AgentToolResourceProgrammaticToolCalling`

            Enables calling tools from model-generated code.

            - `enabled: boolean`

              Whether tools can be called from model-generated code.

            - `type: "programmatic_tool_calling"`

              The type of the object. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `AgentToolResourceMcp`

            Tools provided by a remote MCP server.

            - `allowed_tools: Array<string> | null`

              The MCP tools the agent may call.

              `minItems: 0`, `maxItems: 2000`

            - `connection_origin: "service" | "environment"`

              Where outbound MCP HTTP connections originate.

              - `"service"`

              - `"environment"`

            - `credential_id: string | null`

              The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

              `minLength: 0`

            - `request_metadata: Record<string, unknown>`

              Metadata included with requests to this MCP server.

            - `required: boolean`

              Whether this MCP server must initialize before the first turn.

            - `server_label: string`

              A label used to identify the MCP server in tool calls.

              `minLength: 0`

            - `transport: McpTransport`

              The transport used to connect to the MCP server.

              - `McpTransportResourceHTTP`

                Connects to an MCP server over HTTP.

                - `server_url: string`

                  The URL of the MCP server.

                  `minLength: 0`

                - `type: "http"`

                  The type of the object. Always `http`.

                  - `"http"`

              - `McpTransportResourceStdio`

                Starts an MCP server as a local process.

                - `args: Array<string>`

                  Arguments passed to the MCP server command.

                  `minItems: 0`, `maxItems: 2000`

                - `command: string`

                  The command used to start the MCP server.

                  `minLength: 0`

                - `cwd: string`

                  The working directory used to start the MCP server.

                  `minLength: 0`

                - `env_vars: Array<string>`

                  Environment variable names inherited from the execution environment.

                  `minItems: 0`, `maxItems: 2000`

                - `type: "stdio"`

                  The type of the object. Always `stdio`.

                  - `"stdio"`

            - `type: "mcp"`

              The type of the object. Always `mcp`.

              - `"mcp"`

          - `AgentToolResourceWebSearch`

            Web search.

            - `allowed_domains: Array<string> | null`

              Allowed search domains, or `null` when the search is unrestricted.

              `minItems: 0`, `maxItems: 2000`

            - `context_size: "low" | "medium" | "high"`

              The amount of search context made available to the model. Defaults to `medium`.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `location: Location | null`

              Approximate location used to localize search results, if provided.

              - `city: string | null`

                The city name.

                `minLength: 0`

              - `country: string | null`

                The two-letter ISO country code, such as `US`.

                `minLength: 0`

              - `region: string | null`

                The region or state name.

                `minLength: 0`

              - `timezone: string | null`

                The IANA timezone, such as `America/Los_Angeles`.

                `minLength: 0`

            - `mode: "disabled" | "cached" | "live"`

              The source used for web search results.

              - `"disabled"`

              - `"cached"`

              - `"live"`

            - `type: "web_search"`

              The type of the object. Always `web_search`.

              - `"web_search"`

          - `AgentToolResourceComputerUse`

            Browser use in an OpenAI-hosted session.

            - `include_screenshots: boolean`

              Whether computer tool outputs include screenshots.

            - `type: "computer_use"`

              The type of the object. Always `computer_use`.

              - `"computer_use"`

          - `AgentToolResourceAutomations`

            Lets the agent manage its own scheduled wakeups.

            - `type: "automations"`

              The type of the object. Always `automations`.

              - `"automations"`

        - `compaction?: Compaction`

          The effective context compaction settings.

          - `async: boolean`

            Whether context is compacted in the background. Defaults to true.

        - `experimental?: Experimental`

          The effective experimental settings for the agent.

          - `time_awareness: boolean`

            Whether the model receives periodic current-time reminders.

      - `agent_id: string | null`

        The saved agent reference, or null when an inline agent is configured.

        `minLength: 0`

      - `environment: AutomationEnvironment`

        Configuration or references used to select the execution environment.

        - `AutomationEnvironmentResourceNone`

          - `type: "none"`

            The type of the object. Always `none`.

            - `"none"`

        - `AutomationEnvironmentResourceOpenAIHosted`

          Hosted environment selection with confidential setup commands and variables omitted.

          - `capability_directories: Array<string> | null`

            Directory overrides, or null to inherit the template or creation default.

            `minItems: 0`, `maxItems: 2000`

          - `container_size: "small" | "medium" | "large" | null`

            The configured container size, or null to use the creation default.

            - `"small"`

            - `"medium"`

            - `"large"`

          - `desktop: Desktop | null`

            Desktop overrides, or null to inherit the template or creation default.

            - `enabled: boolean`

              Whether the environment provisions a desktop and browser proxy.

          - `environment_id: string | null`

            An existing environment reference, or null when provisioning a new environment.

            `minLength: 0`

          - `environment_template_id: string | null`

            A template reference, or null when no template is selected.

            `minLength: 0`

          - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

            File overrides, excluding contents, or null to inherit.

            `minItems: 0`, `maxItems: 2000`

            - `HostedTemplateFileResourceFileID`

              A project-scoped Files API reference resolved separately for each session.

              - `file_id: string`

                The ID of the uploaded file.

                `minLength: 0`

              - `path: string`

                The file's absolute path inside the environment.

                `minLength: 0`

              - `type: "file_id"`

                The type of the object. Always `file_id`.

                - `"file_id"`

            - `HostedTemplateFileResourceInline`

              Metadata for confidential inline file contents.

              - `path: string`

                The file's absolute path inside the environment.

                `minLength: 0`

              - `size_bytes: number`

                The decoded size of the inline file in bytes.

                `format: int64`, `minimum: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

          - `network: Network | null`

            Network overrides, or null to inherit the template or creation default.

            - `access: "enabled" | "disabled" | "restricted"`

              The environment's network access mode.

              - `"enabled"`

                Allows unrestricted network access.

              - `"disabled"`

                Disables network access.

              - `"restricted"`

                Applies the configured domain restrictions.

            - `allowed_domains: Array<string>`

              Domains the environment may access when network access is restricted.

              `minItems: 0`, `maxItems: 2000`

          - `packages: Packages | null`

            Package overrides, or null to inherit the template or creation default.

            - `npm: Array<string>`

              npm packages installed globally in the environment.

              `minItems: 0`, `maxItems: 16384`

            - `python: Array<string>`

              Python packages installed in the environment.

              `minItems: 0`, `maxItems: 16384`

            - `system: Array<string>`

              System packages installed in the environment.

              `minItems: 0`, `maxItems: 16384`

          - `plugins: Array<HostedPlugin> | null`

            Plugin overrides, excluding archive contents, or null to inherit.

            `minItems: 0`, `maxItems: 2000`

            - `description: string`

              The installed plugin description.

              `minLength: 0`

            - `name: string`

              The installed plugin name.

              `minLength: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

          - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

            Skill overrides, excluding archive contents, or null to inherit.

            `minItems: 0`, `maxItems: 2000`

            - `HostedTemplateSkillResourceSkillReference`

              A skill resolved afresh from the Skills API whenever a session starts.

              - `skill_id: string`

                The referenced skill ID.

                `minLength: 0`

              - `type: "skill_reference"`

                The type of the object. Always `skill_reference`.

                - `"skill_reference"`

              - `version: string | null`

                The requested version selector, including `latest`.

                `minLength: 0`

            - `HostedTemplateSkillResourceInline`

              Safe metadata for an inline skill archive.

              - `description: string`

                The skill description declared in `SKILL.md`.

                `minLength: 0`

              - `name: string`

                The skill name declared in `SKILL.md`.

                `minLength: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

          - `type: "openai_hosted"`

            The type of the object. Always `openai_hosted`.

            - `"openai_hosted"`

        - `AutomationEnvironmentResourceSelfHosted`

          - `capability_directories: Array<string>`

            Directories that expose capabilities to the agent.

            `minItems: 0`, `maxItems: 2000`

          - `environment_id: string | null`

            An existing registration, or null to create a session-owned environment.

            `minLength: 0`

          - `type: "self_hosted"`

            The type of the object. Always `self_hosted`.

            - `"self_hosted"`

          - `workspace_directory: string`

            The absolute project directory in the environment.

            `minLength: 0`

      - `input: Array<Input>`

        Initial input delivered to each new session.

        `minItems: 0`, `maxItems: 2000`

        - `content: Array<InputContent>`

          The content of the message.

          `minItems: 0`, `maxItems: 2000`

          - `InputContentResourceInputText`

            Text input recorded in a session item.

            - `text: string`

              The text supplied to the agent.

              `minLength: 0`

            - `type: "input_text"`

              The type of the object. Always `input_text`.

              - `"input_text"`

          - `InputContentResourceInputImage`

            Image input recorded in a session item.

            - `image_url: string`

              The URL of the image supplied to the agent, which may be a base64-encoded data URL.

              `minLength: 0`

            - `type: "input_image"`

              The type of the object. Always `input_image`.

              - `"input_image"`

        - `role: "user"`

          The role of the message author. Always `user`.

          - `"user"`

        - `type: "message"`

          The type of the input item. Always `message`.

          - `"message"`

      - `metadata: Record<string, string>`

        Metadata attached to each new session.

      - `type: "new_session"`

        The type of the object. Always `new_session`.

        - `"new_session"`

      - `vault_ids: Array<string>`

        Vaults made available to each new session.

        `minItems: 0`, `maxItems: 2000`

    - `AutomationTargetResourceExistingSession`

      - `instructions: string`

        Saved instructions delivered as an automation notification.

        `minLength: 0`

      - `session_id: string`

        The session receiving each invocation.

        `minLength: 0`

      - `type: "existing_session"`

        The type of the object. Always `existing_session`.

        - `"existing_session"`

  - `type: "once"`

    The type of the object. Always `once`.

    - `"once"`

### Periodic Automation

- `PeriodicAutomation`

  Fields shared by periodic and one-time automations.

  - `id: string`

    The automation ID.

    `minLength: 0`

  - `created_at: number`

    The creation time as a Unix timestamp in seconds.

    `format: int64`

  - `created_by: AutomationCreatedBy`

    Service-recorded provenance; callers cannot supply this field.

    - `AutomationCreatedByResourceDeveloper`

      - `type: "developer"`

        The type of the object. Always `developer`.

        - `"developer"`

    - `AutomationCreatedByResourceAgent`

      - `session_id: string`

        The creator session, which is also the automation's target.

        `minLength: 0`

      - `tool_call_id: string`

        The tool call that created the automation.

        `minLength: 0`

      - `type: "agent"`

        The type of the object. Always `agent`.

        - `"agent"`

  - `expression: string`

    The cron expression determining scheduled occurrences.

    `minLength: 0`

  - `metadata: Record<string, string>`

    Custom string key-value pairs attached to the automation.

  - `name: string`

    The automation's display name.

    `minLength: 0`

  - `object: "agent.automation"`

    Always `agent.automation`.

    - `"agent.automation"`

  - `status: "active" | "paused"`

    Whether scheduled delivery is active or paused.

    - `"active"`

    - `"paused"`

  - `target: AutomationTarget`

    The session configuration or existing session receiving invocations.

    - `AutomationTargetResourceNewSession`

      - `agent: AutomationAgentConfig | null`

        The inline agent configuration, or null when agent_id is configured.

        - `instructions: string | null`

          Custom instructions, or null when absent.

          `minLength: 0`

        - `model: string`

          The requested model name.

          `minLength: 0`

        - `multi_agent: MultiAgentConfig`

          The configuration for creating and coordinating subagents.

          - `enabled: boolean`

            Whether subagent tools are enabled. Defaults to false.

          - `max_concurrent_subagents: number | null`

            Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

            `format: int64`, `minimum: 1`, `maximum: 4294967295`

        - `reasoning: AgentReasoning`

          The configured reasoning policy.

          - `effort: "none" | "minimal" | "low" | 4 more | null`

            The requested reasoning effort, or `null` when the model selects its own default.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

          - `summary: "concise" | "detailed" | "auto" | null`

            The requested reasoning summary format, or `null` when summaries are disabled.

            - `"concise"`

              Returns a concise reasoning summary when supported.

            - `"detailed"`

              Returns a detailed reasoning summary when supported.

            - `"auto"`

              Automatically selects the most detailed summary supported by the model.

        - `service_tier: "auto" | "default" | "flex" | 3 more`

          The configured service-tier policy.

          - `"auto"`

          - `"default"`

          - `"flex"`

          - `"priority"`

          - `"fast"`

          - `"ultrafast"`

        - `text: AgentText`

          The configured output format and verbosity.

          - `format: TextFormat`

            The effective output format. Defaults to ordinary text.

            - `TextFormatResourceText`

              Generates ordinary text without a structured-output constraint.

              - `type: "text"`

                The type of the object. Always `text`.

                - `"text"`

            - `TextFormatResourceJSONSchema`

              Constrains generated text to a JSON Schema.

              - `schema: Record<string, unknown>`

                The JSON Schema that generated text must match.

              - `type: "json_schema"`

                The type of the object. Always `json_schema`.

                - `"json_schema"`

          - `verbosity: "low" | "medium" | "high"`

            The amount of text produced by the agent. Defaults to `medium`.

            - `"low"`

            - `"medium"`

            - `"high"`

        - `tools: Array<AgentTool>`

          Configured tools, excluding confidential credentials.

          `minItems: 0`, `maxItems: 2000`

          - `AgentToolResourceFunction`

            A function defined by the application.

            - `defer_loading: boolean`

              Whether the function is deferred and discovered through tool search.

            - `description: string`

              A description of what the function does.

              `minLength: 0`

            - `name: string`

              The name of the function.

              `minLength: 0`

            - `parameters: Record<string, unknown>`

              A JSON Schema object describing the function's arguments.

            - `type: "function"`

              The type of the object. Always `function`.

              - `"function"`

            - `async?: boolean`

              Whether the agent continues without waiting for the function result.

          - `AgentToolResourceProgrammaticToolCalling`

            Enables calling tools from model-generated code.

            - `enabled: boolean`

              Whether tools can be called from model-generated code.

            - `type: "programmatic_tool_calling"`

              The type of the object. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `AgentToolResourceMcp`

            Tools provided by a remote MCP server.

            - `allowed_tools: Array<string> | null`

              The MCP tools the agent may call.

              `minItems: 0`, `maxItems: 2000`

            - `connection_origin: "service" | "environment"`

              Where outbound MCP HTTP connections originate.

              - `"service"`

              - `"environment"`

            - `credential_id: string | null`

              The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

              `minLength: 0`

            - `request_metadata: Record<string, unknown>`

              Metadata included with requests to this MCP server.

            - `required: boolean`

              Whether this MCP server must initialize before the first turn.

            - `server_label: string`

              A label used to identify the MCP server in tool calls.

              `minLength: 0`

            - `transport: McpTransport`

              The transport used to connect to the MCP server.

              - `McpTransportResourceHTTP`

                Connects to an MCP server over HTTP.

                - `server_url: string`

                  The URL of the MCP server.

                  `minLength: 0`

                - `type: "http"`

                  The type of the object. Always `http`.

                  - `"http"`

              - `McpTransportResourceStdio`

                Starts an MCP server as a local process.

                - `args: Array<string>`

                  Arguments passed to the MCP server command.

                  `minItems: 0`, `maxItems: 2000`

                - `command: string`

                  The command used to start the MCP server.

                  `minLength: 0`

                - `cwd: string`

                  The working directory used to start the MCP server.

                  `minLength: 0`

                - `env_vars: Array<string>`

                  Environment variable names inherited from the execution environment.

                  `minItems: 0`, `maxItems: 2000`

                - `type: "stdio"`

                  The type of the object. Always `stdio`.

                  - `"stdio"`

            - `type: "mcp"`

              The type of the object. Always `mcp`.

              - `"mcp"`

          - `AgentToolResourceWebSearch`

            Web search.

            - `allowed_domains: Array<string> | null`

              Allowed search domains, or `null` when the search is unrestricted.

              `minItems: 0`, `maxItems: 2000`

            - `context_size: "low" | "medium" | "high"`

              The amount of search context made available to the model. Defaults to `medium`.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `location: Location | null`

              Approximate location used to localize search results, if provided.

              - `city: string | null`

                The city name.

                `minLength: 0`

              - `country: string | null`

                The two-letter ISO country code, such as `US`.

                `minLength: 0`

              - `region: string | null`

                The region or state name.

                `minLength: 0`

              - `timezone: string | null`

                The IANA timezone, such as `America/Los_Angeles`.

                `minLength: 0`

            - `mode: "disabled" | "cached" | "live"`

              The source used for web search results.

              - `"disabled"`

              - `"cached"`

              - `"live"`

            - `type: "web_search"`

              The type of the object. Always `web_search`.

              - `"web_search"`

          - `AgentToolResourceComputerUse`

            Browser use in an OpenAI-hosted session.

            - `include_screenshots: boolean`

              Whether computer tool outputs include screenshots.

            - `type: "computer_use"`

              The type of the object. Always `computer_use`.

              - `"computer_use"`

          - `AgentToolResourceAutomations`

            Lets the agent manage its own scheduled wakeups.

            - `type: "automations"`

              The type of the object. Always `automations`.

              - `"automations"`

        - `compaction?: Compaction`

          The effective context compaction settings.

          - `async: boolean`

            Whether context is compacted in the background. Defaults to true.

        - `experimental?: Experimental`

          The effective experimental settings for the agent.

          - `time_awareness: boolean`

            Whether the model receives periodic current-time reminders.

      - `agent_id: string | null`

        The saved agent reference, or null when an inline agent is configured.

        `minLength: 0`

      - `environment: AutomationEnvironment`

        Configuration or references used to select the execution environment.

        - `AutomationEnvironmentResourceNone`

          - `type: "none"`

            The type of the object. Always `none`.

            - `"none"`

        - `AutomationEnvironmentResourceOpenAIHosted`

          Hosted environment selection with confidential setup commands and variables omitted.

          - `capability_directories: Array<string> | null`

            Directory overrides, or null to inherit the template or creation default.

            `minItems: 0`, `maxItems: 2000`

          - `container_size: "small" | "medium" | "large" | null`

            The configured container size, or null to use the creation default.

            - `"small"`

            - `"medium"`

            - `"large"`

          - `desktop: Desktop | null`

            Desktop overrides, or null to inherit the template or creation default.

            - `enabled: boolean`

              Whether the environment provisions a desktop and browser proxy.

          - `environment_id: string | null`

            An existing environment reference, or null when provisioning a new environment.

            `minLength: 0`

          - `environment_template_id: string | null`

            A template reference, or null when no template is selected.

            `minLength: 0`

          - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

            File overrides, excluding contents, or null to inherit.

            `minItems: 0`, `maxItems: 2000`

            - `HostedTemplateFileResourceFileID`

              A project-scoped Files API reference resolved separately for each session.

              - `file_id: string`

                The ID of the uploaded file.

                `minLength: 0`

              - `path: string`

                The file's absolute path inside the environment.

                `minLength: 0`

              - `type: "file_id"`

                The type of the object. Always `file_id`.

                - `"file_id"`

            - `HostedTemplateFileResourceInline`

              Metadata for confidential inline file contents.

              - `path: string`

                The file's absolute path inside the environment.

                `minLength: 0`

              - `size_bytes: number`

                The decoded size of the inline file in bytes.

                `format: int64`, `minimum: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

          - `network: Network | null`

            Network overrides, or null to inherit the template or creation default.

            - `access: "enabled" | "disabled" | "restricted"`

              The environment's network access mode.

              - `"enabled"`

                Allows unrestricted network access.

              - `"disabled"`

                Disables network access.

              - `"restricted"`

                Applies the configured domain restrictions.

            - `allowed_domains: Array<string>`

              Domains the environment may access when network access is restricted.

              `minItems: 0`, `maxItems: 2000`

          - `packages: Packages | null`

            Package overrides, or null to inherit the template or creation default.

            - `npm: Array<string>`

              npm packages installed globally in the environment.

              `minItems: 0`, `maxItems: 16384`

            - `python: Array<string>`

              Python packages installed in the environment.

              `minItems: 0`, `maxItems: 16384`

            - `system: Array<string>`

              System packages installed in the environment.

              `minItems: 0`, `maxItems: 16384`

          - `plugins: Array<HostedPlugin> | null`

            Plugin overrides, excluding archive contents, or null to inherit.

            `minItems: 0`, `maxItems: 2000`

            - `description: string`

              The installed plugin description.

              `minLength: 0`

            - `name: string`

              The installed plugin name.

              `minLength: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

          - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

            Skill overrides, excluding archive contents, or null to inherit.

            `minItems: 0`, `maxItems: 2000`

            - `HostedTemplateSkillResourceSkillReference`

              A skill resolved afresh from the Skills API whenever a session starts.

              - `skill_id: string`

                The referenced skill ID.

                `minLength: 0`

              - `type: "skill_reference"`

                The type of the object. Always `skill_reference`.

                - `"skill_reference"`

              - `version: string | null`

                The requested version selector, including `latest`.

                `minLength: 0`

            - `HostedTemplateSkillResourceInline`

              Safe metadata for an inline skill archive.

              - `description: string`

                The skill description declared in `SKILL.md`.

                `minLength: 0`

              - `name: string`

                The skill name declared in `SKILL.md`.

                `minLength: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

          - `type: "openai_hosted"`

            The type of the object. Always `openai_hosted`.

            - `"openai_hosted"`

        - `AutomationEnvironmentResourceSelfHosted`

          - `capability_directories: Array<string>`

            Directories that expose capabilities to the agent.

            `minItems: 0`, `maxItems: 2000`

          - `environment_id: string | null`

            An existing registration, or null to create a session-owned environment.

            `minLength: 0`

          - `type: "self_hosted"`

            The type of the object. Always `self_hosted`.

            - `"self_hosted"`

          - `workspace_directory: string`

            The absolute project directory in the environment.

            `minLength: 0`

      - `input: Array<Input>`

        Initial input delivered to each new session.

        `minItems: 0`, `maxItems: 2000`

        - `content: Array<InputContent>`

          The content of the message.

          `minItems: 0`, `maxItems: 2000`

          - `InputContentResourceInputText`

            Text input recorded in a session item.

            - `text: string`

              The text supplied to the agent.

              `minLength: 0`

            - `type: "input_text"`

              The type of the object. Always `input_text`.

              - `"input_text"`

          - `InputContentResourceInputImage`

            Image input recorded in a session item.

            - `image_url: string`

              The URL of the image supplied to the agent, which may be a base64-encoded data URL.

              `minLength: 0`

            - `type: "input_image"`

              The type of the object. Always `input_image`.

              - `"input_image"`

        - `role: "user"`

          The role of the message author. Always `user`.

          - `"user"`

        - `type: "message"`

          The type of the input item. Always `message`.

          - `"message"`

      - `metadata: Record<string, string>`

        Metadata attached to each new session.

      - `type: "new_session"`

        The type of the object. Always `new_session`.

        - `"new_session"`

      - `vault_ids: Array<string>`

        Vaults made available to each new session.

        `minItems: 0`, `maxItems: 2000`

    - `AutomationTargetResourceExistingSession`

      - `instructions: string`

        Saved instructions delivered as an automation notification.

        `minLength: 0`

      - `session_id: string`

        The session receiving each invocation.

        `minLength: 0`

      - `type: "existing_session"`

        The type of the object. Always `existing_session`.

        - `"existing_session"`

  - `timezone: string`

    The timezone used to interpret the expression.

    `minLength: 0`

  - `type: "periodic"`

    The type of the object. Always `periodic`.

    - `"periodic"`

# Invocations

## Invoke an automation

`client.beta.agents.automations.invocations.create(stringautomationID, RequestOptionsoptions?): AutomationInvocation`

**post** `/agents/automations/{automation_id}/invocations`

Queues a manual delivery without changing the saved schedule.

### Parameters

- `automationID: string`

  `minLength: 0`, `maxLength: 1048576`

### Returns

- `AutomationInvocation`

  One attempted delivery by an automation.

  - `id: string`

    The invocation ID.

    `minLength: 0`

  - `automation_id: string`

    The automation that owns the invocation.

    `minLength: 0`

  - `created_at: number`

    The creation time as a Unix timestamp in seconds.

    `format: int64`

  - `error: Error | null`

    The permanent delivery failure, or null when no failure occurred.

    - `code: string`

      A machine-readable error code.

      `minLength: 0`

    - `message: string`

      A public explanation of the delivery failure.

      `minLength: 0`

  - `object: "agent.automation.invocation"`

    Always `agent.automation.invocation`.

    - `"agent.automation.invocation"`

  - `scheduled_at: number | null`

    The intended occurrence as a Unix timestamp in seconds, or null for manual runs.

    `format: int64`

  - `session_id: string | null`

    The target or newly created session ID, or null before one is available.

    `minLength: 0`

  - `skip_reason: "pending_delivery" | null`

    Why an occurrence was skipped, or null when it was not skipped.

    - `"pending_delivery"`

  - `source: AutomationInvocationSource`

    Whether the invocation was manual or scheduled.

    - `AutomationInvocationSourceResourceManual`

      - `type: "manual"`

        The type of the object. Always `manual`.

        - `"manual"`

    - `AutomationInvocationSourceResourceAutomation`

      - `automation: Automation`

        The automation snapshot for this occurrence, excluding confidential values.

        - `PeriodicAutomation`

          Fields shared by periodic and one-time automations.

          - `id: string`

            The automation ID.

            `minLength: 0`

          - `created_at: number`

            The creation time as a Unix timestamp in seconds.

            `format: int64`

          - `created_by: AutomationCreatedBy`

            Service-recorded provenance; callers cannot supply this field.

            - `AutomationCreatedByResourceDeveloper`

              - `type: "developer"`

                The type of the object. Always `developer`.

                - `"developer"`

            - `AutomationCreatedByResourceAgent`

              - `session_id: string`

                The creator session, which is also the automation's target.

                `minLength: 0`

              - `tool_call_id: string`

                The tool call that created the automation.

                `minLength: 0`

              - `type: "agent"`

                The type of the object. Always `agent`.

                - `"agent"`

          - `expression: string`

            The cron expression determining scheduled occurrences.

            `minLength: 0`

          - `metadata: Record<string, string>`

            Custom string key-value pairs attached to the automation.

          - `name: string`

            The automation's display name.

            `minLength: 0`

          - `object: "agent.automation"`

            Always `agent.automation`.

            - `"agent.automation"`

          - `status: "active" | "paused"`

            Whether scheduled delivery is active or paused.

            - `"active"`

            - `"paused"`

          - `target: AutomationTarget`

            The session configuration or existing session receiving invocations.

            - `AutomationTargetResourceNewSession`

              - `agent: AutomationAgentConfig | null`

                The inline agent configuration, or null when agent_id is configured.

                - `instructions: string | null`

                  Custom instructions, or null when absent.

                  `minLength: 0`

                - `model: string`

                  The requested model name.

                  `minLength: 0`

                - `multi_agent: MultiAgentConfig`

                  The configuration for creating and coordinating subagents.

                  - `enabled: boolean`

                    Whether subagent tools are enabled. Defaults to false.

                  - `max_concurrent_subagents: number | null`

                    Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

                    `format: int64`, `minimum: 1`, `maximum: 4294967295`

                - `reasoning: AgentReasoning`

                  The configured reasoning policy.

                  - `effort: "none" | "minimal" | "low" | 4 more | null`

                    The requested reasoning effort, or `null` when the model selects its own default.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

                  - `summary: "concise" | "detailed" | "auto" | null`

                    The requested reasoning summary format, or `null` when summaries are disabled.

                    - `"concise"`

                      Returns a concise reasoning summary when supported.

                    - `"detailed"`

                      Returns a detailed reasoning summary when supported.

                    - `"auto"`

                      Automatically selects the most detailed summary supported by the model.

                - `service_tier: "auto" | "default" | "flex" | 3 more`

                  The configured service-tier policy.

                  - `"auto"`

                  - `"default"`

                  - `"flex"`

                  - `"priority"`

                  - `"fast"`

                  - `"ultrafast"`

                - `text: AgentText`

                  The configured output format and verbosity.

                  - `format: TextFormat`

                    The effective output format. Defaults to ordinary text.

                    - `TextFormatResourceText`

                      Generates ordinary text without a structured-output constraint.

                      - `type: "text"`

                        The type of the object. Always `text`.

                        - `"text"`

                    - `TextFormatResourceJSONSchema`

                      Constrains generated text to a JSON Schema.

                      - `schema: Record<string, unknown>`

                        The JSON Schema that generated text must match.

                      - `type: "json_schema"`

                        The type of the object. Always `json_schema`.

                        - `"json_schema"`

                  - `verbosity: "low" | "medium" | "high"`

                    The amount of text produced by the agent. Defaults to `medium`.

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                - `tools: Array<AgentTool>`

                  Configured tools, excluding confidential credentials.

                  `minItems: 0`, `maxItems: 2000`

                  - `AgentToolResourceFunction`

                    A function defined by the application.

                    - `defer_loading: boolean`

                      Whether the function is deferred and discovered through tool search.

                    - `description: string`

                      A description of what the function does.

                      `minLength: 0`

                    - `name: string`

                      The name of the function.

                      `minLength: 0`

                    - `parameters: Record<string, unknown>`

                      A JSON Schema object describing the function's arguments.

                    - `type: "function"`

                      The type of the object. Always `function`.

                      - `"function"`

                    - `async?: boolean`

                      Whether the agent continues without waiting for the function result.

                  - `AgentToolResourceProgrammaticToolCalling`

                    Enables calling tools from model-generated code.

                    - `enabled: boolean`

                      Whether tools can be called from model-generated code.

                    - `type: "programmatic_tool_calling"`

                      The type of the object. Always `programmatic_tool_calling`.

                      - `"programmatic_tool_calling"`

                  - `AgentToolResourceMcp`

                    Tools provided by a remote MCP server.

                    - `allowed_tools: Array<string> | null`

                      The MCP tools the agent may call.

                      `minItems: 0`, `maxItems: 2000`

                    - `connection_origin: "service" | "environment"`

                      Where outbound MCP HTTP connections originate.

                      - `"service"`

                      - `"environment"`

                    - `credential_id: string | null`

                      The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

                      `minLength: 0`

                    - `request_metadata: Record<string, unknown>`

                      Metadata included with requests to this MCP server.

                    - `required: boolean`

                      Whether this MCP server must initialize before the first turn.

                    - `server_label: string`

                      A label used to identify the MCP server in tool calls.

                      `minLength: 0`

                    - `transport: McpTransport`

                      The transport used to connect to the MCP server.

                      - `McpTransportResourceHTTP`

                        Connects to an MCP server over HTTP.

                        - `server_url: string`

                          The URL of the MCP server.

                          `minLength: 0`

                        - `type: "http"`

                          The type of the object. Always `http`.

                          - `"http"`

                      - `McpTransportResourceStdio`

                        Starts an MCP server as a local process.

                        - `args: Array<string>`

                          Arguments passed to the MCP server command.

                          `minItems: 0`, `maxItems: 2000`

                        - `command: string`

                          The command used to start the MCP server.

                          `minLength: 0`

                        - `cwd: string`

                          The working directory used to start the MCP server.

                          `minLength: 0`

                        - `env_vars: Array<string>`

                          Environment variable names inherited from the execution environment.

                          `minItems: 0`, `maxItems: 2000`

                        - `type: "stdio"`

                          The type of the object. Always `stdio`.

                          - `"stdio"`

                    - `type: "mcp"`

                      The type of the object. Always `mcp`.

                      - `"mcp"`

                  - `AgentToolResourceWebSearch`

                    Web search.

                    - `allowed_domains: Array<string> | null`

                      Allowed search domains, or `null` when the search is unrestricted.

                      `minItems: 0`, `maxItems: 2000`

                    - `context_size: "low" | "medium" | "high"`

                      The amount of search context made available to the model. Defaults to `medium`.

                      - `"low"`

                      - `"medium"`

                      - `"high"`

                    - `location: Location | null`

                      Approximate location used to localize search results, if provided.

                      - `city: string | null`

                        The city name.

                        `minLength: 0`

                      - `country: string | null`

                        The two-letter ISO country code, such as `US`.

                        `minLength: 0`

                      - `region: string | null`

                        The region or state name.

                        `minLength: 0`

                      - `timezone: string | null`

                        The IANA timezone, such as `America/Los_Angeles`.

                        `minLength: 0`

                    - `mode: "disabled" | "cached" | "live"`

                      The source used for web search results.

                      - `"disabled"`

                      - `"cached"`

                      - `"live"`

                    - `type: "web_search"`

                      The type of the object. Always `web_search`.

                      - `"web_search"`

                  - `AgentToolResourceComputerUse`

                    Browser use in an OpenAI-hosted session.

                    - `include_screenshots: boolean`

                      Whether computer tool outputs include screenshots.

                    - `type: "computer_use"`

                      The type of the object. Always `computer_use`.

                      - `"computer_use"`

                  - `AgentToolResourceAutomations`

                    Lets the agent manage its own scheduled wakeups.

                    - `type: "automations"`

                      The type of the object. Always `automations`.

                      - `"automations"`

                - `compaction?: Compaction`

                  The effective context compaction settings.

                  - `async: boolean`

                    Whether context is compacted in the background. Defaults to true.

                - `experimental?: Experimental`

                  The effective experimental settings for the agent.

                  - `time_awareness: boolean`

                    Whether the model receives periodic current-time reminders.

              - `agent_id: string | null`

                The saved agent reference, or null when an inline agent is configured.

                `minLength: 0`

              - `environment: AutomationEnvironment`

                Configuration or references used to select the execution environment.

                - `AutomationEnvironmentResourceNone`

                  - `type: "none"`

                    The type of the object. Always `none`.

                    - `"none"`

                - `AutomationEnvironmentResourceOpenAIHosted`

                  Hosted environment selection with confidential setup commands and variables omitted.

                  - `capability_directories: Array<string> | null`

                    Directory overrides, or null to inherit the template or creation default.

                    `minItems: 0`, `maxItems: 2000`

                  - `container_size: "small" | "medium" | "large" | null`

                    The configured container size, or null to use the creation default.

                    - `"small"`

                    - `"medium"`

                    - `"large"`

                  - `desktop: Desktop | null`

                    Desktop overrides, or null to inherit the template or creation default.

                    - `enabled: boolean`

                      Whether the environment provisions a desktop and browser proxy.

                  - `environment_id: string | null`

                    An existing environment reference, or null when provisioning a new environment.

                    `minLength: 0`

                  - `environment_template_id: string | null`

                    A template reference, or null when no template is selected.

                    `minLength: 0`

                  - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

                    File overrides, excluding contents, or null to inherit.

                    `minItems: 0`, `maxItems: 2000`

                    - `HostedTemplateFileResourceFileID`

                      A project-scoped Files API reference resolved separately for each session.

                      - `file_id: string`

                        The ID of the uploaded file.

                        `minLength: 0`

                      - `path: string`

                        The file's absolute path inside the environment.

                        `minLength: 0`

                      - `type: "file_id"`

                        The type of the object. Always `file_id`.

                        - `"file_id"`

                    - `HostedTemplateFileResourceInline`

                      Metadata for confidential inline file contents.

                      - `path: string`

                        The file's absolute path inside the environment.

                        `minLength: 0`

                      - `size_bytes: number`

                        The decoded size of the inline file in bytes.

                        `format: int64`, `minimum: 0`

                      - `type: "inline"`

                        The type of the object. Always `inline`.

                        - `"inline"`

                  - `network: Network | null`

                    Network overrides, or null to inherit the template or creation default.

                    - `access: "enabled" | "disabled" | "restricted"`

                      The environment's network access mode.

                      - `"enabled"`

                        Allows unrestricted network access.

                      - `"disabled"`

                        Disables network access.

                      - `"restricted"`

                        Applies the configured domain restrictions.

                    - `allowed_domains: Array<string>`

                      Domains the environment may access when network access is restricted.

                      `minItems: 0`, `maxItems: 2000`

                  - `packages: Packages | null`

                    Package overrides, or null to inherit the template or creation default.

                    - `npm: Array<string>`

                      npm packages installed globally in the environment.

                      `minItems: 0`, `maxItems: 16384`

                    - `python: Array<string>`

                      Python packages installed in the environment.

                      `minItems: 0`, `maxItems: 16384`

                    - `system: Array<string>`

                      System packages installed in the environment.

                      `minItems: 0`, `maxItems: 16384`

                  - `plugins: Array<HostedPlugin> | null`

                    Plugin overrides, excluding archive contents, or null to inherit.

                    `minItems: 0`, `maxItems: 2000`

                    - `description: string`

                      The installed plugin description.

                      `minLength: 0`

                    - `name: string`

                      The installed plugin name.

                      `minLength: 0`

                    - `type: "inline"`

                      The type of the object. Always `inline`.

                      - `"inline"`

                  - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

                    Skill overrides, excluding archive contents, or null to inherit.

                    `minItems: 0`, `maxItems: 2000`

                    - `HostedTemplateSkillResourceSkillReference`

                      A skill resolved afresh from the Skills API whenever a session starts.

                      - `skill_id: string`

                        The referenced skill ID.

                        `minLength: 0`

                      - `type: "skill_reference"`

                        The type of the object. Always `skill_reference`.

                        - `"skill_reference"`

                      - `version: string | null`

                        The requested version selector, including `latest`.

                        `minLength: 0`

                    - `HostedTemplateSkillResourceInline`

                      Safe metadata for an inline skill archive.

                      - `description: string`

                        The skill description declared in `SKILL.md`.

                        `minLength: 0`

                      - `name: string`

                        The skill name declared in `SKILL.md`.

                        `minLength: 0`

                      - `type: "inline"`

                        The type of the object. Always `inline`.

                        - `"inline"`

                  - `type: "openai_hosted"`

                    The type of the object. Always `openai_hosted`.

                    - `"openai_hosted"`

                - `AutomationEnvironmentResourceSelfHosted`

                  - `capability_directories: Array<string>`

                    Directories that expose capabilities to the agent.

                    `minItems: 0`, `maxItems: 2000`

                  - `environment_id: string | null`

                    An existing registration, or null to create a session-owned environment.

                    `minLength: 0`

                  - `type: "self_hosted"`

                    The type of the object. Always `self_hosted`.

                    - `"self_hosted"`

                  - `workspace_directory: string`

                    The absolute project directory in the environment.

                    `minLength: 0`

              - `input: Array<Input>`

                Initial input delivered to each new session.

                `minItems: 0`, `maxItems: 2000`

                - `content: Array<InputContent>`

                  The content of the message.

                  `minItems: 0`, `maxItems: 2000`

                  - `InputContentResourceInputText`

                    Text input recorded in a session item.

                    - `text: string`

                      The text supplied to the agent.

                      `minLength: 0`

                    - `type: "input_text"`

                      The type of the object. Always `input_text`.

                      - `"input_text"`

                  - `InputContentResourceInputImage`

                    Image input recorded in a session item.

                    - `image_url: string`

                      The URL of the image supplied to the agent, which may be a base64-encoded data URL.

                      `minLength: 0`

                    - `type: "input_image"`

                      The type of the object. Always `input_image`.

                      - `"input_image"`

                - `role: "user"`

                  The role of the message author. Always `user`.

                  - `"user"`

                - `type: "message"`

                  The type of the input item. Always `message`.

                  - `"message"`

              - `metadata: Record<string, string>`

                Metadata attached to each new session.

              - `type: "new_session"`

                The type of the object. Always `new_session`.

                - `"new_session"`

              - `vault_ids: Array<string>`

                Vaults made available to each new session.

                `minItems: 0`, `maxItems: 2000`

            - `AutomationTargetResourceExistingSession`

              - `instructions: string`

                Saved instructions delivered as an automation notification.

                `minLength: 0`

              - `session_id: string`

                The session receiving each invocation.

                `minLength: 0`

              - `type: "existing_session"`

                The type of the object. Always `existing_session`.

                - `"existing_session"`

          - `timezone: string`

            The timezone used to interpret the expression.

            `minLength: 0`

          - `type: "periodic"`

            The type of the object. Always `periodic`.

            - `"periodic"`

        - `OneTimeAutomation`

          Fields shared by periodic and one-time automations.

          - `id: string`

            The automation ID.

            `minLength: 0`

          - `created_at: number`

            The creation time as a Unix timestamp in seconds.

            `format: int64`

          - `created_by: AutomationCreatedBy`

            Service-recorded provenance; callers cannot supply this field.

          - `metadata: Record<string, string>`

            Custom string key-value pairs attached to the automation.

          - `name: string`

            The automation's display name.

            `minLength: 0`

          - `object: "agent.automation"`

            Always `agent.automation`.

            - `"agent.automation"`

          - `run_at: number`

            The Unix timestamp, in seconds, of the scheduled occurrence.

            `format: int64`

          - `status: "active" | "paused" | "completed"`

            Completion means the schedule has finished, not the agent's work.

            - `"active"`

            - `"paused"`

            - `"completed"`

          - `target: AutomationTarget`

            The session configuration or existing session receiving invocations.

          - `type: "once"`

            The type of the object. Always `once`.

            - `"once"`

      - `type: "automation"`

        The type of the object. Always `automation`.

        - `"automation"`

  - `status: "queued" | "completed" | "failed" | "skipped"`

    Delivery status; completed does not mean the agent's work has finished.

    - `"queued"`

    - `"completed"`

    - `"failed"`

    - `"skipped"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const automationInvocation = await client.beta.agents.automations.invocations.create(
  'automation_id',
);

console.log(automationInvocation.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "automation_id": "automation_id",
  "created_at": 0,
  "error": {
    "code": "code",
    "message": "message"
  },
  "object": "agent.automation.invocation",
  "scheduled_at": 0,
  "session_id": "session_id",
  "skip_reason": "pending_delivery",
  "source": {
    "type": "manual"
  },
  "status": "queued"
}
```

## List automation invocations

`client.beta.agents.automations.invocations.list(stringautomationID, InvocationListParamsquery?, RequestOptionsoptions?): CursorPage<AutomationInvocation>`

**get** `/agents/automations/{automation_id}/invocations`

Lists delivery records for a project-owned automation.

### Parameters

- `automationID: string`

  `minLength: 0`, `maxLength: 1048576`

- `query: InvocationListParams`

  - `after?: string`

    Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

### Returns

- `AutomationInvocation`

  One attempted delivery by an automation.

  - `id: string`

    The invocation ID.

    `minLength: 0`

  - `automation_id: string`

    The automation that owns the invocation.

    `minLength: 0`

  - `created_at: number`

    The creation time as a Unix timestamp in seconds.

    `format: int64`

  - `error: Error | null`

    The permanent delivery failure, or null when no failure occurred.

    - `code: string`

      A machine-readable error code.

      `minLength: 0`

    - `message: string`

      A public explanation of the delivery failure.

      `minLength: 0`

  - `object: "agent.automation.invocation"`

    Always `agent.automation.invocation`.

    - `"agent.automation.invocation"`

  - `scheduled_at: number | null`

    The intended occurrence as a Unix timestamp in seconds, or null for manual runs.

    `format: int64`

  - `session_id: string | null`

    The target or newly created session ID, or null before one is available.

    `minLength: 0`

  - `skip_reason: "pending_delivery" | null`

    Why an occurrence was skipped, or null when it was not skipped.

    - `"pending_delivery"`

  - `source: AutomationInvocationSource`

    Whether the invocation was manual or scheduled.

    - `AutomationInvocationSourceResourceManual`

      - `type: "manual"`

        The type of the object. Always `manual`.

        - `"manual"`

    - `AutomationInvocationSourceResourceAutomation`

      - `automation: Automation`

        The automation snapshot for this occurrence, excluding confidential values.

        - `PeriodicAutomation`

          Fields shared by periodic and one-time automations.

          - `id: string`

            The automation ID.

            `minLength: 0`

          - `created_at: number`

            The creation time as a Unix timestamp in seconds.

            `format: int64`

          - `created_by: AutomationCreatedBy`

            Service-recorded provenance; callers cannot supply this field.

            - `AutomationCreatedByResourceDeveloper`

              - `type: "developer"`

                The type of the object. Always `developer`.

                - `"developer"`

            - `AutomationCreatedByResourceAgent`

              - `session_id: string`

                The creator session, which is also the automation's target.

                `minLength: 0`

              - `tool_call_id: string`

                The tool call that created the automation.

                `minLength: 0`

              - `type: "agent"`

                The type of the object. Always `agent`.

                - `"agent"`

          - `expression: string`

            The cron expression determining scheduled occurrences.

            `minLength: 0`

          - `metadata: Record<string, string>`

            Custom string key-value pairs attached to the automation.

          - `name: string`

            The automation's display name.

            `minLength: 0`

          - `object: "agent.automation"`

            Always `agent.automation`.

            - `"agent.automation"`

          - `status: "active" | "paused"`

            Whether scheduled delivery is active or paused.

            - `"active"`

            - `"paused"`

          - `target: AutomationTarget`

            The session configuration or existing session receiving invocations.

            - `AutomationTargetResourceNewSession`

              - `agent: AutomationAgentConfig | null`

                The inline agent configuration, or null when agent_id is configured.

                - `instructions: string | null`

                  Custom instructions, or null when absent.

                  `minLength: 0`

                - `model: string`

                  The requested model name.

                  `minLength: 0`

                - `multi_agent: MultiAgentConfig`

                  The configuration for creating and coordinating subagents.

                  - `enabled: boolean`

                    Whether subagent tools are enabled. Defaults to false.

                  - `max_concurrent_subagents: number | null`

                    Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

                    `format: int64`, `minimum: 1`, `maximum: 4294967295`

                - `reasoning: AgentReasoning`

                  The configured reasoning policy.

                  - `effort: "none" | "minimal" | "low" | 4 more | null`

                    The requested reasoning effort, or `null` when the model selects its own default.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

                  - `summary: "concise" | "detailed" | "auto" | null`

                    The requested reasoning summary format, or `null` when summaries are disabled.

                    - `"concise"`

                      Returns a concise reasoning summary when supported.

                    - `"detailed"`

                      Returns a detailed reasoning summary when supported.

                    - `"auto"`

                      Automatically selects the most detailed summary supported by the model.

                - `service_tier: "auto" | "default" | "flex" | 3 more`

                  The configured service-tier policy.

                  - `"auto"`

                  - `"default"`

                  - `"flex"`

                  - `"priority"`

                  - `"fast"`

                  - `"ultrafast"`

                - `text: AgentText`

                  The configured output format and verbosity.

                  - `format: TextFormat`

                    The effective output format. Defaults to ordinary text.

                    - `TextFormatResourceText`

                      Generates ordinary text without a structured-output constraint.

                      - `type: "text"`

                        The type of the object. Always `text`.

                        - `"text"`

                    - `TextFormatResourceJSONSchema`

                      Constrains generated text to a JSON Schema.

                      - `schema: Record<string, unknown>`

                        The JSON Schema that generated text must match.

                      - `type: "json_schema"`

                        The type of the object. Always `json_schema`.

                        - `"json_schema"`

                  - `verbosity: "low" | "medium" | "high"`

                    The amount of text produced by the agent. Defaults to `medium`.

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                - `tools: Array<AgentTool>`

                  Configured tools, excluding confidential credentials.

                  `minItems: 0`, `maxItems: 2000`

                  - `AgentToolResourceFunction`

                    A function defined by the application.

                    - `defer_loading: boolean`

                      Whether the function is deferred and discovered through tool search.

                    - `description: string`

                      A description of what the function does.

                      `minLength: 0`

                    - `name: string`

                      The name of the function.

                      `minLength: 0`

                    - `parameters: Record<string, unknown>`

                      A JSON Schema object describing the function's arguments.

                    - `type: "function"`

                      The type of the object. Always `function`.

                      - `"function"`

                    - `async?: boolean`

                      Whether the agent continues without waiting for the function result.

                  - `AgentToolResourceProgrammaticToolCalling`

                    Enables calling tools from model-generated code.

                    - `enabled: boolean`

                      Whether tools can be called from model-generated code.

                    - `type: "programmatic_tool_calling"`

                      The type of the object. Always `programmatic_tool_calling`.

                      - `"programmatic_tool_calling"`

                  - `AgentToolResourceMcp`

                    Tools provided by a remote MCP server.

                    - `allowed_tools: Array<string> | null`

                      The MCP tools the agent may call.

                      `minItems: 0`, `maxItems: 2000`

                    - `connection_origin: "service" | "environment"`

                      Where outbound MCP HTTP connections originate.

                      - `"service"`

                      - `"environment"`

                    - `credential_id: string | null`

                      The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

                      `minLength: 0`

                    - `request_metadata: Record<string, unknown>`

                      Metadata included with requests to this MCP server.

                    - `required: boolean`

                      Whether this MCP server must initialize before the first turn.

                    - `server_label: string`

                      A label used to identify the MCP server in tool calls.

                      `minLength: 0`

                    - `transport: McpTransport`

                      The transport used to connect to the MCP server.

                      - `McpTransportResourceHTTP`

                        Connects to an MCP server over HTTP.

                        - `server_url: string`

                          The URL of the MCP server.

                          `minLength: 0`

                        - `type: "http"`

                          The type of the object. Always `http`.

                          - `"http"`

                      - `McpTransportResourceStdio`

                        Starts an MCP server as a local process.

                        - `args: Array<string>`

                          Arguments passed to the MCP server command.

                          `minItems: 0`, `maxItems: 2000`

                        - `command: string`

                          The command used to start the MCP server.

                          `minLength: 0`

                        - `cwd: string`

                          The working directory used to start the MCP server.

                          `minLength: 0`

                        - `env_vars: Array<string>`

                          Environment variable names inherited from the execution environment.

                          `minItems: 0`, `maxItems: 2000`

                        - `type: "stdio"`

                          The type of the object. Always `stdio`.

                          - `"stdio"`

                    - `type: "mcp"`

                      The type of the object. Always `mcp`.

                      - `"mcp"`

                  - `AgentToolResourceWebSearch`

                    Web search.

                    - `allowed_domains: Array<string> | null`

                      Allowed search domains, or `null` when the search is unrestricted.

                      `minItems: 0`, `maxItems: 2000`

                    - `context_size: "low" | "medium" | "high"`

                      The amount of search context made available to the model. Defaults to `medium`.

                      - `"low"`

                      - `"medium"`

                      - `"high"`

                    - `location: Location | null`

                      Approximate location used to localize search results, if provided.

                      - `city: string | null`

                        The city name.

                        `minLength: 0`

                      - `country: string | null`

                        The two-letter ISO country code, such as `US`.

                        `minLength: 0`

                      - `region: string | null`

                        The region or state name.

                        `minLength: 0`

                      - `timezone: string | null`

                        The IANA timezone, such as `America/Los_Angeles`.

                        `minLength: 0`

                    - `mode: "disabled" | "cached" | "live"`

                      The source used for web search results.

                      - `"disabled"`

                      - `"cached"`

                      - `"live"`

                    - `type: "web_search"`

                      The type of the object. Always `web_search`.

                      - `"web_search"`

                  - `AgentToolResourceComputerUse`

                    Browser use in an OpenAI-hosted session.

                    - `include_screenshots: boolean`

                      Whether computer tool outputs include screenshots.

                    - `type: "computer_use"`

                      The type of the object. Always `computer_use`.

                      - `"computer_use"`

                  - `AgentToolResourceAutomations`

                    Lets the agent manage its own scheduled wakeups.

                    - `type: "automations"`

                      The type of the object. Always `automations`.

                      - `"automations"`

                - `compaction?: Compaction`

                  The effective context compaction settings.

                  - `async: boolean`

                    Whether context is compacted in the background. Defaults to true.

                - `experimental?: Experimental`

                  The effective experimental settings for the agent.

                  - `time_awareness: boolean`

                    Whether the model receives periodic current-time reminders.

              - `agent_id: string | null`

                The saved agent reference, or null when an inline agent is configured.

                `minLength: 0`

              - `environment: AutomationEnvironment`

                Configuration or references used to select the execution environment.

                - `AutomationEnvironmentResourceNone`

                  - `type: "none"`

                    The type of the object. Always `none`.

                    - `"none"`

                - `AutomationEnvironmentResourceOpenAIHosted`

                  Hosted environment selection with confidential setup commands and variables omitted.

                  - `capability_directories: Array<string> | null`

                    Directory overrides, or null to inherit the template or creation default.

                    `minItems: 0`, `maxItems: 2000`

                  - `container_size: "small" | "medium" | "large" | null`

                    The configured container size, or null to use the creation default.

                    - `"small"`

                    - `"medium"`

                    - `"large"`

                  - `desktop: Desktop | null`

                    Desktop overrides, or null to inherit the template or creation default.

                    - `enabled: boolean`

                      Whether the environment provisions a desktop and browser proxy.

                  - `environment_id: string | null`

                    An existing environment reference, or null when provisioning a new environment.

                    `minLength: 0`

                  - `environment_template_id: string | null`

                    A template reference, or null when no template is selected.

                    `minLength: 0`

                  - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

                    File overrides, excluding contents, or null to inherit.

                    `minItems: 0`, `maxItems: 2000`

                    - `HostedTemplateFileResourceFileID`

                      A project-scoped Files API reference resolved separately for each session.

                      - `file_id: string`

                        The ID of the uploaded file.

                        `minLength: 0`

                      - `path: string`

                        The file's absolute path inside the environment.

                        `minLength: 0`

                      - `type: "file_id"`

                        The type of the object. Always `file_id`.

                        - `"file_id"`

                    - `HostedTemplateFileResourceInline`

                      Metadata for confidential inline file contents.

                      - `path: string`

                        The file's absolute path inside the environment.

                        `minLength: 0`

                      - `size_bytes: number`

                        The decoded size of the inline file in bytes.

                        `format: int64`, `minimum: 0`

                      - `type: "inline"`

                        The type of the object. Always `inline`.

                        - `"inline"`

                  - `network: Network | null`

                    Network overrides, or null to inherit the template or creation default.

                    - `access: "enabled" | "disabled" | "restricted"`

                      The environment's network access mode.

                      - `"enabled"`

                        Allows unrestricted network access.

                      - `"disabled"`

                        Disables network access.

                      - `"restricted"`

                        Applies the configured domain restrictions.

                    - `allowed_domains: Array<string>`

                      Domains the environment may access when network access is restricted.

                      `minItems: 0`, `maxItems: 2000`

                  - `packages: Packages | null`

                    Package overrides, or null to inherit the template or creation default.

                    - `npm: Array<string>`

                      npm packages installed globally in the environment.

                      `minItems: 0`, `maxItems: 16384`

                    - `python: Array<string>`

                      Python packages installed in the environment.

                      `minItems: 0`, `maxItems: 16384`

                    - `system: Array<string>`

                      System packages installed in the environment.

                      `minItems: 0`, `maxItems: 16384`

                  - `plugins: Array<HostedPlugin> | null`

                    Plugin overrides, excluding archive contents, or null to inherit.

                    `minItems: 0`, `maxItems: 2000`

                    - `description: string`

                      The installed plugin description.

                      `minLength: 0`

                    - `name: string`

                      The installed plugin name.

                      `minLength: 0`

                    - `type: "inline"`

                      The type of the object. Always `inline`.

                      - `"inline"`

                  - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

                    Skill overrides, excluding archive contents, or null to inherit.

                    `minItems: 0`, `maxItems: 2000`

                    - `HostedTemplateSkillResourceSkillReference`

                      A skill resolved afresh from the Skills API whenever a session starts.

                      - `skill_id: string`

                        The referenced skill ID.

                        `minLength: 0`

                      - `type: "skill_reference"`

                        The type of the object. Always `skill_reference`.

                        - `"skill_reference"`

                      - `version: string | null`

                        The requested version selector, including `latest`.

                        `minLength: 0`

                    - `HostedTemplateSkillResourceInline`

                      Safe metadata for an inline skill archive.

                      - `description: string`

                        The skill description declared in `SKILL.md`.

                        `minLength: 0`

                      - `name: string`

                        The skill name declared in `SKILL.md`.

                        `minLength: 0`

                      - `type: "inline"`

                        The type of the object. Always `inline`.

                        - `"inline"`

                  - `type: "openai_hosted"`

                    The type of the object. Always `openai_hosted`.

                    - `"openai_hosted"`

                - `AutomationEnvironmentResourceSelfHosted`

                  - `capability_directories: Array<string>`

                    Directories that expose capabilities to the agent.

                    `minItems: 0`, `maxItems: 2000`

                  - `environment_id: string | null`

                    An existing registration, or null to create a session-owned environment.

                    `minLength: 0`

                  - `type: "self_hosted"`

                    The type of the object. Always `self_hosted`.

                    - `"self_hosted"`

                  - `workspace_directory: string`

                    The absolute project directory in the environment.

                    `minLength: 0`

              - `input: Array<Input>`

                Initial input delivered to each new session.

                `minItems: 0`, `maxItems: 2000`

                - `content: Array<InputContent>`

                  The content of the message.

                  `minItems: 0`, `maxItems: 2000`

                  - `InputContentResourceInputText`

                    Text input recorded in a session item.

                    - `text: string`

                      The text supplied to the agent.

                      `minLength: 0`

                    - `type: "input_text"`

                      The type of the object. Always `input_text`.

                      - `"input_text"`

                  - `InputContentResourceInputImage`

                    Image input recorded in a session item.

                    - `image_url: string`

                      The URL of the image supplied to the agent, which may be a base64-encoded data URL.

                      `minLength: 0`

                    - `type: "input_image"`

                      The type of the object. Always `input_image`.

                      - `"input_image"`

                - `role: "user"`

                  The role of the message author. Always `user`.

                  - `"user"`

                - `type: "message"`

                  The type of the input item. Always `message`.

                  - `"message"`

              - `metadata: Record<string, string>`

                Metadata attached to each new session.

              - `type: "new_session"`

                The type of the object. Always `new_session`.

                - `"new_session"`

              - `vault_ids: Array<string>`

                Vaults made available to each new session.

                `minItems: 0`, `maxItems: 2000`

            - `AutomationTargetResourceExistingSession`

              - `instructions: string`

                Saved instructions delivered as an automation notification.

                `minLength: 0`

              - `session_id: string`

                The session receiving each invocation.

                `minLength: 0`

              - `type: "existing_session"`

                The type of the object. Always `existing_session`.

                - `"existing_session"`

          - `timezone: string`

            The timezone used to interpret the expression.

            `minLength: 0`

          - `type: "periodic"`

            The type of the object. Always `periodic`.

            - `"periodic"`

        - `OneTimeAutomation`

          Fields shared by periodic and one-time automations.

          - `id: string`

            The automation ID.

            `minLength: 0`

          - `created_at: number`

            The creation time as a Unix timestamp in seconds.

            `format: int64`

          - `created_by: AutomationCreatedBy`

            Service-recorded provenance; callers cannot supply this field.

          - `metadata: Record<string, string>`

            Custom string key-value pairs attached to the automation.

          - `name: string`

            The automation's display name.

            `minLength: 0`

          - `object: "agent.automation"`

            Always `agent.automation`.

            - `"agent.automation"`

          - `run_at: number`

            The Unix timestamp, in seconds, of the scheduled occurrence.

            `format: int64`

          - `status: "active" | "paused" | "completed"`

            Completion means the schedule has finished, not the agent's work.

            - `"active"`

            - `"paused"`

            - `"completed"`

          - `target: AutomationTarget`

            The session configuration or existing session receiving invocations.

          - `type: "once"`

            The type of the object. Always `once`.

            - `"once"`

      - `type: "automation"`

        The type of the object. Always `automation`.

        - `"automation"`

  - `status: "queued" | "completed" | "failed" | "skipped"`

    Delivery status; completed does not mean the agent's work has finished.

    - `"queued"`

    - `"completed"`

    - `"failed"`

    - `"skipped"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const automationInvocation of client.beta.agents.automations.invocations.list(
  'automation_id',
)) {
  console.log(automationInvocation.id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "automation_id": "automation_id",
      "created_at": 0,
      "error": {
        "code": "code",
        "message": "message"
      },
      "object": "agent.automation.invocation",
      "scheduled_at": 0,
      "session_id": "session_id",
      "skip_reason": "pending_delivery",
      "source": {
        "type": "manual"
      },
      "status": "queued"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Get an automation invocation

`client.beta.agents.automations.invocations.retrieve(stringinvocationID, InvocationRetrieveParamsparams, RequestOptionsoptions?): AutomationInvocation`

**get** `/agents/automations/{automation_id}/invocations/{invocation_id}`

Retrieves a delivery record for a project-owned automation.

### Parameters

- `invocationID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: InvocationRetrieveParams`

  - `automation_id: string`

    `minLength: 0`, `maxLength: 1048576`

### Returns

- `AutomationInvocation`

  One attempted delivery by an automation.

  - `id: string`

    The invocation ID.

    `minLength: 0`

  - `automation_id: string`

    The automation that owns the invocation.

    `minLength: 0`

  - `created_at: number`

    The creation time as a Unix timestamp in seconds.

    `format: int64`

  - `error: Error | null`

    The permanent delivery failure, or null when no failure occurred.

    - `code: string`

      A machine-readable error code.

      `minLength: 0`

    - `message: string`

      A public explanation of the delivery failure.

      `minLength: 0`

  - `object: "agent.automation.invocation"`

    Always `agent.automation.invocation`.

    - `"agent.automation.invocation"`

  - `scheduled_at: number | null`

    The intended occurrence as a Unix timestamp in seconds, or null for manual runs.

    `format: int64`

  - `session_id: string | null`

    The target or newly created session ID, or null before one is available.

    `minLength: 0`

  - `skip_reason: "pending_delivery" | null`

    Why an occurrence was skipped, or null when it was not skipped.

    - `"pending_delivery"`

  - `source: AutomationInvocationSource`

    Whether the invocation was manual or scheduled.

    - `AutomationInvocationSourceResourceManual`

      - `type: "manual"`

        The type of the object. Always `manual`.

        - `"manual"`

    - `AutomationInvocationSourceResourceAutomation`

      - `automation: Automation`

        The automation snapshot for this occurrence, excluding confidential values.

        - `PeriodicAutomation`

          Fields shared by periodic and one-time automations.

          - `id: string`

            The automation ID.

            `minLength: 0`

          - `created_at: number`

            The creation time as a Unix timestamp in seconds.

            `format: int64`

          - `created_by: AutomationCreatedBy`

            Service-recorded provenance; callers cannot supply this field.

            - `AutomationCreatedByResourceDeveloper`

              - `type: "developer"`

                The type of the object. Always `developer`.

                - `"developer"`

            - `AutomationCreatedByResourceAgent`

              - `session_id: string`

                The creator session, which is also the automation's target.

                `minLength: 0`

              - `tool_call_id: string`

                The tool call that created the automation.

                `minLength: 0`

              - `type: "agent"`

                The type of the object. Always `agent`.

                - `"agent"`

          - `expression: string`

            The cron expression determining scheduled occurrences.

            `minLength: 0`

          - `metadata: Record<string, string>`

            Custom string key-value pairs attached to the automation.

          - `name: string`

            The automation's display name.

            `minLength: 0`

          - `object: "agent.automation"`

            Always `agent.automation`.

            - `"agent.automation"`

          - `status: "active" | "paused"`

            Whether scheduled delivery is active or paused.

            - `"active"`

            - `"paused"`

          - `target: AutomationTarget`

            The session configuration or existing session receiving invocations.

            - `AutomationTargetResourceNewSession`

              - `agent: AutomationAgentConfig | null`

                The inline agent configuration, or null when agent_id is configured.

                - `instructions: string | null`

                  Custom instructions, or null when absent.

                  `minLength: 0`

                - `model: string`

                  The requested model name.

                  `minLength: 0`

                - `multi_agent: MultiAgentConfig`

                  The configuration for creating and coordinating subagents.

                  - `enabled: boolean`

                    Whether subagent tools are enabled. Defaults to false.

                  - `max_concurrent_subagents: number | null`

                    Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

                    `format: int64`, `minimum: 1`, `maximum: 4294967295`

                - `reasoning: AgentReasoning`

                  The configured reasoning policy.

                  - `effort: "none" | "minimal" | "low" | 4 more | null`

                    The requested reasoning effort, or `null` when the model selects its own default.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

                  - `summary: "concise" | "detailed" | "auto" | null`

                    The requested reasoning summary format, or `null` when summaries are disabled.

                    - `"concise"`

                      Returns a concise reasoning summary when supported.

                    - `"detailed"`

                      Returns a detailed reasoning summary when supported.

                    - `"auto"`

                      Automatically selects the most detailed summary supported by the model.

                - `service_tier: "auto" | "default" | "flex" | 3 more`

                  The configured service-tier policy.

                  - `"auto"`

                  - `"default"`

                  - `"flex"`

                  - `"priority"`

                  - `"fast"`

                  - `"ultrafast"`

                - `text: AgentText`

                  The configured output format and verbosity.

                  - `format: TextFormat`

                    The effective output format. Defaults to ordinary text.

                    - `TextFormatResourceText`

                      Generates ordinary text without a structured-output constraint.

                      - `type: "text"`

                        The type of the object. Always `text`.

                        - `"text"`

                    - `TextFormatResourceJSONSchema`

                      Constrains generated text to a JSON Schema.

                      - `schema: Record<string, unknown>`

                        The JSON Schema that generated text must match.

                      - `type: "json_schema"`

                        The type of the object. Always `json_schema`.

                        - `"json_schema"`

                  - `verbosity: "low" | "medium" | "high"`

                    The amount of text produced by the agent. Defaults to `medium`.

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                - `tools: Array<AgentTool>`

                  Configured tools, excluding confidential credentials.

                  `minItems: 0`, `maxItems: 2000`

                  - `AgentToolResourceFunction`

                    A function defined by the application.

                    - `defer_loading: boolean`

                      Whether the function is deferred and discovered through tool search.

                    - `description: string`

                      A description of what the function does.

                      `minLength: 0`

                    - `name: string`

                      The name of the function.

                      `minLength: 0`

                    - `parameters: Record<string, unknown>`

                      A JSON Schema object describing the function's arguments.

                    - `type: "function"`

                      The type of the object. Always `function`.

                      - `"function"`

                    - `async?: boolean`

                      Whether the agent continues without waiting for the function result.

                  - `AgentToolResourceProgrammaticToolCalling`

                    Enables calling tools from model-generated code.

                    - `enabled: boolean`

                      Whether tools can be called from model-generated code.

                    - `type: "programmatic_tool_calling"`

                      The type of the object. Always `programmatic_tool_calling`.

                      - `"programmatic_tool_calling"`

                  - `AgentToolResourceMcp`

                    Tools provided by a remote MCP server.

                    - `allowed_tools: Array<string> | null`

                      The MCP tools the agent may call.

                      `minItems: 0`, `maxItems: 2000`

                    - `connection_origin: "service" | "environment"`

                      Where outbound MCP HTTP connections originate.

                      - `"service"`

                      - `"environment"`

                    - `credential_id: string | null`

                      The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

                      `minLength: 0`

                    - `request_metadata: Record<string, unknown>`

                      Metadata included with requests to this MCP server.

                    - `required: boolean`

                      Whether this MCP server must initialize before the first turn.

                    - `server_label: string`

                      A label used to identify the MCP server in tool calls.

                      `minLength: 0`

                    - `transport: McpTransport`

                      The transport used to connect to the MCP server.

                      - `McpTransportResourceHTTP`

                        Connects to an MCP server over HTTP.

                        - `server_url: string`

                          The URL of the MCP server.

                          `minLength: 0`

                        - `type: "http"`

                          The type of the object. Always `http`.

                          - `"http"`

                      - `McpTransportResourceStdio`

                        Starts an MCP server as a local process.

                        - `args: Array<string>`

                          Arguments passed to the MCP server command.

                          `minItems: 0`, `maxItems: 2000`

                        - `command: string`

                          The command used to start the MCP server.

                          `minLength: 0`

                        - `cwd: string`

                          The working directory used to start the MCP server.

                          `minLength: 0`

                        - `env_vars: Array<string>`

                          Environment variable names inherited from the execution environment.

                          `minItems: 0`, `maxItems: 2000`

                        - `type: "stdio"`

                          The type of the object. Always `stdio`.

                          - `"stdio"`

                    - `type: "mcp"`

                      The type of the object. Always `mcp`.

                      - `"mcp"`

                  - `AgentToolResourceWebSearch`

                    Web search.

                    - `allowed_domains: Array<string> | null`

                      Allowed search domains, or `null` when the search is unrestricted.

                      `minItems: 0`, `maxItems: 2000`

                    - `context_size: "low" | "medium" | "high"`

                      The amount of search context made available to the model. Defaults to `medium`.

                      - `"low"`

                      - `"medium"`

                      - `"high"`

                    - `location: Location | null`

                      Approximate location used to localize search results, if provided.

                      - `city: string | null`

                        The city name.

                        `minLength: 0`

                      - `country: string | null`

                        The two-letter ISO country code, such as `US`.

                        `minLength: 0`

                      - `region: string | null`

                        The region or state name.

                        `minLength: 0`

                      - `timezone: string | null`

                        The IANA timezone, such as `America/Los_Angeles`.

                        `minLength: 0`

                    - `mode: "disabled" | "cached" | "live"`

                      The source used for web search results.

                      - `"disabled"`

                      - `"cached"`

                      - `"live"`

                    - `type: "web_search"`

                      The type of the object. Always `web_search`.

                      - `"web_search"`

                  - `AgentToolResourceComputerUse`

                    Browser use in an OpenAI-hosted session.

                    - `include_screenshots: boolean`

                      Whether computer tool outputs include screenshots.

                    - `type: "computer_use"`

                      The type of the object. Always `computer_use`.

                      - `"computer_use"`

                  - `AgentToolResourceAutomations`

                    Lets the agent manage its own scheduled wakeups.

                    - `type: "automations"`

                      The type of the object. Always `automations`.

                      - `"automations"`

                - `compaction?: Compaction`

                  The effective context compaction settings.

                  - `async: boolean`

                    Whether context is compacted in the background. Defaults to true.

                - `experimental?: Experimental`

                  The effective experimental settings for the agent.

                  - `time_awareness: boolean`

                    Whether the model receives periodic current-time reminders.

              - `agent_id: string | null`

                The saved agent reference, or null when an inline agent is configured.

                `minLength: 0`

              - `environment: AutomationEnvironment`

                Configuration or references used to select the execution environment.

                - `AutomationEnvironmentResourceNone`

                  - `type: "none"`

                    The type of the object. Always `none`.

                    - `"none"`

                - `AutomationEnvironmentResourceOpenAIHosted`

                  Hosted environment selection with confidential setup commands and variables omitted.

                  - `capability_directories: Array<string> | null`

                    Directory overrides, or null to inherit the template or creation default.

                    `minItems: 0`, `maxItems: 2000`

                  - `container_size: "small" | "medium" | "large" | null`

                    The configured container size, or null to use the creation default.

                    - `"small"`

                    - `"medium"`

                    - `"large"`

                  - `desktop: Desktop | null`

                    Desktop overrides, or null to inherit the template or creation default.

                    - `enabled: boolean`

                      Whether the environment provisions a desktop and browser proxy.

                  - `environment_id: string | null`

                    An existing environment reference, or null when provisioning a new environment.

                    `minLength: 0`

                  - `environment_template_id: string | null`

                    A template reference, or null when no template is selected.

                    `minLength: 0`

                  - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

                    File overrides, excluding contents, or null to inherit.

                    `minItems: 0`, `maxItems: 2000`

                    - `HostedTemplateFileResourceFileID`

                      A project-scoped Files API reference resolved separately for each session.

                      - `file_id: string`

                        The ID of the uploaded file.

                        `minLength: 0`

                      - `path: string`

                        The file's absolute path inside the environment.

                        `minLength: 0`

                      - `type: "file_id"`

                        The type of the object. Always `file_id`.

                        - `"file_id"`

                    - `HostedTemplateFileResourceInline`

                      Metadata for confidential inline file contents.

                      - `path: string`

                        The file's absolute path inside the environment.

                        `minLength: 0`

                      - `size_bytes: number`

                        The decoded size of the inline file in bytes.

                        `format: int64`, `minimum: 0`

                      - `type: "inline"`

                        The type of the object. Always `inline`.

                        - `"inline"`

                  - `network: Network | null`

                    Network overrides, or null to inherit the template or creation default.

                    - `access: "enabled" | "disabled" | "restricted"`

                      The environment's network access mode.

                      - `"enabled"`

                        Allows unrestricted network access.

                      - `"disabled"`

                        Disables network access.

                      - `"restricted"`

                        Applies the configured domain restrictions.

                    - `allowed_domains: Array<string>`

                      Domains the environment may access when network access is restricted.

                      `minItems: 0`, `maxItems: 2000`

                  - `packages: Packages | null`

                    Package overrides, or null to inherit the template or creation default.

                    - `npm: Array<string>`

                      npm packages installed globally in the environment.

                      `minItems: 0`, `maxItems: 16384`

                    - `python: Array<string>`

                      Python packages installed in the environment.

                      `minItems: 0`, `maxItems: 16384`

                    - `system: Array<string>`

                      System packages installed in the environment.

                      `minItems: 0`, `maxItems: 16384`

                  - `plugins: Array<HostedPlugin> | null`

                    Plugin overrides, excluding archive contents, or null to inherit.

                    `minItems: 0`, `maxItems: 2000`

                    - `description: string`

                      The installed plugin description.

                      `minLength: 0`

                    - `name: string`

                      The installed plugin name.

                      `minLength: 0`

                    - `type: "inline"`

                      The type of the object. Always `inline`.

                      - `"inline"`

                  - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

                    Skill overrides, excluding archive contents, or null to inherit.

                    `minItems: 0`, `maxItems: 2000`

                    - `HostedTemplateSkillResourceSkillReference`

                      A skill resolved afresh from the Skills API whenever a session starts.

                      - `skill_id: string`

                        The referenced skill ID.

                        `minLength: 0`

                      - `type: "skill_reference"`

                        The type of the object. Always `skill_reference`.

                        - `"skill_reference"`

                      - `version: string | null`

                        The requested version selector, including `latest`.

                        `minLength: 0`

                    - `HostedTemplateSkillResourceInline`

                      Safe metadata for an inline skill archive.

                      - `description: string`

                        The skill description declared in `SKILL.md`.

                        `minLength: 0`

                      - `name: string`

                        The skill name declared in `SKILL.md`.

                        `minLength: 0`

                      - `type: "inline"`

                        The type of the object. Always `inline`.

                        - `"inline"`

                  - `type: "openai_hosted"`

                    The type of the object. Always `openai_hosted`.

                    - `"openai_hosted"`

                - `AutomationEnvironmentResourceSelfHosted`

                  - `capability_directories: Array<string>`

                    Directories that expose capabilities to the agent.

                    `minItems: 0`, `maxItems: 2000`

                  - `environment_id: string | null`

                    An existing registration, or null to create a session-owned environment.

                    `minLength: 0`

                  - `type: "self_hosted"`

                    The type of the object. Always `self_hosted`.

                    - `"self_hosted"`

                  - `workspace_directory: string`

                    The absolute project directory in the environment.

                    `minLength: 0`

              - `input: Array<Input>`

                Initial input delivered to each new session.

                `minItems: 0`, `maxItems: 2000`

                - `content: Array<InputContent>`

                  The content of the message.

                  `minItems: 0`, `maxItems: 2000`

                  - `InputContentResourceInputText`

                    Text input recorded in a session item.

                    - `text: string`

                      The text supplied to the agent.

                      `minLength: 0`

                    - `type: "input_text"`

                      The type of the object. Always `input_text`.

                      - `"input_text"`

                  - `InputContentResourceInputImage`

                    Image input recorded in a session item.

                    - `image_url: string`

                      The URL of the image supplied to the agent, which may be a base64-encoded data URL.

                      `minLength: 0`

                    - `type: "input_image"`

                      The type of the object. Always `input_image`.

                      - `"input_image"`

                - `role: "user"`

                  The role of the message author. Always `user`.

                  - `"user"`

                - `type: "message"`

                  The type of the input item. Always `message`.

                  - `"message"`

              - `metadata: Record<string, string>`

                Metadata attached to each new session.

              - `type: "new_session"`

                The type of the object. Always `new_session`.

                - `"new_session"`

              - `vault_ids: Array<string>`

                Vaults made available to each new session.

                `minItems: 0`, `maxItems: 2000`

            - `AutomationTargetResourceExistingSession`

              - `instructions: string`

                Saved instructions delivered as an automation notification.

                `minLength: 0`

              - `session_id: string`

                The session receiving each invocation.

                `minLength: 0`

              - `type: "existing_session"`

                The type of the object. Always `existing_session`.

                - `"existing_session"`

          - `timezone: string`

            The timezone used to interpret the expression.

            `minLength: 0`

          - `type: "periodic"`

            The type of the object. Always `periodic`.

            - `"periodic"`

        - `OneTimeAutomation`

          Fields shared by periodic and one-time automations.

          - `id: string`

            The automation ID.

            `minLength: 0`

          - `created_at: number`

            The creation time as a Unix timestamp in seconds.

            `format: int64`

          - `created_by: AutomationCreatedBy`

            Service-recorded provenance; callers cannot supply this field.

          - `metadata: Record<string, string>`

            Custom string key-value pairs attached to the automation.

          - `name: string`

            The automation's display name.

            `minLength: 0`

          - `object: "agent.automation"`

            Always `agent.automation`.

            - `"agent.automation"`

          - `run_at: number`

            The Unix timestamp, in seconds, of the scheduled occurrence.

            `format: int64`

          - `status: "active" | "paused" | "completed"`

            Completion means the schedule has finished, not the agent's work.

            - `"active"`

            - `"paused"`

            - `"completed"`

          - `target: AutomationTarget`

            The session configuration or existing session receiving invocations.

          - `type: "once"`

            The type of the object. Always `once`.

            - `"once"`

      - `type: "automation"`

        The type of the object. Always `automation`.

        - `"automation"`

  - `status: "queued" | "completed" | "failed" | "skipped"`

    Delivery status; completed does not mean the agent's work has finished.

    - `"queued"`

    - `"completed"`

    - `"failed"`

    - `"skipped"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const automationInvocation = await client.beta.agents.automations.invocations.retrieve(
  'invocation_id',
  { automation_id: 'automation_id' },
);

console.log(automationInvocation.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "automation_id": "automation_id",
  "created_at": 0,
  "error": {
    "code": "code",
    "message": "message"
  },
  "object": "agent.automation.invocation",
  "scheduled_at": 0,
  "session_id": "session_id",
  "skip_reason": "pending_delivery",
  "source": {
    "type": "manual"
  },
  "status": "queued"
}
```

## Domain Types

### Automation Invocation

- `AutomationInvocation`

  One attempted delivery by an automation.

  - `id: string`

    The invocation ID.

    `minLength: 0`

  - `automation_id: string`

    The automation that owns the invocation.

    `minLength: 0`

  - `created_at: number`

    The creation time as a Unix timestamp in seconds.

    `format: int64`

  - `error: Error | null`

    The permanent delivery failure, or null when no failure occurred.

    - `code: string`

      A machine-readable error code.

      `minLength: 0`

    - `message: string`

      A public explanation of the delivery failure.

      `minLength: 0`

  - `object: "agent.automation.invocation"`

    Always `agent.automation.invocation`.

    - `"agent.automation.invocation"`

  - `scheduled_at: number | null`

    The intended occurrence as a Unix timestamp in seconds, or null for manual runs.

    `format: int64`

  - `session_id: string | null`

    The target or newly created session ID, or null before one is available.

    `minLength: 0`

  - `skip_reason: "pending_delivery" | null`

    Why an occurrence was skipped, or null when it was not skipped.

    - `"pending_delivery"`

  - `source: AutomationInvocationSource`

    Whether the invocation was manual or scheduled.

    - `AutomationInvocationSourceResourceManual`

      - `type: "manual"`

        The type of the object. Always `manual`.

        - `"manual"`

    - `AutomationInvocationSourceResourceAutomation`

      - `automation: Automation`

        The automation snapshot for this occurrence, excluding confidential values.

        - `PeriodicAutomation`

          Fields shared by periodic and one-time automations.

          - `id: string`

            The automation ID.

            `minLength: 0`

          - `created_at: number`

            The creation time as a Unix timestamp in seconds.

            `format: int64`

          - `created_by: AutomationCreatedBy`

            Service-recorded provenance; callers cannot supply this field.

            - `AutomationCreatedByResourceDeveloper`

              - `type: "developer"`

                The type of the object. Always `developer`.

                - `"developer"`

            - `AutomationCreatedByResourceAgent`

              - `session_id: string`

                The creator session, which is also the automation's target.

                `minLength: 0`

              - `tool_call_id: string`

                The tool call that created the automation.

                `minLength: 0`

              - `type: "agent"`

                The type of the object. Always `agent`.

                - `"agent"`

          - `expression: string`

            The cron expression determining scheduled occurrences.

            `minLength: 0`

          - `metadata: Record<string, string>`

            Custom string key-value pairs attached to the automation.

          - `name: string`

            The automation's display name.

            `minLength: 0`

          - `object: "agent.automation"`

            Always `agent.automation`.

            - `"agent.automation"`

          - `status: "active" | "paused"`

            Whether scheduled delivery is active or paused.

            - `"active"`

            - `"paused"`

          - `target: AutomationTarget`

            The session configuration or existing session receiving invocations.

            - `AutomationTargetResourceNewSession`

              - `agent: AutomationAgentConfig | null`

                The inline agent configuration, or null when agent_id is configured.

                - `instructions: string | null`

                  Custom instructions, or null when absent.

                  `minLength: 0`

                - `model: string`

                  The requested model name.

                  `minLength: 0`

                - `multi_agent: MultiAgentConfig`

                  The configuration for creating and coordinating subagents.

                  - `enabled: boolean`

                    Whether subagent tools are enabled. Defaults to false.

                  - `max_concurrent_subagents: number | null`

                    Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

                    `format: int64`, `minimum: 1`, `maximum: 4294967295`

                - `reasoning: AgentReasoning`

                  The configured reasoning policy.

                  - `effort: "none" | "minimal" | "low" | 4 more | null`

                    The requested reasoning effort, or `null` when the model selects its own default.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

                  - `summary: "concise" | "detailed" | "auto" | null`

                    The requested reasoning summary format, or `null` when summaries are disabled.

                    - `"concise"`

                      Returns a concise reasoning summary when supported.

                    - `"detailed"`

                      Returns a detailed reasoning summary when supported.

                    - `"auto"`

                      Automatically selects the most detailed summary supported by the model.

                - `service_tier: "auto" | "default" | "flex" | 3 more`

                  The configured service-tier policy.

                  - `"auto"`

                  - `"default"`

                  - `"flex"`

                  - `"priority"`

                  - `"fast"`

                  - `"ultrafast"`

                - `text: AgentText`

                  The configured output format and verbosity.

                  - `format: TextFormat`

                    The effective output format. Defaults to ordinary text.

                    - `TextFormatResourceText`

                      Generates ordinary text without a structured-output constraint.

                      - `type: "text"`

                        The type of the object. Always `text`.

                        - `"text"`

                    - `TextFormatResourceJSONSchema`

                      Constrains generated text to a JSON Schema.

                      - `schema: Record<string, unknown>`

                        The JSON Schema that generated text must match.

                      - `type: "json_schema"`

                        The type of the object. Always `json_schema`.

                        - `"json_schema"`

                  - `verbosity: "low" | "medium" | "high"`

                    The amount of text produced by the agent. Defaults to `medium`.

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                - `tools: Array<AgentTool>`

                  Configured tools, excluding confidential credentials.

                  `minItems: 0`, `maxItems: 2000`

                  - `AgentToolResourceFunction`

                    A function defined by the application.

                    - `defer_loading: boolean`

                      Whether the function is deferred and discovered through tool search.

                    - `description: string`

                      A description of what the function does.

                      `minLength: 0`

                    - `name: string`

                      The name of the function.

                      `minLength: 0`

                    - `parameters: Record<string, unknown>`

                      A JSON Schema object describing the function's arguments.

                    - `type: "function"`

                      The type of the object. Always `function`.

                      - `"function"`

                    - `async?: boolean`

                      Whether the agent continues without waiting for the function result.

                  - `AgentToolResourceProgrammaticToolCalling`

                    Enables calling tools from model-generated code.

                    - `enabled: boolean`

                      Whether tools can be called from model-generated code.

                    - `type: "programmatic_tool_calling"`

                      The type of the object. Always `programmatic_tool_calling`.

                      - `"programmatic_tool_calling"`

                  - `AgentToolResourceMcp`

                    Tools provided by a remote MCP server.

                    - `allowed_tools: Array<string> | null`

                      The MCP tools the agent may call.

                      `minItems: 0`, `maxItems: 2000`

                    - `connection_origin: "service" | "environment"`

                      Where outbound MCP HTTP connections originate.

                      - `"service"`

                      - `"environment"`

                    - `credential_id: string | null`

                      The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

                      `minLength: 0`

                    - `request_metadata: Record<string, unknown>`

                      Metadata included with requests to this MCP server.

                    - `required: boolean`

                      Whether this MCP server must initialize before the first turn.

                    - `server_label: string`

                      A label used to identify the MCP server in tool calls.

                      `minLength: 0`

                    - `transport: McpTransport`

                      The transport used to connect to the MCP server.

                      - `McpTransportResourceHTTP`

                        Connects to an MCP server over HTTP.

                        - `server_url: string`

                          The URL of the MCP server.

                          `minLength: 0`

                        - `type: "http"`

                          The type of the object. Always `http`.

                          - `"http"`

                      - `McpTransportResourceStdio`

                        Starts an MCP server as a local process.

                        - `args: Array<string>`

                          Arguments passed to the MCP server command.

                          `minItems: 0`, `maxItems: 2000`

                        - `command: string`

                          The command used to start the MCP server.

                          `minLength: 0`

                        - `cwd: string`

                          The working directory used to start the MCP server.

                          `minLength: 0`

                        - `env_vars: Array<string>`

                          Environment variable names inherited from the execution environment.

                          `minItems: 0`, `maxItems: 2000`

                        - `type: "stdio"`

                          The type of the object. Always `stdio`.

                          - `"stdio"`

                    - `type: "mcp"`

                      The type of the object. Always `mcp`.

                      - `"mcp"`

                  - `AgentToolResourceWebSearch`

                    Web search.

                    - `allowed_domains: Array<string> | null`

                      Allowed search domains, or `null` when the search is unrestricted.

                      `minItems: 0`, `maxItems: 2000`

                    - `context_size: "low" | "medium" | "high"`

                      The amount of search context made available to the model. Defaults to `medium`.

                      - `"low"`

                      - `"medium"`

                      - `"high"`

                    - `location: Location | null`

                      Approximate location used to localize search results, if provided.

                      - `city: string | null`

                        The city name.

                        `minLength: 0`

                      - `country: string | null`

                        The two-letter ISO country code, such as `US`.

                        `minLength: 0`

                      - `region: string | null`

                        The region or state name.

                        `minLength: 0`

                      - `timezone: string | null`

                        The IANA timezone, such as `America/Los_Angeles`.

                        `minLength: 0`

                    - `mode: "disabled" | "cached" | "live"`

                      The source used for web search results.

                      - `"disabled"`

                      - `"cached"`

                      - `"live"`

                    - `type: "web_search"`

                      The type of the object. Always `web_search`.

                      - `"web_search"`

                  - `AgentToolResourceComputerUse`

                    Browser use in an OpenAI-hosted session.

                    - `include_screenshots: boolean`

                      Whether computer tool outputs include screenshots.

                    - `type: "computer_use"`

                      The type of the object. Always `computer_use`.

                      - `"computer_use"`

                  - `AgentToolResourceAutomations`

                    Lets the agent manage its own scheduled wakeups.

                    - `type: "automations"`

                      The type of the object. Always `automations`.

                      - `"automations"`

                - `compaction?: Compaction`

                  The effective context compaction settings.

                  - `async: boolean`

                    Whether context is compacted in the background. Defaults to true.

                - `experimental?: Experimental`

                  The effective experimental settings for the agent.

                  - `time_awareness: boolean`

                    Whether the model receives periodic current-time reminders.

              - `agent_id: string | null`

                The saved agent reference, or null when an inline agent is configured.

                `minLength: 0`

              - `environment: AutomationEnvironment`

                Configuration or references used to select the execution environment.

                - `AutomationEnvironmentResourceNone`

                  - `type: "none"`

                    The type of the object. Always `none`.

                    - `"none"`

                - `AutomationEnvironmentResourceOpenAIHosted`

                  Hosted environment selection with confidential setup commands and variables omitted.

                  - `capability_directories: Array<string> | null`

                    Directory overrides, or null to inherit the template or creation default.

                    `minItems: 0`, `maxItems: 2000`

                  - `container_size: "small" | "medium" | "large" | null`

                    The configured container size, or null to use the creation default.

                    - `"small"`

                    - `"medium"`

                    - `"large"`

                  - `desktop: Desktop | null`

                    Desktop overrides, or null to inherit the template or creation default.

                    - `enabled: boolean`

                      Whether the environment provisions a desktop and browser proxy.

                  - `environment_id: string | null`

                    An existing environment reference, or null when provisioning a new environment.

                    `minLength: 0`

                  - `environment_template_id: string | null`

                    A template reference, or null when no template is selected.

                    `minLength: 0`

                  - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

                    File overrides, excluding contents, or null to inherit.

                    `minItems: 0`, `maxItems: 2000`

                    - `HostedTemplateFileResourceFileID`

                      A project-scoped Files API reference resolved separately for each session.

                      - `file_id: string`

                        The ID of the uploaded file.

                        `minLength: 0`

                      - `path: string`

                        The file's absolute path inside the environment.

                        `minLength: 0`

                      - `type: "file_id"`

                        The type of the object. Always `file_id`.

                        - `"file_id"`

                    - `HostedTemplateFileResourceInline`

                      Metadata for confidential inline file contents.

                      - `path: string`

                        The file's absolute path inside the environment.

                        `minLength: 0`

                      - `size_bytes: number`

                        The decoded size of the inline file in bytes.

                        `format: int64`, `minimum: 0`

                      - `type: "inline"`

                        The type of the object. Always `inline`.

                        - `"inline"`

                  - `network: Network | null`

                    Network overrides, or null to inherit the template or creation default.

                    - `access: "enabled" | "disabled" | "restricted"`

                      The environment's network access mode.

                      - `"enabled"`

                        Allows unrestricted network access.

                      - `"disabled"`

                        Disables network access.

                      - `"restricted"`

                        Applies the configured domain restrictions.

                    - `allowed_domains: Array<string>`

                      Domains the environment may access when network access is restricted.

                      `minItems: 0`, `maxItems: 2000`

                  - `packages: Packages | null`

                    Package overrides, or null to inherit the template or creation default.

                    - `npm: Array<string>`

                      npm packages installed globally in the environment.

                      `minItems: 0`, `maxItems: 16384`

                    - `python: Array<string>`

                      Python packages installed in the environment.

                      `minItems: 0`, `maxItems: 16384`

                    - `system: Array<string>`

                      System packages installed in the environment.

                      `minItems: 0`, `maxItems: 16384`

                  - `plugins: Array<HostedPlugin> | null`

                    Plugin overrides, excluding archive contents, or null to inherit.

                    `minItems: 0`, `maxItems: 2000`

                    - `description: string`

                      The installed plugin description.

                      `minLength: 0`

                    - `name: string`

                      The installed plugin name.

                      `minLength: 0`

                    - `type: "inline"`

                      The type of the object. Always `inline`.

                      - `"inline"`

                  - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

                    Skill overrides, excluding archive contents, or null to inherit.

                    `minItems: 0`, `maxItems: 2000`

                    - `HostedTemplateSkillResourceSkillReference`

                      A skill resolved afresh from the Skills API whenever a session starts.

                      - `skill_id: string`

                        The referenced skill ID.

                        `minLength: 0`

                      - `type: "skill_reference"`

                        The type of the object. Always `skill_reference`.

                        - `"skill_reference"`

                      - `version: string | null`

                        The requested version selector, including `latest`.

                        `minLength: 0`

                    - `HostedTemplateSkillResourceInline`

                      Safe metadata for an inline skill archive.

                      - `description: string`

                        The skill description declared in `SKILL.md`.

                        `minLength: 0`

                      - `name: string`

                        The skill name declared in `SKILL.md`.

                        `minLength: 0`

                      - `type: "inline"`

                        The type of the object. Always `inline`.

                        - `"inline"`

                  - `type: "openai_hosted"`

                    The type of the object. Always `openai_hosted`.

                    - `"openai_hosted"`

                - `AutomationEnvironmentResourceSelfHosted`

                  - `capability_directories: Array<string>`

                    Directories that expose capabilities to the agent.

                    `minItems: 0`, `maxItems: 2000`

                  - `environment_id: string | null`

                    An existing registration, or null to create a session-owned environment.

                    `minLength: 0`

                  - `type: "self_hosted"`

                    The type of the object. Always `self_hosted`.

                    - `"self_hosted"`

                  - `workspace_directory: string`

                    The absolute project directory in the environment.

                    `minLength: 0`

              - `input: Array<Input>`

                Initial input delivered to each new session.

                `minItems: 0`, `maxItems: 2000`

                - `content: Array<InputContent>`

                  The content of the message.

                  `minItems: 0`, `maxItems: 2000`

                  - `InputContentResourceInputText`

                    Text input recorded in a session item.

                    - `text: string`

                      The text supplied to the agent.

                      `minLength: 0`

                    - `type: "input_text"`

                      The type of the object. Always `input_text`.

                      - `"input_text"`

                  - `InputContentResourceInputImage`

                    Image input recorded in a session item.

                    - `image_url: string`

                      The URL of the image supplied to the agent, which may be a base64-encoded data URL.

                      `minLength: 0`

                    - `type: "input_image"`

                      The type of the object. Always `input_image`.

                      - `"input_image"`

                - `role: "user"`

                  The role of the message author. Always `user`.

                  - `"user"`

                - `type: "message"`

                  The type of the input item. Always `message`.

                  - `"message"`

              - `metadata: Record<string, string>`

                Metadata attached to each new session.

              - `type: "new_session"`

                The type of the object. Always `new_session`.

                - `"new_session"`

              - `vault_ids: Array<string>`

                Vaults made available to each new session.

                `minItems: 0`, `maxItems: 2000`

            - `AutomationTargetResourceExistingSession`

              - `instructions: string`

                Saved instructions delivered as an automation notification.

                `minLength: 0`

              - `session_id: string`

                The session receiving each invocation.

                `minLength: 0`

              - `type: "existing_session"`

                The type of the object. Always `existing_session`.

                - `"existing_session"`

          - `timezone: string`

            The timezone used to interpret the expression.

            `minLength: 0`

          - `type: "periodic"`

            The type of the object. Always `periodic`.

            - `"periodic"`

        - `OneTimeAutomation`

          Fields shared by periodic and one-time automations.

          - `id: string`

            The automation ID.

            `minLength: 0`

          - `created_at: number`

            The creation time as a Unix timestamp in seconds.

            `format: int64`

          - `created_by: AutomationCreatedBy`

            Service-recorded provenance; callers cannot supply this field.

          - `metadata: Record<string, string>`

            Custom string key-value pairs attached to the automation.

          - `name: string`

            The automation's display name.

            `minLength: 0`

          - `object: "agent.automation"`

            Always `agent.automation`.

            - `"agent.automation"`

          - `run_at: number`

            The Unix timestamp, in seconds, of the scheduled occurrence.

            `format: int64`

          - `status: "active" | "paused" | "completed"`

            Completion means the schedule has finished, not the agent's work.

            - `"active"`

            - `"paused"`

            - `"completed"`

          - `target: AutomationTarget`

            The session configuration or existing session receiving invocations.

          - `type: "once"`

            The type of the object. Always `once`.

            - `"once"`

      - `type: "automation"`

        The type of the object. Always `automation`.

        - `"automation"`

  - `status: "queued" | "completed" | "failed" | "skipped"`

    Delivery status; completed does not mean the agent's work has finished.

    - `"queued"`

    - `"completed"`

    - `"failed"`

    - `"skipped"`

### Automation Invocation Source

- `AutomationInvocationSource = AutomationInvocationSourceResourceManual | AutomationInvocationSourceResourceAutomation`

  - `AutomationInvocationSourceResourceManual`

    - `type: "manual"`

      The type of the object. Always `manual`.

      - `"manual"`

  - `AutomationInvocationSourceResourceAutomation`

    - `automation: Automation`

      The automation snapshot for this occurrence, excluding confidential values.

      - `PeriodicAutomation`

        Fields shared by periodic and one-time automations.

        - `id: string`

          The automation ID.

          `minLength: 0`

        - `created_at: number`

          The creation time as a Unix timestamp in seconds.

          `format: int64`

        - `created_by: AutomationCreatedBy`

          Service-recorded provenance; callers cannot supply this field.

          - `AutomationCreatedByResourceDeveloper`

            - `type: "developer"`

              The type of the object. Always `developer`.

              - `"developer"`

          - `AutomationCreatedByResourceAgent`

            - `session_id: string`

              The creator session, which is also the automation's target.

              `minLength: 0`

            - `tool_call_id: string`

              The tool call that created the automation.

              `minLength: 0`

            - `type: "agent"`

              The type of the object. Always `agent`.

              - `"agent"`

        - `expression: string`

          The cron expression determining scheduled occurrences.

          `minLength: 0`

        - `metadata: Record<string, string>`

          Custom string key-value pairs attached to the automation.

        - `name: string`

          The automation's display name.

          `minLength: 0`

        - `object: "agent.automation"`

          Always `agent.automation`.

          - `"agent.automation"`

        - `status: "active" | "paused"`

          Whether scheduled delivery is active or paused.

          - `"active"`

          - `"paused"`

        - `target: AutomationTarget`

          The session configuration or existing session receiving invocations.

          - `AutomationTargetResourceNewSession`

            - `agent: AutomationAgentConfig | null`

              The inline agent configuration, or null when agent_id is configured.

              - `instructions: string | null`

                Custom instructions, or null when absent.

                `minLength: 0`

              - `model: string`

                The requested model name.

                `minLength: 0`

              - `multi_agent: MultiAgentConfig`

                The configuration for creating and coordinating subagents.

                - `enabled: boolean`

                  Whether subagent tools are enabled. Defaults to false.

                - `max_concurrent_subagents: number | null`

                  Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

                  `format: int64`, `minimum: 1`, `maximum: 4294967295`

              - `reasoning: AgentReasoning`

                The configured reasoning policy.

                - `effort: "none" | "minimal" | "low" | 4 more | null`

                  The requested reasoning effort, or `null` when the model selects its own default.

                  - `"none"`

                  - `"minimal"`

                  - `"low"`

                  - `"medium"`

                  - `"high"`

                  - `"xhigh"`

                  - `"max"`

                - `summary: "concise" | "detailed" | "auto" | null`

                  The requested reasoning summary format, or `null` when summaries are disabled.

                  - `"concise"`

                    Returns a concise reasoning summary when supported.

                  - `"detailed"`

                    Returns a detailed reasoning summary when supported.

                  - `"auto"`

                    Automatically selects the most detailed summary supported by the model.

              - `service_tier: "auto" | "default" | "flex" | 3 more`

                The configured service-tier policy.

                - `"auto"`

                - `"default"`

                - `"flex"`

                - `"priority"`

                - `"fast"`

                - `"ultrafast"`

              - `text: AgentText`

                The configured output format and verbosity.

                - `format: TextFormat`

                  The effective output format. Defaults to ordinary text.

                  - `TextFormatResourceText`

                    Generates ordinary text without a structured-output constraint.

                    - `type: "text"`

                      The type of the object. Always `text`.

                      - `"text"`

                  - `TextFormatResourceJSONSchema`

                    Constrains generated text to a JSON Schema.

                    - `schema: Record<string, unknown>`

                      The JSON Schema that generated text must match.

                    - `type: "json_schema"`

                      The type of the object. Always `json_schema`.

                      - `"json_schema"`

                - `verbosity: "low" | "medium" | "high"`

                  The amount of text produced by the agent. Defaults to `medium`.

                  - `"low"`

                  - `"medium"`

                  - `"high"`

              - `tools: Array<AgentTool>`

                Configured tools, excluding confidential credentials.

                `minItems: 0`, `maxItems: 2000`

                - `AgentToolResourceFunction`

                  A function defined by the application.

                  - `defer_loading: boolean`

                    Whether the function is deferred and discovered through tool search.

                  - `description: string`

                    A description of what the function does.

                    `minLength: 0`

                  - `name: string`

                    The name of the function.

                    `minLength: 0`

                  - `parameters: Record<string, unknown>`

                    A JSON Schema object describing the function's arguments.

                  - `type: "function"`

                    The type of the object. Always `function`.

                    - `"function"`

                  - `async?: boolean`

                    Whether the agent continues without waiting for the function result.

                - `AgentToolResourceProgrammaticToolCalling`

                  Enables calling tools from model-generated code.

                  - `enabled: boolean`

                    Whether tools can be called from model-generated code.

                  - `type: "programmatic_tool_calling"`

                    The type of the object. Always `programmatic_tool_calling`.

                    - `"programmatic_tool_calling"`

                - `AgentToolResourceMcp`

                  Tools provided by a remote MCP server.

                  - `allowed_tools: Array<string> | null`

                    The MCP tools the agent may call.

                    `minItems: 0`, `maxItems: 2000`

                  - `connection_origin: "service" | "environment"`

                    Where outbound MCP HTTP connections originate.

                    - `"service"`

                    - `"environment"`

                  - `credential_id: string | null`

                    The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

                    `minLength: 0`

                  - `request_metadata: Record<string, unknown>`

                    Metadata included with requests to this MCP server.

                  - `required: boolean`

                    Whether this MCP server must initialize before the first turn.

                  - `server_label: string`

                    A label used to identify the MCP server in tool calls.

                    `minLength: 0`

                  - `transport: McpTransport`

                    The transport used to connect to the MCP server.

                    - `McpTransportResourceHTTP`

                      Connects to an MCP server over HTTP.

                      - `server_url: string`

                        The URL of the MCP server.

                        `minLength: 0`

                      - `type: "http"`

                        The type of the object. Always `http`.

                        - `"http"`

                    - `McpTransportResourceStdio`

                      Starts an MCP server as a local process.

                      - `args: Array<string>`

                        Arguments passed to the MCP server command.

                        `minItems: 0`, `maxItems: 2000`

                      - `command: string`

                        The command used to start the MCP server.

                        `minLength: 0`

                      - `cwd: string`

                        The working directory used to start the MCP server.

                        `minLength: 0`

                      - `env_vars: Array<string>`

                        Environment variable names inherited from the execution environment.

                        `minItems: 0`, `maxItems: 2000`

                      - `type: "stdio"`

                        The type of the object. Always `stdio`.

                        - `"stdio"`

                  - `type: "mcp"`

                    The type of the object. Always `mcp`.

                    - `"mcp"`

                - `AgentToolResourceWebSearch`

                  Web search.

                  - `allowed_domains: Array<string> | null`

                    Allowed search domains, or `null` when the search is unrestricted.

                    `minItems: 0`, `maxItems: 2000`

                  - `context_size: "low" | "medium" | "high"`

                    The amount of search context made available to the model. Defaults to `medium`.

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                  - `location: Location | null`

                    Approximate location used to localize search results, if provided.

                    - `city: string | null`

                      The city name.

                      `minLength: 0`

                    - `country: string | null`

                      The two-letter ISO country code, such as `US`.

                      `minLength: 0`

                    - `region: string | null`

                      The region or state name.

                      `minLength: 0`

                    - `timezone: string | null`

                      The IANA timezone, such as `America/Los_Angeles`.

                      `minLength: 0`

                  - `mode: "disabled" | "cached" | "live"`

                    The source used for web search results.

                    - `"disabled"`

                    - `"cached"`

                    - `"live"`

                  - `type: "web_search"`

                    The type of the object. Always `web_search`.

                    - `"web_search"`

                - `AgentToolResourceComputerUse`

                  Browser use in an OpenAI-hosted session.

                  - `include_screenshots: boolean`

                    Whether computer tool outputs include screenshots.

                  - `type: "computer_use"`

                    The type of the object. Always `computer_use`.

                    - `"computer_use"`

                - `AgentToolResourceAutomations`

                  Lets the agent manage its own scheduled wakeups.

                  - `type: "automations"`

                    The type of the object. Always `automations`.

                    - `"automations"`

              - `compaction?: Compaction`

                The effective context compaction settings.

                - `async: boolean`

                  Whether context is compacted in the background. Defaults to true.

              - `experimental?: Experimental`

                The effective experimental settings for the agent.

                - `time_awareness: boolean`

                  Whether the model receives periodic current-time reminders.

            - `agent_id: string | null`

              The saved agent reference, or null when an inline agent is configured.

              `minLength: 0`

            - `environment: AutomationEnvironment`

              Configuration or references used to select the execution environment.

              - `AutomationEnvironmentResourceNone`

                - `type: "none"`

                  The type of the object. Always `none`.

                  - `"none"`

              - `AutomationEnvironmentResourceOpenAIHosted`

                Hosted environment selection with confidential setup commands and variables omitted.

                - `capability_directories: Array<string> | null`

                  Directory overrides, or null to inherit the template or creation default.

                  `minItems: 0`, `maxItems: 2000`

                - `container_size: "small" | "medium" | "large" | null`

                  The configured container size, or null to use the creation default.

                  - `"small"`

                  - `"medium"`

                  - `"large"`

                - `desktop: Desktop | null`

                  Desktop overrides, or null to inherit the template or creation default.

                  - `enabled: boolean`

                    Whether the environment provisions a desktop and browser proxy.

                - `environment_id: string | null`

                  An existing environment reference, or null when provisioning a new environment.

                  `minLength: 0`

                - `environment_template_id: string | null`

                  A template reference, or null when no template is selected.

                  `minLength: 0`

                - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline> | null`

                  File overrides, excluding contents, or null to inherit.

                  `minItems: 0`, `maxItems: 2000`

                  - `HostedTemplateFileResourceFileID`

                    A project-scoped Files API reference resolved separately for each session.

                    - `file_id: string`

                      The ID of the uploaded file.

                      `minLength: 0`

                    - `path: string`

                      The file's absolute path inside the environment.

                      `minLength: 0`

                    - `type: "file_id"`

                      The type of the object. Always `file_id`.

                      - `"file_id"`

                  - `HostedTemplateFileResourceInline`

                    Metadata for confidential inline file contents.

                    - `path: string`

                      The file's absolute path inside the environment.

                      `minLength: 0`

                    - `size_bytes: number`

                      The decoded size of the inline file in bytes.

                      `format: int64`, `minimum: 0`

                    - `type: "inline"`

                      The type of the object. Always `inline`.

                      - `"inline"`

                - `network: Network | null`

                  Network overrides, or null to inherit the template or creation default.

                  - `access: "enabled" | "disabled" | "restricted"`

                    The environment's network access mode.

                    - `"enabled"`

                      Allows unrestricted network access.

                    - `"disabled"`

                      Disables network access.

                    - `"restricted"`

                      Applies the configured domain restrictions.

                  - `allowed_domains: Array<string>`

                    Domains the environment may access when network access is restricted.

                    `minItems: 0`, `maxItems: 2000`

                - `packages: Packages | null`

                  Package overrides, or null to inherit the template or creation default.

                  - `npm: Array<string>`

                    npm packages installed globally in the environment.

                    `minItems: 0`, `maxItems: 16384`

                  - `python: Array<string>`

                    Python packages installed in the environment.

                    `minItems: 0`, `maxItems: 16384`

                  - `system: Array<string>`

                    System packages installed in the environment.

                    `minItems: 0`, `maxItems: 16384`

                - `plugins: Array<HostedPlugin> | null`

                  Plugin overrides, excluding archive contents, or null to inherit.

                  `minItems: 0`, `maxItems: 2000`

                  - `description: string`

                    The installed plugin description.

                    `minLength: 0`

                  - `name: string`

                    The installed plugin name.

                    `minLength: 0`

                  - `type: "inline"`

                    The type of the object. Always `inline`.

                    - `"inline"`

                - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline> | null`

                  Skill overrides, excluding archive contents, or null to inherit.

                  `minItems: 0`, `maxItems: 2000`

                  - `HostedTemplateSkillResourceSkillReference`

                    A skill resolved afresh from the Skills API whenever a session starts.

                    - `skill_id: string`

                      The referenced skill ID.

                      `minLength: 0`

                    - `type: "skill_reference"`

                      The type of the object. Always `skill_reference`.

                      - `"skill_reference"`

                    - `version: string | null`

                      The requested version selector, including `latest`.

                      `minLength: 0`

                  - `HostedTemplateSkillResourceInline`

                    Safe metadata for an inline skill archive.

                    - `description: string`

                      The skill description declared in `SKILL.md`.

                      `minLength: 0`

                    - `name: string`

                      The skill name declared in `SKILL.md`.

                      `minLength: 0`

                    - `type: "inline"`

                      The type of the object. Always `inline`.

                      - `"inline"`

                - `type: "openai_hosted"`

                  The type of the object. Always `openai_hosted`.

                  - `"openai_hosted"`

              - `AutomationEnvironmentResourceSelfHosted`

                - `capability_directories: Array<string>`

                  Directories that expose capabilities to the agent.

                  `minItems: 0`, `maxItems: 2000`

                - `environment_id: string | null`

                  An existing registration, or null to create a session-owned environment.

                  `minLength: 0`

                - `type: "self_hosted"`

                  The type of the object. Always `self_hosted`.

                  - `"self_hosted"`

                - `workspace_directory: string`

                  The absolute project directory in the environment.

                  `minLength: 0`

            - `input: Array<Input>`

              Initial input delivered to each new session.

              `minItems: 0`, `maxItems: 2000`

              - `content: Array<InputContent>`

                The content of the message.

                `minItems: 0`, `maxItems: 2000`

                - `InputContentResourceInputText`

                  Text input recorded in a session item.

                  - `text: string`

                    The text supplied to the agent.

                    `minLength: 0`

                  - `type: "input_text"`

                    The type of the object. Always `input_text`.

                    - `"input_text"`

                - `InputContentResourceInputImage`

                  Image input recorded in a session item.

                  - `image_url: string`

                    The URL of the image supplied to the agent, which may be a base64-encoded data URL.

                    `minLength: 0`

                  - `type: "input_image"`

                    The type of the object. Always `input_image`.

                    - `"input_image"`

              - `role: "user"`

                The role of the message author. Always `user`.

                - `"user"`

              - `type: "message"`

                The type of the input item. Always `message`.

                - `"message"`

            - `metadata: Record<string, string>`

              Metadata attached to each new session.

            - `type: "new_session"`

              The type of the object. Always `new_session`.

              - `"new_session"`

            - `vault_ids: Array<string>`

              Vaults made available to each new session.

              `minItems: 0`, `maxItems: 2000`

          - `AutomationTargetResourceExistingSession`

            - `instructions: string`

              Saved instructions delivered as an automation notification.

              `minLength: 0`

            - `session_id: string`

              The session receiving each invocation.

              `minLength: 0`

            - `type: "existing_session"`

              The type of the object. Always `existing_session`.

              - `"existing_session"`

        - `timezone: string`

          The timezone used to interpret the expression.

          `minLength: 0`

        - `type: "periodic"`

          The type of the object. Always `periodic`.

          - `"periodic"`

      - `OneTimeAutomation`

        Fields shared by periodic and one-time automations.

        - `id: string`

          The automation ID.

          `minLength: 0`

        - `created_at: number`

          The creation time as a Unix timestamp in seconds.

          `format: int64`

        - `created_by: AutomationCreatedBy`

          Service-recorded provenance; callers cannot supply this field.

        - `metadata: Record<string, string>`

          Custom string key-value pairs attached to the automation.

        - `name: string`

          The automation's display name.

          `minLength: 0`

        - `object: "agent.automation"`

          Always `agent.automation`.

          - `"agent.automation"`

        - `run_at: number`

          The Unix timestamp, in seconds, of the scheduled occurrence.

          `format: int64`

        - `status: "active" | "paused" | "completed"`

          Completion means the schedule has finished, not the agent's work.

          - `"active"`

          - `"paused"`

          - `"completed"`

        - `target: AutomationTarget`

          The session configuration or existing session receiving invocations.

        - `type: "once"`

          The type of the object. Always `once`.

          - `"once"`

    - `type: "automation"`

      The type of the object. Always `automation`.

      - `"automation"`

# Environments

## Create an agent environment

`client.beta.agents.environments.create(EnvironmentCreateParamsparams, RequestOptionsoptions?): EnvironmentInfo`

**post** `/agents/environments`

Creates an OpenAI-hosted environment before creating a session. Requires access to the prewarming beta.

### Parameters

- `params: EnvironmentCreateParams`

  - `environment: Environment`

    Body param: The required hosting type and its configuration.

    - `type: "openai_hosted"`

      The type of the object. Always `openai_hosted`.

      - `"openai_hosted"`

    - `capability_directories?: Array<string> | null`

      Directories that contain capabilities exposed to the agent. Defaults to an empty list.

      `minItems: 0`, `maxItems: 16384`

    - `desktop?: Desktop | null`

      Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled.

      - `enabled: boolean`

        Whether to provision the desktop and its browser proxy.

    - `env?: Record<string, string> | null`

      Environment variables made available to the agent.

    - `environment_template_id?: string`

      A reusable hosted template applied before inline configuration. Omitted fields inherit the template; network overrides cannot broaden its policy.

      `minLength: 0`, `maxLength: 64`

    - `files?: Array<HostedEnvironmentFileParam> | null`

      Files available before the agent starts. Defaults to an empty list.

      `minItems: 0`, `maxItems: 50`

      - `HostedEnvironmentFileParamFileID`

        A file previously uploaded through the OpenAI Files API.

        - `file_id: string`

          The ID of the uploaded file.

          `minLength: 1`, `maxLength: 256`

        - `path: string`

          The absolute destination path inside `/workspace`.

          `minLength: 1`, `maxLength: 4096`

        - `type: "file_id"`

          The type of the object. Always `file_id`.

          - `"file_id"`

      - `HostedEnvironmentFileParamInline`

        A file supplied directly as standard-base64 data.

        - `data: string`

          The standard-base64-encoded file contents.

          `minLength: 0`, `maxLength: 6990508`

        - `path: string`

          The absolute destination path inside `/workspace`.

          `minLength: 1`, `maxLength: 4096`

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

    - `network?: Network | null`

      Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled.

      - `access: "enabled" | "disabled" | "restricted"`

        The environment's network access mode.

        - `enabled` - Allows unrestricted network access.
        - `disabled` - Disables network access.
        - `restricted` - Applies the configured domain restrictions.

        - `"enabled"`

          Allows unrestricted network access.

        - `"disabled"`

          Disables network access.

        - `"restricted"`

          Applies the configured domain restrictions.

      - `allowed_domains?: Array<string> | null`

        Domains the environment may access when network access is restricted.

        `minItems: 0`, `maxItems: 16384`

      - `blocked_domains?: Array<string> | null`

        Domains blocked for both executor and browser when access is restricted. A nonempty list requires `access: restricted` and cannot be combined with nonempty `allowed_domains`. Wildcard domains are not supported.

        `minItems: 0`, `maxItems: 100`

    - `packages?: Packages | null`

      Packages to install in the environment. Defaults to empty package lists.

      - `npm?: Array<string> | null`

        npm packages to install globally. Defaults to an empty list.

        `minItems: 0`, `maxItems: 16384`

      - `python?: Array<string> | null`

        Python packages to install. Defaults to an empty list.

        `minItems: 0`, `maxItems: 16384`

      - `system?: Array<string> | null`

        System packages to install. Defaults to an empty list.

        `minItems: 0`, `maxItems: 16384`

    - `plugins?: Array<HostedPluginParam> | null`

      Plugins provided as inline ZIP archives. Defaults to an empty list.

      `minItems: 0`, `maxItems: 32`

      - `description: string`

        The plugin description declared in `.codex-plugin/plugin.json`.

        `minLength: 0`, `maxLength: 1048576`

      - `name: string`

        The plugin name declared in `.codex-plugin/plugin.json`.

        `minLength: 1`, `maxLength: 64`

      - `source: InlineCapabilitySourceParam`

        Provides ZIP bytes encoded with standard base64.

        - `data: string`

          Standard-base64 encoded ZIP archive bytes.

          `minLength: 1`, `maxLength: 70254592`

        - `media_type: "application/zip"`

          The archive media type, always `application/zip`.

          - `"application/zip"`

        - `type: "base64"`

          The type of the object. Always `base64`.

          - `"base64"`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

    - `setup_commands?: Array<SetupCommandParam> | null`

      Ordered, confidential setup commands. Command bodies are never returned.

      `minItems: 0`, `maxItems: 16`

      - `command: string`

        The shell command to execute.

        `minLength: 0`, `maxLength: 65536`

      - `cwd?: string | null`

        The absolute working directory. Defaults to `/workspace`.

        `minLength: 0`, `maxLength: 4096`

    - `skills?: Array<HostedSkillParam> | null`

      Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.

      `minItems: 0`, `maxItems: 200`

      - `HostedSkillParamSkillReference`

        References a skill uploaded through the Skills API.

        - `skill_id: string`

          The ID of the skill created through `/v1/skills`.

          `minLength: 1`, `maxLength: 64`

        - `type: "skill_reference"`

          The type of the object. Always `skill_reference`.

          - `"skill_reference"`

        - `version?: string | null`

          The skill version, a positive integer or `latest`; omission selects the default.

          `minLength: 0`, `maxLength: 1048576`

      - `HostedSkillParamInline`

        Supplies a skill ZIP directly in the session request.

        - `description: string`

          The skill description declared in `SKILL.md`.

          `minLength: 0`, `maxLength: 1048576`

        - `name: string`

          The skill name declared in `SKILL.md`.

          `minLength: 1`, `maxLength: 64`

        - `source: InlineCapabilitySourceParam`

          Provides ZIP bytes encoded with standard base64.

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

  - `vault_ids?: Array<string> | null`

    Body param: The IDs of up to 10 vaults made available to an OpenAI-hosted environment.

    `minItems: 0`, `maxItems: 10`

  - `idempotencyKey?: string`

    Header param: Deduplicates creation for 24 hours within the authenticated organization, project, and creator. Retry the same JSON parameters with the same key to retrieve the original environment in its current state. Different parameters or an incomplete hosted creation return 409. Deleted environments are not recreated. After retention expires, the key may create a new environment. Without this header, each request creates a new environment.

    `minLength: 1`, `maxLength: 256`

### Returns

- `EnvironmentInfo`

  Safe metadata for a first-class execution environment.

  - `id: string`

    The ID of the environment.

    `minLength: 0`

  - `files: Array<HostedEnvironmentFile>`

    Files installed in the environment, without their contents.

    `minItems: 0`, `maxItems: 2000`

    - `HostedEnvironmentFileID`

      A file copied from the OpenAI Files API.

      - `id: string`

        The session-scoped ID of the file in the execution environment.

        `minLength: 0`

      - `file_id: string`

        The ID of the uploaded file.

        `minLength: 0`

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `size_bytes: number`

        The decoded file size in bytes.

        `format: int64`, `minimum: 0`

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `HostedEnvironmentFileResourceInline`

      A file supplied inline when the session was created.

      - `id: string`

        The session-scoped ID of the file in the execution environment.

        `minLength: 0`

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `size_bytes: number`

        The decoded file size in bytes.

        `format: int64`, `minimum: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `object: "agent.environment"`

    The object type. Always `agent.environment`.

    - `"agent.environment"`

  - `plugins: Array<HostedPlugin>`

    Plugins installed in the environment, without their archive contents.

    `minItems: 0`, `maxItems: 2000`

    - `description: string`

      The installed plugin description.

      `minLength: 0`

    - `name: string`

      The installed plugin name.

      `minLength: 0`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: Array<HostedSkill>`

    Skills installed in the environment, without their archive contents.

    `minItems: 0`, `maxItems: 2000`

    - `HostedSkillReference`

      A skill installed from the Skills API.

      - `description: string`

        The installed skill description.

        `minLength: 0`

      - `name: string`

        The installed skill name.

        `minLength: 0`

      - `skill_id: string`

        The referenced skill ID.

        `minLength: 0`

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string`

        The concrete skill version installed for this session.

        `minLength: 0`

    - `HostedSkillResourceInline`

      A skill installed from an inline ZIP archive.

      - `description: string`

        The installed skill description.

        `minLength: 0`

      - `name: string`

        The installed skill name.

        `minLength: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `status: "pending" | "ready" | "connected" | 4 more`

    The current environment connection status.

    - `"pending"`

    - `"ready"`

      Provisioning succeeded and the environment is available for attachment or use.

    - `"connected"`

    - `"disconnected"`

    - `"suspended"`

      The sandbox is stopped and can be resumed from its private checkpoint.

    - `"expired"`

    - `"failed"`

  - `type: "openai_hosted" | "self_hosted"`

    Whether the environment is hosted by OpenAI or by the application.

    - `"openai_hosted"`

    - `"self_hosted"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const environmentInfo = await client.beta.agents.environments.create({
  environment: { type: 'openai_hosted' },
});

console.log(environmentInfo.id);
```

#### 201 — Example

```json
{
  "id": "id",
  "files": [
    {
      "id": "id",
      "file_id": "file_id",
      "path": "path",
      "size_bytes": 0,
      "type": "file_id"
    }
  ],
  "object": "agent.environment",
  "plugins": [
    {
      "description": "description",
      "name": "name",
      "type": "inline"
    }
  ],
  "skills": [
    {
      "description": "description",
      "name": "name",
      "skill_id": "skill_id",
      "type": "skill_reference",
      "version": "version"
    }
  ],
  "status": "pending",
  "type": "openai_hosted"
}
```

## List agent environments

`client.beta.agents.environments.list(EnvironmentListParamsquery?, RequestOptionsoptions?): CursorPage<EnvironmentInfo>`

**get** `/agents/environments`

Lists OpenAI-hosted environments owned by the authenticated principal. Requires access to the prewarming beta.

### Parameters

- `query: EnvironmentListParams`

  - `after?: string`

    Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

  - `type?: "openai_hosted"`

    The hosting type to list. Defaults to `openai_hosted`.

    - `"openai_hosted"`

### Returns

- `EnvironmentInfo`

  Safe metadata for a first-class execution environment.

  - `id: string`

    The ID of the environment.

    `minLength: 0`

  - `files: Array<HostedEnvironmentFile>`

    Files installed in the environment, without their contents.

    `minItems: 0`, `maxItems: 2000`

    - `HostedEnvironmentFileID`

      A file copied from the OpenAI Files API.

      - `id: string`

        The session-scoped ID of the file in the execution environment.

        `minLength: 0`

      - `file_id: string`

        The ID of the uploaded file.

        `minLength: 0`

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `size_bytes: number`

        The decoded file size in bytes.

        `format: int64`, `minimum: 0`

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `HostedEnvironmentFileResourceInline`

      A file supplied inline when the session was created.

      - `id: string`

        The session-scoped ID of the file in the execution environment.

        `minLength: 0`

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `size_bytes: number`

        The decoded file size in bytes.

        `format: int64`, `minimum: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `object: "agent.environment"`

    The object type. Always `agent.environment`.

    - `"agent.environment"`

  - `plugins: Array<HostedPlugin>`

    Plugins installed in the environment, without their archive contents.

    `minItems: 0`, `maxItems: 2000`

    - `description: string`

      The installed plugin description.

      `minLength: 0`

    - `name: string`

      The installed plugin name.

      `minLength: 0`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: Array<HostedSkill>`

    Skills installed in the environment, without their archive contents.

    `minItems: 0`, `maxItems: 2000`

    - `HostedSkillReference`

      A skill installed from the Skills API.

      - `description: string`

        The installed skill description.

        `minLength: 0`

      - `name: string`

        The installed skill name.

        `minLength: 0`

      - `skill_id: string`

        The referenced skill ID.

        `minLength: 0`

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string`

        The concrete skill version installed for this session.

        `minLength: 0`

    - `HostedSkillResourceInline`

      A skill installed from an inline ZIP archive.

      - `description: string`

        The installed skill description.

        `minLength: 0`

      - `name: string`

        The installed skill name.

        `minLength: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `status: "pending" | "ready" | "connected" | 4 more`

    The current environment connection status.

    - `"pending"`

    - `"ready"`

      Provisioning succeeded and the environment is available for attachment or use.

    - `"connected"`

    - `"disconnected"`

    - `"suspended"`

      The sandbox is stopped and can be resumed from its private checkpoint.

    - `"expired"`

    - `"failed"`

  - `type: "openai_hosted" | "self_hosted"`

    Whether the environment is hosted by OpenAI or by the application.

    - `"openai_hosted"`

    - `"self_hosted"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const environmentInfo of client.beta.agents.environments.list()) {
  console.log(environmentInfo.id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "files": [
        {
          "id": "id",
          "file_id": "file_id",
          "path": "path",
          "size_bytes": 0,
          "type": "file_id"
        }
      ],
      "object": "agent.environment",
      "plugins": [
        {
          "description": "description",
          "name": "name",
          "type": "inline"
        }
      ],
      "skills": [
        {
          "description": "description",
          "name": "name",
          "skill_id": "skill_id",
          "type": "skill_reference",
          "version": "version"
        }
      ],
      "status": "pending",
      "type": "openai_hosted"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve an agent environment

`client.beta.agents.environments.retrieve(stringenvironmentID, RequestOptionsoptions?): EnvironmentInfo`

**get** `/agents/environments/{environment_id}`

Retrieves an execution environment's connection status and safe installed metadata. See [environment lifecycle](/api/docs/guides/agents-api/environments/lifecycle).

### Parameters

- `environmentID: string`

  `minLength: 0`, `maxLength: 1048576`

### Returns

- `EnvironmentInfo`

  Safe metadata for a first-class execution environment.

  - `id: string`

    The ID of the environment.

    `minLength: 0`

  - `files: Array<HostedEnvironmentFile>`

    Files installed in the environment, without their contents.

    `minItems: 0`, `maxItems: 2000`

    - `HostedEnvironmentFileID`

      A file copied from the OpenAI Files API.

      - `id: string`

        The session-scoped ID of the file in the execution environment.

        `minLength: 0`

      - `file_id: string`

        The ID of the uploaded file.

        `minLength: 0`

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `size_bytes: number`

        The decoded file size in bytes.

        `format: int64`, `minimum: 0`

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `HostedEnvironmentFileResourceInline`

      A file supplied inline when the session was created.

      - `id: string`

        The session-scoped ID of the file in the execution environment.

        `minLength: 0`

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `size_bytes: number`

        The decoded file size in bytes.

        `format: int64`, `minimum: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `object: "agent.environment"`

    The object type. Always `agent.environment`.

    - `"agent.environment"`

  - `plugins: Array<HostedPlugin>`

    Plugins installed in the environment, without their archive contents.

    `minItems: 0`, `maxItems: 2000`

    - `description: string`

      The installed plugin description.

      `minLength: 0`

    - `name: string`

      The installed plugin name.

      `minLength: 0`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: Array<HostedSkill>`

    Skills installed in the environment, without their archive contents.

    `minItems: 0`, `maxItems: 2000`

    - `HostedSkillReference`

      A skill installed from the Skills API.

      - `description: string`

        The installed skill description.

        `minLength: 0`

      - `name: string`

        The installed skill name.

        `minLength: 0`

      - `skill_id: string`

        The referenced skill ID.

        `minLength: 0`

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string`

        The concrete skill version installed for this session.

        `minLength: 0`

    - `HostedSkillResourceInline`

      A skill installed from an inline ZIP archive.

      - `description: string`

        The installed skill description.

        `minLength: 0`

      - `name: string`

        The installed skill name.

        `minLength: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `status: "pending" | "ready" | "connected" | 4 more`

    The current environment connection status.

    - `"pending"`

    - `"ready"`

      Provisioning succeeded and the environment is available for attachment or use.

    - `"connected"`

    - `"disconnected"`

    - `"suspended"`

      The sandbox is stopped and can be resumed from its private checkpoint.

    - `"expired"`

    - `"failed"`

  - `type: "openai_hosted" | "self_hosted"`

    Whether the environment is hosted by OpenAI or by the application.

    - `"openai_hosted"`

    - `"self_hosted"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const environmentInfo = await client.beta.agents.environments.retrieve('environment_id');

console.log(environmentInfo.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "files": [
    {
      "id": "id",
      "file_id": "file_id",
      "path": "path",
      "size_bytes": 0,
      "type": "file_id"
    }
  ],
  "object": "agent.environment",
  "plugins": [
    {
      "description": "description",
      "name": "name",
      "type": "inline"
    }
  ],
  "skills": [
    {
      "description": "description",
      "name": "name",
      "skill_id": "skill_id",
      "type": "skill_reference",
      "version": "version"
    }
  ],
  "status": "pending",
  "type": "openai_hosted"
}
```

## Domain Types

### Environment Info

- `EnvironmentInfo`

  Safe metadata for a first-class execution environment.

  - `id: string`

    The ID of the environment.

    `minLength: 0`

  - `files: Array<HostedEnvironmentFile>`

    Files installed in the environment, without their contents.

    `minItems: 0`, `maxItems: 2000`

    - `HostedEnvironmentFileID`

      A file copied from the OpenAI Files API.

      - `id: string`

        The session-scoped ID of the file in the execution environment.

        `minLength: 0`

      - `file_id: string`

        The ID of the uploaded file.

        `minLength: 0`

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `size_bytes: number`

        The decoded file size in bytes.

        `format: int64`, `minimum: 0`

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `HostedEnvironmentFileResourceInline`

      A file supplied inline when the session was created.

      - `id: string`

        The session-scoped ID of the file in the execution environment.

        `minLength: 0`

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `size_bytes: number`

        The decoded file size in bytes.

        `format: int64`, `minimum: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `object: "agent.environment"`

    The object type. Always `agent.environment`.

    - `"agent.environment"`

  - `plugins: Array<HostedPlugin>`

    Plugins installed in the environment, without their archive contents.

    `minItems: 0`, `maxItems: 2000`

    - `description: string`

      The installed plugin description.

      `minLength: 0`

    - `name: string`

      The installed plugin name.

      `minLength: 0`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: Array<HostedSkill>`

    Skills installed in the environment, without their archive contents.

    `minItems: 0`, `maxItems: 2000`

    - `HostedSkillReference`

      A skill installed from the Skills API.

      - `description: string`

        The installed skill description.

        `minLength: 0`

      - `name: string`

        The installed skill name.

        `minLength: 0`

      - `skill_id: string`

        The referenced skill ID.

        `minLength: 0`

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string`

        The concrete skill version installed for this session.

        `minLength: 0`

    - `HostedSkillResourceInline`

      A skill installed from an inline ZIP archive.

      - `description: string`

        The installed skill description.

        `minLength: 0`

      - `name: string`

        The installed skill name.

        `minLength: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `status: "pending" | "ready" | "connected" | 4 more`

    The current environment connection status.

    - `"pending"`

    - `"ready"`

      Provisioning succeeded and the environment is available for attachment or use.

    - `"connected"`

    - `"disconnected"`

    - `"suspended"`

      The sandbox is stopped and can be resumed from its private checkpoint.

    - `"expired"`

    - `"failed"`

  - `type: "openai_hosted" | "self_hosted"`

    Whether the environment is hosted by OpenAI or by the application.

    - `"openai_hosted"`

    - `"self_hosted"`

# Files

## Write an agent environment file

`client.beta.agents.environments.files.create(stringenvironmentID, FileCreateParamsbody, RequestOptionsoptions?): EnvironmentFile`

**post** `/agents/environments/{environment_id}/files`

Copies inline bytes or a Files API file into a connected execution environment, replacing an existing regular file at the same path. Upload between turns and wait for success before starting the next turn. See [environment files](/api/docs/guides/agents-api/environments/files).

### Parameters

- `environmentID: string`

  `minLength: 0`, `maxLength: 1048576`

- `FileCreateParams = HostedEnvironmentFileParamFileID | HostedEnvironmentFileParamInline`

  - `FileCreateParamsBase`

    - `file_id: string`

      The ID of the uploaded file.

      `minLength: 1`, `maxLength: 256`

    - `path_: string`

      The absolute destination path inside `/workspace`.

      `minLength: 1`, `maxLength: 4096`

    - `type: "file_id"`

      The type of the object. Always `file_id`.

      - `"file_id"`

  - `HostedEnvironmentFileParamFileID extends FileCreateParamsBase`

  - `HostedEnvironmentFileParamInline`

    - `data: string`

      The standard-base64-encoded file contents.

      `minLength: 0`, `maxLength: 6990508`

    - `path_: string`

      The absolute destination path inside `/workspace`.

      `minLength: 1`, `maxLength: 4096`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

### Returns

- `EnvironmentFile`

  A live file in an execution environment.

  - `environment_id: string`

    The ID of the environment containing this file.

    `minLength: 0`

  - `object: "agent.environment.file"`

    The object type. Always `agent.environment.file`.

    - `"agent.environment.file"`

  - `path: string`

    The absolute file path inside the environment's workspace.

    `minLength: 0`

  - `size_bytes: number`

    The file size in bytes.

    `format: int64`, `minimum: 0`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const environmentFile = await client.beta.agents.environments.files.create('environment_id', {
  file_id: 'x',
  path: 'x',
  type: 'file_id',
});

console.log(environmentFile.environment_id);
```

#### 201 — Example

```json
{
  "environment_id": "environment_id",
  "object": "agent.environment.file",
  "path": "path",
  "size_bytes": 0
}
```

## List agent environment files

`client.beta.agents.environments.files.list(stringenvironmentID, FileListParamsquery?, RequestOptionsoptions?): TokenPage<EnvironmentFile>`

**get** `/agents/environments/{environment_id}/files`

Lists live files on a connected execution environment with optional directory filtering and opaque cursor pagination. See [environment files](/api/docs/guides/agents-api/environments/files).

### Parameters

- `environmentID: string`

  `minLength: 0`, `maxLength: 1048576`

- `query: FileListParams`

  - `limit?: number | null`

    The maximum number of files to return, between 1 and 100.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    Sort by case-sensitive path components. Defaults to descending.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

  - `page?: string`

    The opaque token from the previous page. Keep the same path, order, and limit.

    `minLength: 0`, `maxLength: 1048576`

  - `path_?: string | null`

    Restrict the listing to this absolute workspace directory.

    `minLength: 0`, `maxLength: 1048576`

### Returns

- `EnvironmentFile`

  A live file in an execution environment.

  - `environment_id: string`

    The ID of the environment containing this file.

    `minLength: 0`

  - `object: "agent.environment.file"`

    The object type. Always `agent.environment.file`.

    - `"agent.environment.file"`

  - `path: string`

    The absolute file path inside the environment's workspace.

    `minLength: 0`

  - `size_bytes: number`

    The file size in bytes.

    `format: int64`, `minimum: 0`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const environmentFile of client.beta.agents.environments.files.list('environment_id')) {
  console.log(environmentFile.environment_id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "environment_id": "environment_id",
      "object": "agent.environment.file",
      "path": "path",
      "size_bytes": 0
    }
  ],
  "has_more": true,
  "next": "next",
  "object": "page"
}
```

## Domain Types

### Environment File

- `EnvironmentFile`

  A live file in an execution environment.

  - `environment_id: string`

    The ID of the environment containing this file.

    `minLength: 0`

  - `object: "agent.environment.file"`

    The object type. Always `agent.environment.file`.

    - `"agent.environment.file"`

  - `path: string`

    The absolute file path inside the environment's workspace.

    `minLength: 0`

  - `size_bytes: number`

    The file size in bytes.

    `format: int64`, `minimum: 0`

# Templates

## Create an agent environment template

`client.beta.agents.environments.templates.create(TemplateCreateParamsbody?, RequestOptionsoptions?): EnvironmentTemplate`

**post** `/agents/environments/templates`

Creates reusable environment configuration without returning confidential setup commands or environment values. See [reusing a hosted setup](/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).

### Parameters

- `body: TemplateCreateParams`

  - `capability_directories?: Array<string> | null`

    Directories that contain capabilities exposed to the agent. Defaults to an empty list.

    `minItems: 0`, `maxItems: 16384`

  - `desktop?: Desktop | null`

    Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled.

    - `enabled: boolean`

      Whether to provision the desktop and its browser proxy.

  - `env?: Record<string, string> | null`

    Environment variables made available to the agent.

  - `files?: Array<HostedEnvironmentFileParam> | null`

    Files available before the agent starts. Defaults to an empty list.

    `minItems: 0`, `maxItems: 50`

    - `HostedEnvironmentFileParamFileID`

      A file previously uploaded through the OpenAI Files API.

      - `file_id: string`

        The ID of the uploaded file.

        `minLength: 1`, `maxLength: 256`

      - `path: string`

        The absolute destination path inside `/workspace`.

        `minLength: 1`, `maxLength: 4096`

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `HostedEnvironmentFileParamInline`

      A file supplied directly as standard-base64 data.

      - `data: string`

        The standard-base64-encoded file contents.

        `minLength: 0`, `maxLength: 6990508`

      - `path: string`

        The absolute destination path inside `/workspace`.

        `minLength: 1`, `maxLength: 4096`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `name?: string | null`

    An optional human-readable display name for the template.

    `minLength: 1`, `maxLength: 256`

  - `network?: Network | null`

    Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled.

    - `access: "enabled" | "disabled" | "restricted"`

      The environment's network access mode.

      - `enabled` - Allows unrestricted network access.
      - `disabled` - Disables network access.
      - `restricted` - Applies the configured domain restrictions.

      - `"enabled"`

        Allows unrestricted network access.

      - `"disabled"`

        Disables network access.

      - `"restricted"`

        Applies the configured domain restrictions.

    - `allowed_domains?: Array<string> | null`

      Domains the environment may access when network access is restricted.

      `minItems: 0`, `maxItems: 16384`

    - `blocked_domains?: Array<string> | null`

      Domains blocked for both executor and browser when access is restricted. A nonempty list requires `access: restricted` and cannot be combined with nonempty `allowed_domains`. Wildcard domains are not supported.

      `minItems: 0`, `maxItems: 100`

  - `packages?: Packages | null`

    Packages to install in the environment. Defaults to empty package lists.

    - `npm?: Array<string> | null`

      npm packages to install globally. Defaults to an empty list.

      `minItems: 0`, `maxItems: 16384`

    - `python?: Array<string> | null`

      Python packages to install. Defaults to an empty list.

      `minItems: 0`, `maxItems: 16384`

    - `system?: Array<string> | null`

      System packages to install. Defaults to an empty list.

      `minItems: 0`, `maxItems: 16384`

  - `plugins?: Array<HostedPluginParam> | null`

    Plugins provided as inline ZIP archives. Defaults to an empty list.

    `minItems: 0`, `maxItems: 32`

    - `description: string`

      The plugin description declared in `.codex-plugin/plugin.json`.

      `minLength: 0`, `maxLength: 1048576`

    - `name: string`

      The plugin name declared in `.codex-plugin/plugin.json`.

      `minLength: 1`, `maxLength: 64`

    - `source: InlineCapabilitySourceParam`

      Provides ZIP bytes encoded with standard base64.

      - `data: string`

        Standard-base64 encoded ZIP archive bytes.

        `minLength: 1`, `maxLength: 70254592`

      - `media_type: "application/zip"`

        The archive media type, always `application/zip`.

        - `"application/zip"`

      - `type: "base64"`

        The type of the object. Always `base64`.

        - `"base64"`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `setup_commands?: Array<SetupCommandParam> | null`

    Ordered, confidential setup commands. Command bodies are never returned.

    `minItems: 0`, `maxItems: 16`

    - `command: string`

      The shell command to execute.

      `minLength: 0`, `maxLength: 65536`

    - `cwd?: string | null`

      The absolute working directory. Defaults to `/workspace`.

      `minLength: 0`, `maxLength: 4096`

  - `skills?: Array<HostedSkillParam> | null`

    Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.

    `minItems: 0`, `maxItems: 200`

    - `HostedSkillParamSkillReference`

      References a skill uploaded through the Skills API.

      - `skill_id: string`

        The ID of the skill created through `/v1/skills`.

        `minLength: 1`, `maxLength: 64`

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version?: string | null`

        The skill version, a positive integer or `latest`; omission selects the default.

        `minLength: 0`, `maxLength: 1048576`

    - `HostedSkillParamInline`

      Supplies a skill ZIP directly in the session request.

      - `description: string`

        The skill description declared in `SKILL.md`.

        `minLength: 0`, `maxLength: 1048576`

      - `name: string`

        The skill name declared in `SKILL.md`.

        `minLength: 1`, `maxLength: 64`

      - `source: InlineCapabilitySourceParam`

        Provides ZIP bytes encoded with standard base64.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

### Returns

- `EnvironmentTemplate`

  Reusable configuration that provisions a fresh OpenAI-hosted environment for each session.

  - `id: string`

    The ID of the reusable environment template.

    `minLength: 0`

  - `capability_directories: Array<string>`

    Directories that expose capabilities to the agent.

    `minItems: 0`, `maxItems: 2000`

  - `created_at: number`

    The Unix timestamp, in seconds, when the template was created.

    `format: int64`

  - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline>`

    Safe file metadata, excluding contents and session-scoped file IDs.

    `minItems: 0`, `maxItems: 50`

    - `HostedTemplateFileResourceFileID`

      A project-scoped Files API reference resolved separately for each session.

      - `file_id: string`

        The ID of the uploaded file.

        `minLength: 0`

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `HostedTemplateFileResourceInline`

      Metadata for confidential inline file contents.

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `size_bytes: number`

        The decoded size of the inline file in bytes.

        `format: int64`, `minimum: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `name: string | null`

    An optional human-readable display name for the template.

    `minLength: 0`

  - `network: Network`

    Runtime network access for each OpenAI-hosted environment.

    - `access: "enabled" | "disabled" | "restricted"`

      The environment's network access mode.

      - `"enabled"`

        Allows unrestricted network access.

      - `"disabled"`

        Disables network access.

      - `"restricted"`

        Applies the configured domain restrictions.

    - `allowed_domains: Array<string>`

      Domains the environment may access when network access is restricted.

      `minItems: 0`, `maxItems: 2000`

  - `object: "agent.environment.template"`

    The object type. Always `agent.environment.template`.

    - `"agent.environment.template"`

  - `packages: Packages`

    Packages installed in each fresh OpenAI-hosted environment.

    - `npm: Array<string>`

      npm packages installed globally in the environment.

      `minItems: 0`, `maxItems: 16384`

    - `python: Array<string>`

      Python packages installed in the environment.

      `minItems: 0`, `maxItems: 16384`

    - `system: Array<string>`

      System packages installed in the environment.

      `minItems: 0`, `maxItems: 16384`

  - `plugins: Array<HostedPlugin>`

    Safe plugin metadata, excluding inline archive contents.

    `minItems: 0`, `maxItems: 32`

    - `description: string`

      The installed plugin description.

      `minLength: 0`

    - `name: string`

      The installed plugin name.

      `minLength: 0`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline>`

    Safe skill metadata, preserving unresolved version selectors.

    `minItems: 0`, `maxItems: 200`

    - `HostedTemplateSkillResourceSkillReference`

      A skill resolved afresh from the Skills API whenever a session starts.

      - `skill_id: string`

        The referenced skill ID.

        `minLength: 0`

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string | null`

        The requested version selector, including `latest`.

        `minLength: 0`

    - `HostedTemplateSkillResourceInline`

      Safe metadata for an inline skill archive.

      - `description: string`

        The skill description declared in `SKILL.md`.

        `minLength: 0`

      - `name: string`

        The skill name declared in `SKILL.md`.

        `minLength: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the template was last updated.

    `format: int64`

  - `desktop?: Desktop`

    Desktop configuration for each OpenAI-hosted environment.

    - `enabled: boolean`

      Whether the environment provisions a desktop and browser proxy.

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const environmentTemplate = await client.beta.agents.environments.templates.create();

console.log(environmentTemplate.id);
```

#### 201 — Example

```json
{
  "id": "id",
  "capability_directories": [
    "string"
  ],
  "created_at": 0,
  "files": [
    {
      "file_id": "file_id",
      "path": "path",
      "type": "file_id"
    }
  ],
  "name": "name",
  "network": {
    "access": "enabled",
    "allowed_domains": [
      "string"
    ]
  },
  "object": "agent.environment.template",
  "packages": {
    "npm": [
      "string"
    ],
    "python": [
      "string"
    ],
    "system": [
      "string"
    ]
  },
  "plugins": [
    {
      "description": "description",
      "name": "name",
      "type": "inline"
    }
  ],
  "skills": [
    {
      "skill_id": "skill_id",
      "type": "skill_reference",
      "version": "version"
    }
  ],
  "updated_at": 0,
  "desktop": {
    "enabled": true
  }
}
```

## Delete an agent environment template

`client.beta.agents.environments.templates.delete(stringenvironmentTemplateID, RequestOptionsoptions?): EnvironmentTemplateDeleted`

**delete** `/agents/environments/templates/{environment_template_id}`

Deletes reusable environment configuration and all confidential template inputs. See [reusing a hosted setup](/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).

### Parameters

- `environmentTemplateID: string`

  `minLength: 0`, `maxLength: 1048576`

### Returns

- `EnvironmentTemplateDeleted`

  A deleted reusable environment template.

  - `id: string`

    The ID of the deleted environment template.

    `minLength: 0`

  - `deleted: boolean`

    Whether the environment template was deleted. Always `true`.

  - `object: "agent.environment.template.deleted"`

    The object type. Always `agent.environment.template.deleted`.

    - `"agent.environment.template.deleted"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const environmentTemplateDeleted = await client.beta.agents.environments.templates.delete(
  'environment_template_id',
);

console.log(environmentTemplateDeleted.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "deleted": true,
  "object": "agent.environment.template.deleted"
}
```

## List agent environment templates

`client.beta.agents.environments.templates.list(TemplateListParamsquery?, RequestOptionsoptions?): CursorPage<EnvironmentTemplate>`

**get** `/agents/environments/templates`

Lists reusable environment templates without returning confidential values. See [reusing a hosted setup](/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).

### Parameters

- `query: TemplateListParams`

  - `after?: string`

    Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

### Returns

- `EnvironmentTemplate`

  Reusable configuration that provisions a fresh OpenAI-hosted environment for each session.

  - `id: string`

    The ID of the reusable environment template.

    `minLength: 0`

  - `capability_directories: Array<string>`

    Directories that expose capabilities to the agent.

    `minItems: 0`, `maxItems: 2000`

  - `created_at: number`

    The Unix timestamp, in seconds, when the template was created.

    `format: int64`

  - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline>`

    Safe file metadata, excluding contents and session-scoped file IDs.

    `minItems: 0`, `maxItems: 50`

    - `HostedTemplateFileResourceFileID`

      A project-scoped Files API reference resolved separately for each session.

      - `file_id: string`

        The ID of the uploaded file.

        `minLength: 0`

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `HostedTemplateFileResourceInline`

      Metadata for confidential inline file contents.

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `size_bytes: number`

        The decoded size of the inline file in bytes.

        `format: int64`, `minimum: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `name: string | null`

    An optional human-readable display name for the template.

    `minLength: 0`

  - `network: Network`

    Runtime network access for each OpenAI-hosted environment.

    - `access: "enabled" | "disabled" | "restricted"`

      The environment's network access mode.

      - `"enabled"`

        Allows unrestricted network access.

      - `"disabled"`

        Disables network access.

      - `"restricted"`

        Applies the configured domain restrictions.

    - `allowed_domains: Array<string>`

      Domains the environment may access when network access is restricted.

      `minItems: 0`, `maxItems: 2000`

  - `object: "agent.environment.template"`

    The object type. Always `agent.environment.template`.

    - `"agent.environment.template"`

  - `packages: Packages`

    Packages installed in each fresh OpenAI-hosted environment.

    - `npm: Array<string>`

      npm packages installed globally in the environment.

      `minItems: 0`, `maxItems: 16384`

    - `python: Array<string>`

      Python packages installed in the environment.

      `minItems: 0`, `maxItems: 16384`

    - `system: Array<string>`

      System packages installed in the environment.

      `minItems: 0`, `maxItems: 16384`

  - `plugins: Array<HostedPlugin>`

    Safe plugin metadata, excluding inline archive contents.

    `minItems: 0`, `maxItems: 32`

    - `description: string`

      The installed plugin description.

      `minLength: 0`

    - `name: string`

      The installed plugin name.

      `minLength: 0`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline>`

    Safe skill metadata, preserving unresolved version selectors.

    `minItems: 0`, `maxItems: 200`

    - `HostedTemplateSkillResourceSkillReference`

      A skill resolved afresh from the Skills API whenever a session starts.

      - `skill_id: string`

        The referenced skill ID.

        `minLength: 0`

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string | null`

        The requested version selector, including `latest`.

        `minLength: 0`

    - `HostedTemplateSkillResourceInline`

      Safe metadata for an inline skill archive.

      - `description: string`

        The skill description declared in `SKILL.md`.

        `minLength: 0`

      - `name: string`

        The skill name declared in `SKILL.md`.

        `minLength: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the template was last updated.

    `format: int64`

  - `desktop?: Desktop`

    Desktop configuration for each OpenAI-hosted environment.

    - `enabled: boolean`

      Whether the environment provisions a desktop and browser proxy.

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const environmentTemplate of client.beta.agents.environments.templates.list()) {
  console.log(environmentTemplate.id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "capability_directories": [
        "string"
      ],
      "created_at": 0,
      "files": [
        {
          "file_id": "file_id",
          "path": "path",
          "type": "file_id"
        }
      ],
      "name": "name",
      "network": {
        "access": "enabled",
        "allowed_domains": [
          "string"
        ]
      },
      "object": "agent.environment.template",
      "packages": {
        "npm": [
          "string"
        ],
        "python": [
          "string"
        ],
        "system": [
          "string"
        ]
      },
      "plugins": [
        {
          "description": "description",
          "name": "name",
          "type": "inline"
        }
      ],
      "skills": [
        {
          "skill_id": "skill_id",
          "type": "skill_reference",
          "version": "version"
        }
      ],
      "updated_at": 0,
      "desktop": {
        "enabled": true
      }
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve an agent environment template

`client.beta.agents.environments.templates.retrieve(stringenvironmentTemplateID, RequestOptionsoptions?): EnvironmentTemplate`

**get** `/agents/environments/templates/{environment_template_id}`

Retrieves reusable environment configuration without returning confidential values. See [reusing a hosted setup](/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).

### Parameters

- `environmentTemplateID: string`

  `minLength: 0`, `maxLength: 1048576`

### Returns

- `EnvironmentTemplate`

  Reusable configuration that provisions a fresh OpenAI-hosted environment for each session.

  - `id: string`

    The ID of the reusable environment template.

    `minLength: 0`

  - `capability_directories: Array<string>`

    Directories that expose capabilities to the agent.

    `minItems: 0`, `maxItems: 2000`

  - `created_at: number`

    The Unix timestamp, in seconds, when the template was created.

    `format: int64`

  - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline>`

    Safe file metadata, excluding contents and session-scoped file IDs.

    `minItems: 0`, `maxItems: 50`

    - `HostedTemplateFileResourceFileID`

      A project-scoped Files API reference resolved separately for each session.

      - `file_id: string`

        The ID of the uploaded file.

        `minLength: 0`

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `HostedTemplateFileResourceInline`

      Metadata for confidential inline file contents.

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `size_bytes: number`

        The decoded size of the inline file in bytes.

        `format: int64`, `minimum: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `name: string | null`

    An optional human-readable display name for the template.

    `minLength: 0`

  - `network: Network`

    Runtime network access for each OpenAI-hosted environment.

    - `access: "enabled" | "disabled" | "restricted"`

      The environment's network access mode.

      - `"enabled"`

        Allows unrestricted network access.

      - `"disabled"`

        Disables network access.

      - `"restricted"`

        Applies the configured domain restrictions.

    - `allowed_domains: Array<string>`

      Domains the environment may access when network access is restricted.

      `minItems: 0`, `maxItems: 2000`

  - `object: "agent.environment.template"`

    The object type. Always `agent.environment.template`.

    - `"agent.environment.template"`

  - `packages: Packages`

    Packages installed in each fresh OpenAI-hosted environment.

    - `npm: Array<string>`

      npm packages installed globally in the environment.

      `minItems: 0`, `maxItems: 16384`

    - `python: Array<string>`

      Python packages installed in the environment.

      `minItems: 0`, `maxItems: 16384`

    - `system: Array<string>`

      System packages installed in the environment.

      `minItems: 0`, `maxItems: 16384`

  - `plugins: Array<HostedPlugin>`

    Safe plugin metadata, excluding inline archive contents.

    `minItems: 0`, `maxItems: 32`

    - `description: string`

      The installed plugin description.

      `minLength: 0`

    - `name: string`

      The installed plugin name.

      `minLength: 0`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline>`

    Safe skill metadata, preserving unresolved version selectors.

    `minItems: 0`, `maxItems: 200`

    - `HostedTemplateSkillResourceSkillReference`

      A skill resolved afresh from the Skills API whenever a session starts.

      - `skill_id: string`

        The referenced skill ID.

        `minLength: 0`

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string | null`

        The requested version selector, including `latest`.

        `minLength: 0`

    - `HostedTemplateSkillResourceInline`

      Safe metadata for an inline skill archive.

      - `description: string`

        The skill description declared in `SKILL.md`.

        `minLength: 0`

      - `name: string`

        The skill name declared in `SKILL.md`.

        `minLength: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the template was last updated.

    `format: int64`

  - `desktop?: Desktop`

    Desktop configuration for each OpenAI-hosted environment.

    - `enabled: boolean`

      Whether the environment provisions a desktop and browser proxy.

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const environmentTemplate = await client.beta.agents.environments.templates.retrieve(
  'environment_template_id',
);

console.log(environmentTemplate.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "capability_directories": [
    "string"
  ],
  "created_at": 0,
  "files": [
    {
      "file_id": "file_id",
      "path": "path",
      "type": "file_id"
    }
  ],
  "name": "name",
  "network": {
    "access": "enabled",
    "allowed_domains": [
      "string"
    ]
  },
  "object": "agent.environment.template",
  "packages": {
    "npm": [
      "string"
    ],
    "python": [
      "string"
    ],
    "system": [
      "string"
    ]
  },
  "plugins": [
    {
      "description": "description",
      "name": "name",
      "type": "inline"
    }
  ],
  "skills": [
    {
      "skill_id": "skill_id",
      "type": "skill_reference",
      "version": "version"
    }
  ],
  "updated_at": 0,
  "desktop": {
    "enabled": true
  }
}
```

## Update an agent environment template

`client.beta.agents.environments.templates.update(stringenvironmentTemplateID, TemplateUpdateParamsbody?, RequestOptionsoptions?): EnvironmentTemplate`

**post** `/agents/environments/templates/{environment_template_id}`

Updates reusable environment configuration without returning confidential values. See [reusing a hosted setup](/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).

### Parameters

- `environmentTemplateID: string`

  `minLength: 0`, `maxLength: 1048576`

- `body: TemplateUpdateParams`

  - `capability_directories?: Array<string> | null`

    Directories that expose capabilities to the agent.

    `minItems: 0`, `maxItems: 16384`

  - `desktop?: Desktop | null`

    Replacement desktop configuration, or null to disable the desktop.

    - `enabled: boolean`

      Whether to provision the desktop and its browser proxy.

  - `env?: Record<string, string> | null`

    Replacement confidential environment values.

  - `files?: Array<HostedEnvironmentFileParam> | null`

    Replacement file configuration materialized for each new session.

    `minItems: 0`, `maxItems: 50`

    - `HostedEnvironmentFileParamFileID`

      A file previously uploaded through the OpenAI Files API.

      - `file_id: string`

        The ID of the uploaded file.

        `minLength: 1`, `maxLength: 256`

      - `path: string`

        The absolute destination path inside `/workspace`.

        `minLength: 1`, `maxLength: 4096`

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `HostedEnvironmentFileParamInline`

      A file supplied directly as standard-base64 data.

      - `data: string`

        The standard-base64-encoded file contents.

        `minLength: 0`, `maxLength: 6990508`

      - `path: string`

        The absolute destination path inside `/workspace`.

        `minLength: 1`, `maxLength: 4096`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `name?: string | null`

    A replacement human-readable display name, or `null` to clear the name.

    `minLength: 1`, `maxLength: 256`

  - `network?: Network | null`

    Network access available after setup completes. Omit to preserve the current policy, or pass `null` to reset to the default policy.

    - `access: "enabled" | "disabled" | "restricted"`

      The environment's network access mode.

      - `enabled` - Allows unrestricted network access.
      - `disabled` - Disables network access.
      - `restricted` - Applies the configured domain restrictions.

      - `"enabled"`

        Allows unrestricted network access.

      - `"disabled"`

        Disables network access.

      - `"restricted"`

        Applies the configured domain restrictions.

    - `allowed_domains?: Array<string> | null`

      Domains the environment may access when network access is restricted.

      `minItems: 0`, `maxItems: 16384`

    - `blocked_domains?: Array<string> | null`

      Domains blocked for both executor and browser when access is restricted. A nonempty list requires `access: restricted` and cannot be combined with nonempty `allowed_domains`. Wildcard domains are not supported.

      `minItems: 0`, `maxItems: 100`

  - `packages?: Packages | null`

    Packages installed before the runtime network policy applies.

    - `npm?: Array<string> | null`

      npm packages to install globally. Defaults to an empty list.

      `minItems: 0`, `maxItems: 16384`

    - `python?: Array<string> | null`

      Python packages to install. Defaults to an empty list.

      `minItems: 0`, `maxItems: 16384`

    - `system?: Array<string> | null`

      System packages to install. Defaults to an empty list.

      `minItems: 0`, `maxItems: 16384`

  - `plugins?: Array<HostedPluginParam> | null`

    Replacement plugin configuration installed for each new session.

    `minItems: 0`, `maxItems: 32`

    - `description: string`

      The plugin description declared in `.codex-plugin/plugin.json`.

      `minLength: 0`, `maxLength: 1048576`

    - `name: string`

      The plugin name declared in `.codex-plugin/plugin.json`.

      `minLength: 1`, `maxLength: 64`

    - `source: InlineCapabilitySourceParam`

      Provides ZIP bytes encoded with standard base64.

      - `data: string`

        Standard-base64 encoded ZIP archive bytes.

        `minLength: 1`, `maxLength: 70254592`

      - `media_type: "application/zip"`

        The archive media type, always `application/zip`.

        - `"application/zip"`

      - `type: "base64"`

        The type of the object. Always `base64`.

        - `"base64"`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `setup_commands?: Array<SetupCommandParam> | null`

    Replacement confidential setup commands, never included in returned resources.

    `minItems: 0`, `maxItems: 16`

    - `command: string`

      The shell command to execute.

      `minLength: 0`, `maxLength: 65536`

    - `cwd?: string | null`

      The absolute working directory. Defaults to `/workspace`.

      `minLength: 0`, `maxLength: 4096`

  - `skills?: Array<HostedSkillParam> | null`

    Replacement skill configuration installed for each new session.

    `minItems: 0`, `maxItems: 200`

    - `HostedSkillParamSkillReference`

      References a skill uploaded through the Skills API.

      - `skill_id: string`

        The ID of the skill created through `/v1/skills`.

        `minLength: 1`, `maxLength: 64`

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version?: string | null`

        The skill version, a positive integer or `latest`; omission selects the default.

        `minLength: 0`, `maxLength: 1048576`

    - `HostedSkillParamInline`

      Supplies a skill ZIP directly in the session request.

      - `description: string`

        The skill description declared in `SKILL.md`.

        `minLength: 0`, `maxLength: 1048576`

      - `name: string`

        The skill name declared in `SKILL.md`.

        `minLength: 1`, `maxLength: 64`

      - `source: InlineCapabilitySourceParam`

        Provides ZIP bytes encoded with standard base64.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

### Returns

- `EnvironmentTemplate`

  Reusable configuration that provisions a fresh OpenAI-hosted environment for each session.

  - `id: string`

    The ID of the reusable environment template.

    `minLength: 0`

  - `capability_directories: Array<string>`

    Directories that expose capabilities to the agent.

    `minItems: 0`, `maxItems: 2000`

  - `created_at: number`

    The Unix timestamp, in seconds, when the template was created.

    `format: int64`

  - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline>`

    Safe file metadata, excluding contents and session-scoped file IDs.

    `minItems: 0`, `maxItems: 50`

    - `HostedTemplateFileResourceFileID`

      A project-scoped Files API reference resolved separately for each session.

      - `file_id: string`

        The ID of the uploaded file.

        `minLength: 0`

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `HostedTemplateFileResourceInline`

      Metadata for confidential inline file contents.

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `size_bytes: number`

        The decoded size of the inline file in bytes.

        `format: int64`, `minimum: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `name: string | null`

    An optional human-readable display name for the template.

    `minLength: 0`

  - `network: Network`

    Runtime network access for each OpenAI-hosted environment.

    - `access: "enabled" | "disabled" | "restricted"`

      The environment's network access mode.

      - `"enabled"`

        Allows unrestricted network access.

      - `"disabled"`

        Disables network access.

      - `"restricted"`

        Applies the configured domain restrictions.

    - `allowed_domains: Array<string>`

      Domains the environment may access when network access is restricted.

      `minItems: 0`, `maxItems: 2000`

  - `object: "agent.environment.template"`

    The object type. Always `agent.environment.template`.

    - `"agent.environment.template"`

  - `packages: Packages`

    Packages installed in each fresh OpenAI-hosted environment.

    - `npm: Array<string>`

      npm packages installed globally in the environment.

      `minItems: 0`, `maxItems: 16384`

    - `python: Array<string>`

      Python packages installed in the environment.

      `minItems: 0`, `maxItems: 16384`

    - `system: Array<string>`

      System packages installed in the environment.

      `minItems: 0`, `maxItems: 16384`

  - `plugins: Array<HostedPlugin>`

    Safe plugin metadata, excluding inline archive contents.

    `minItems: 0`, `maxItems: 32`

    - `description: string`

      The installed plugin description.

      `minLength: 0`

    - `name: string`

      The installed plugin name.

      `minLength: 0`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline>`

    Safe skill metadata, preserving unresolved version selectors.

    `minItems: 0`, `maxItems: 200`

    - `HostedTemplateSkillResourceSkillReference`

      A skill resolved afresh from the Skills API whenever a session starts.

      - `skill_id: string`

        The referenced skill ID.

        `minLength: 0`

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string | null`

        The requested version selector, including `latest`.

        `minLength: 0`

    - `HostedTemplateSkillResourceInline`

      Safe metadata for an inline skill archive.

      - `description: string`

        The skill description declared in `SKILL.md`.

        `minLength: 0`

      - `name: string`

        The skill name declared in `SKILL.md`.

        `minLength: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the template was last updated.

    `format: int64`

  - `desktop?: Desktop`

    Desktop configuration for each OpenAI-hosted environment.

    - `enabled: boolean`

      Whether the environment provisions a desktop and browser proxy.

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const environmentTemplate = await client.beta.agents.environments.templates.update(
  'environment_template_id',
);

console.log(environmentTemplate.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "capability_directories": [
    "string"
  ],
  "created_at": 0,
  "files": [
    {
      "file_id": "file_id",
      "path": "path",
      "type": "file_id"
    }
  ],
  "name": "name",
  "network": {
    "access": "enabled",
    "allowed_domains": [
      "string"
    ]
  },
  "object": "agent.environment.template",
  "packages": {
    "npm": [
      "string"
    ],
    "python": [
      "string"
    ],
    "system": [
      "string"
    ]
  },
  "plugins": [
    {
      "description": "description",
      "name": "name",
      "type": "inline"
    }
  ],
  "skills": [
    {
      "skill_id": "skill_id",
      "type": "skill_reference",
      "version": "version"
    }
  ],
  "updated_at": 0,
  "desktop": {
    "enabled": true
  }
}
```

## Domain Types

### Environment Template

- `EnvironmentTemplate`

  Reusable configuration that provisions a fresh OpenAI-hosted environment for each session.

  - `id: string`

    The ID of the reusable environment template.

    `minLength: 0`

  - `capability_directories: Array<string>`

    Directories that expose capabilities to the agent.

    `minItems: 0`, `maxItems: 2000`

  - `created_at: number`

    The Unix timestamp, in seconds, when the template was created.

    `format: int64`

  - `files: Array<HostedTemplateFileResourceFileID | HostedTemplateFileResourceInline>`

    Safe file metadata, excluding contents and session-scoped file IDs.

    `minItems: 0`, `maxItems: 50`

    - `HostedTemplateFileResourceFileID`

      A project-scoped Files API reference resolved separately for each session.

      - `file_id: string`

        The ID of the uploaded file.

        `minLength: 0`

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `HostedTemplateFileResourceInline`

      Metadata for confidential inline file contents.

      - `path: string`

        The file's absolute path inside the environment.

        `minLength: 0`

      - `size_bytes: number`

        The decoded size of the inline file in bytes.

        `format: int64`, `minimum: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `name: string | null`

    An optional human-readable display name for the template.

    `minLength: 0`

  - `network: Network`

    Runtime network access for each OpenAI-hosted environment.

    - `access: "enabled" | "disabled" | "restricted"`

      The environment's network access mode.

      - `"enabled"`

        Allows unrestricted network access.

      - `"disabled"`

        Disables network access.

      - `"restricted"`

        Applies the configured domain restrictions.

    - `allowed_domains: Array<string>`

      Domains the environment may access when network access is restricted.

      `minItems: 0`, `maxItems: 2000`

  - `object: "agent.environment.template"`

    The object type. Always `agent.environment.template`.

    - `"agent.environment.template"`

  - `packages: Packages`

    Packages installed in each fresh OpenAI-hosted environment.

    - `npm: Array<string>`

      npm packages installed globally in the environment.

      `minItems: 0`, `maxItems: 16384`

    - `python: Array<string>`

      Python packages installed in the environment.

      `minItems: 0`, `maxItems: 16384`

    - `system: Array<string>`

      System packages installed in the environment.

      `minItems: 0`, `maxItems: 16384`

  - `plugins: Array<HostedPlugin>`

    Safe plugin metadata, excluding inline archive contents.

    `minItems: 0`, `maxItems: 32`

    - `description: string`

      The installed plugin description.

      `minLength: 0`

    - `name: string`

      The installed plugin name.

      `minLength: 0`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: Array<HostedTemplateSkillResourceSkillReference | HostedTemplateSkillResourceInline>`

    Safe skill metadata, preserving unresolved version selectors.

    `minItems: 0`, `maxItems: 200`

    - `HostedTemplateSkillResourceSkillReference`

      A skill resolved afresh from the Skills API whenever a session starts.

      - `skill_id: string`

        The referenced skill ID.

        `minLength: 0`

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string | null`

        The requested version selector, including `latest`.

        `minLength: 0`

    - `HostedTemplateSkillResourceInline`

      Safe metadata for an inline skill archive.

      - `description: string`

        The skill description declared in `SKILL.md`.

        `minLength: 0`

      - `name: string`

        The skill name declared in `SKILL.md`.

        `minLength: 0`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the template was last updated.

    `format: int64`

  - `desktop?: Desktop`

    Desktop configuration for each OpenAI-hosted environment.

    - `enabled: boolean`

      Whether the environment provisions a desktop and browser proxy.

### Environment Template Deleted

- `EnvironmentTemplateDeleted`

  A deleted reusable environment template.

  - `id: string`

    The ID of the deleted environment template.

    `minLength: 0`

  - `deleted: boolean`

    Whether the environment template was deleted. Always `true`.

  - `object: "agent.environment.template.deleted"`

    The object type. Always `agent.environment.template.deleted`.

    - `"agent.environment.template.deleted"`

# Sessions

## Create an agent session

`client.beta.agents.sessions.create(SessionCreateParamsbody, RequestOptionsoptions?): AgentSession | Stream<AgentSessionEvent>`

**post** `/agents/sessions`

Creates a managed agent session, optionally submits initial input, and returns the session or streams its events when stream is true. See [running sessions](/api/docs/guides/agents-api/sessions).

### Parameters

- `SessionCreateParams = SessionCreateParamsNonStreaming | SessionCreateParamsStreaming`

  - `SessionCreateParamsBase`

    - `environment: EnvironmentParam`

      An inline execution environment or a reference to an environment template.

      - `EnvironmentParamNone`

        Runs the agent without an execution environment.

        - `type: "none"`

          The type of the object. Always `none`.

          - `"none"`

      - `EnvironmentParamOpenAIHosted`

        An existing OpenAI-hosted environment or new inline/template-based hosted configuration.

        - `type: "openai_hosted"`

          The type of the object. Always `openai_hosted`.

          - `"openai_hosted"`

        - `capability_directories?: Array<string> | null`

          Directories that contain capabilities exposed to the agent. Defaults to an empty list.

          `minItems: 0`, `maxItems: 16384`

        - `container_size?: "small" | "medium" | "large"`

          The hosted container size. Omission selects the medium tier.

          - `"small"`

          - `"medium"`

          - `"large"`

        - `desktop?: Desktop | null`

          Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled.

          - `enabled: boolean`

            Whether to provision the desktop and its browser proxy.

        - `env?: Record<string, string> | null`

          Environment variables made available to the agent.

        - `environment_id?: string`

          An existing prewarmed environment. Cannot be combined with a template or inline configuration.

          `minLength: 9`, `maxLength: 256`

        - `environment_template_id?: string`

          A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy.

          `minLength: 0`, `maxLength: 64`

        - `files?: Array<HostedEnvironmentFileParam> | null`

          Files available before the agent starts. Defaults to an empty list.

          `minItems: 0`, `maxItems: 50`

          - `HostedEnvironmentFileParamFileID`

            A file previously uploaded through the OpenAI Files API.

            - `file_id: string`

              The ID of the uploaded file.

              `minLength: 1`, `maxLength: 256`

            - `path: string`

              The absolute destination path inside `/workspace`.

              `minLength: 1`, `maxLength: 4096`

            - `type: "file_id"`

              The type of the object. Always `file_id`.

              - `"file_id"`

          - `HostedEnvironmentFileParamInline`

            A file supplied directly as standard-base64 data.

            - `data: string`

              The standard-base64-encoded file contents.

              `minLength: 0`, `maxLength: 6990508`

            - `path: string`

              The absolute destination path inside `/workspace`.

              `minLength: 1`, `maxLength: 4096`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `network?: Network | null`

          Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled.

          - `access: "enabled" | "disabled" | "restricted"`

            The environment's network access mode.

            - `"enabled"`

              Allows unrestricted network access.

            - `"disabled"`

              Disables network access.

            - `"restricted"`

              Applies the configured domain restrictions.

          - `allowed_domains?: Array<string> | null`

            Domains the environment may access when network access is restricted.

            `minItems: 0`, `maxItems: 16384`

          - `blocked_domains?: Array<string> | null`

            Domains blocked for both executor and browser when access is restricted. A nonempty list requires `access: restricted` and cannot be combined with nonempty `allowed_domains`. Wildcard domains are not supported.

            `minItems: 0`, `maxItems: 100`

        - `packages?: Packages | null`

          Packages to install in the environment. Defaults to empty package lists.

          - `npm?: Array<string> | null`

            npm packages to install globally. Defaults to an empty list.

            `minItems: 0`, `maxItems: 16384`

          - `python?: Array<string> | null`

            Python packages to install. Defaults to an empty list.

            `minItems: 0`, `maxItems: 16384`

          - `system?: Array<string> | null`

            System packages to install. Defaults to an empty list.

            `minItems: 0`, `maxItems: 16384`

        - `plugins?: Array<HostedPluginParam> | null`

          Plugins provided as inline ZIP archives. Defaults to an empty list.

          `minItems: 0`, `maxItems: 32`

          - `description: string`

            The plugin description declared in `.codex-plugin/plugin.json`.

            `minLength: 0`, `maxLength: 1048576`

          - `name: string`

            The plugin name declared in `.codex-plugin/plugin.json`.

            `minLength: 1`, `maxLength: 64`

          - `source: InlineCapabilitySourceParam`

            Provides ZIP bytes encoded with standard base64.

            - `data: string`

              Standard-base64 encoded ZIP archive bytes.

              `minLength: 1`, `maxLength: 70254592`

            - `media_type: "application/zip"`

              The archive media type, always `application/zip`.

              - `"application/zip"`

            - `type: "base64"`

              The type of the object. Always `base64`.

              - `"base64"`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

        - `setup_commands?: Array<SetupCommandParam> | null`

          Ordered, confidential setup commands. Command bodies are never returned.

          `minItems: 0`, `maxItems: 16`

          - `command: string`

            The shell command to execute.

            `minLength: 0`, `maxLength: 65536`

          - `cwd?: string | null`

            The absolute working directory. Defaults to `/workspace`.

            `minLength: 0`, `maxLength: 4096`

        - `skills?: Array<HostedSkillParam> | null`

          Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.

          `minItems: 0`, `maxItems: 200`

          - `HostedSkillParamSkillReference`

            References a skill uploaded through the Skills API.

            - `skill_id: string`

              The ID of the skill created through `/v1/skills`.

              `minLength: 1`, `maxLength: 64`

            - `type: "skill_reference"`

              The type of the object. Always `skill_reference`.

              - `"skill_reference"`

            - `version?: string | null`

              The skill version, a positive integer or `latest`; omission selects the default.

              `minLength: 0`, `maxLength: 1048576`

          - `HostedSkillParamInline`

            Supplies a skill ZIP directly in the session request.

            - `description: string`

              The skill description declared in `SKILL.md`.

              `minLength: 0`, `maxLength: 1048576`

            - `name: string`

              The skill name declared in `SKILL.md`.

              `minLength: 1`, `maxLength: 64`

            - `source: InlineCapabilitySourceParam`

              Provides ZIP bytes encoded with standard base64.

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

      - `EnvironmentParamSelfHosted`

        An application-hosted environment configured inline.

        - `type: "self_hosted"`

          The type of the object. Always `self_hosted`.

          - `"self_hosted"`

        - `workspace_directory: string`

          Absolute project directory inside the self-hosted environment.

          `minLength: 0`, `maxLength: 1048576`

        - `capability_directories?: Array<string> | null`

          Directories that contain capabilities exposed to the agent. Defaults to an empty list.

          `minItems: 0`, `maxItems: 16384`

    - `agent?: Agent`

      Agent configuration. With `agent_id`, supplied fields override the saved agent for this session. Without `agent_id`, `model` is required.

      - `compaction?: Compaction | null`

        Context compaction settings. Omit to keep the current settings. A supplied object replaces the settings; null or an empty object enables background compaction.

        - `async?: boolean | null`

          Whether to compact context in the background. Omission or null defaults to true. Set to false to use blocking compaction. Background compaction may increase token usage.

      - `experimental?: Experimental`

        Experimental settings to merge by key. Omitted settings keep their current values.

        - `time_awareness?: boolean`

          Whether to give the model periodic current-time reminders. Omit to keep the current setting.

      - `instructions?: string | null`

        Additional instructions appended to the agent's default base instructions. Omit to leave unchanged.

        `minLength: 0`, `maxLength: 1048576`

      - `model?: string`

        The model to use for the agent. The requested model name is preserved.

        `minLength: 0`, `maxLength: 1048576`

      - `multi_agent?: MultiAgentConfigParam | null`

        Configuration for creating and coordinating subagents.

        - `enabled: boolean`

          Whether subagent tools are enabled.

        - `max_concurrent_subagents?: number`

          Maximum number of subagents that may run concurrently. Defaults to 6.

          `format: int64`, `minimum: 1`, `maximum: 4294967295`

      - `reasoning?: AgentReasoningParam | null`

        Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort.

        - `effort?: "none" | "minimal" | "low" | 4 more | null`

          The amount of reasoning effort the model should use. Omission lets the model select it.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

        - `summary?: "concise" | "detailed" | "auto" | null`

          Controls whether the response includes a reasoning summary.

          - `"concise"`

            Returns a concise reasoning summary when supported.

          - `"detailed"`

            Returns a detailed reasoning summary when supported.

          - `"auto"`

            Automatically selects the most detailed summary supported by the model.

      - `service_tier?: "auto" | "default" | "flex" | 3 more | null`

        The service tier used for model requests.

        - `auto` - Selects the service tier automatically.
        - `default` - Uses the default service tier.
        - `flex` - Uses the flex service tier.
        - `priority` - Uses the priority service tier.
        - `fast` - Uses the fast service tier.
        - `ultrafast` - Uses the ultrafast service tier.

        - `"auto"`

          Selects the service tier automatically.

        - `"default"`

          Uses the default service tier.

        - `"flex"`

          Uses the flex service tier.

        - `"priority"`

          Uses the priority service tier.

        - `"fast"`

          Uses the fast service tier.

        - `"ultrafast"`

          Uses the ultrafast service tier.

      - `text?: AgentTextParam | null`

        Configuration for text generated by the agent.

        - `format?: TextFormatParam | null`

          The output format. Omission uses ordinary text (`{"type": "text"}`).

          - `TextFormatParamText`

            Generates ordinary text without a structured-output constraint.

            - `type: "text"`

              The type of the object. Always `text`.

              - `"text"`

          - `TextFormatParamJSONSchema`

            Constrains generated text to a JSON Schema.

            - `schema: Record<string, unknown>`

              The JSON Schema that generated text must match.

            - `type: "json_schema"`

              The type of the object. Always `json_schema`.

              - `"json_schema"`

        - `verbosity?: "low" | "medium" | "high" | null`

          The amount of text the model should produce. Defaults to `medium`, matching Responses.

          - `"low"`

            Produces less text.

          - `"medium"`

            Uses the default amount of text.

          - `"high"`

            Produces more text.

      - `tools?: Array<AgentToolParam> | null`

        Tools available to the agent. Omit to inherit, or pass null to clear them. The resolved tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON.

        `minItems: 0`, `maxItems: 16384`

        - `AgentToolConfigParamFunction`

          A function defined by the application.

          - `description: string`

            A description of what the function does.

            `minLength: 0`, `maxLength: 1048576`

          - `name: string`

            The name of the function.

            `minLength: 0`, `maxLength: 1048576`

          - `parameters: Record<string, unknown>`

            A JSON Schema object describing the function's arguments.

          - `type: "function"`

            The type of the object. Always `function`.

            - `"function"`

          - `async?: boolean`

            Whether the agent continues without waiting for the function result. Defaults to `false`.

          - `defer_loading?: boolean`

            Whether this function is deferred and discovered through tool search. Defaults to `false`.

        - `AgentToolConfigParamToolSearch`

          Discovers deferred function tools and loads them into the model context.

          - `type: "tool_search"`

            The type of the object. Always `tool_search`.

            - `"tool_search"`

        - `AgentToolConfigParamProgrammaticToolCalling`

          Enables calling tools from model-generated code.

          - `type: "programmatic_tool_calling"`

            The type of the object. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

          - `enabled?: boolean`

            Whether tools can be called from model-generated code. Defaults to `true`.

        - `AgentToolConfigParamMcp`

          Tools provided by a remote MCP server.

          - `server_label: string`

            A label used to identify the MCP server in tool calls.

            `minLength: 0`, `maxLength: 1048576`

          - `transport: McpTransportParam`

            The transport used to connect to the MCP server.

            - `McpTransportConfigParamHTTP`

              Connects to an MCP server over HTTP.

              - `server_url: string`

                The URL of the MCP server.

                `minLength: 0`, `maxLength: 1048576`

              - `type: "http"`

                The type of the object. Always `http`.

                - `"http"`

              - `authorization?: string | null`

                The authorization value sent to the MCP server, if any.

                `minLength: 0`, `maxLength: 1048576`

              - `headers?: Record<string, string> | null`

                Additional HTTP headers sent to the MCP server.

            - `McpTransportConfigParamStdio`

              Starts an MCP server as a local process.

              - `command: string`

                The command used to start the MCP server.

                `minLength: 0`, `maxLength: 1048576`

              - `cwd: string`

                The working directory used to start the MCP server.

                `minLength: 0`, `maxLength: 1048576`

              - `type: "stdio"`

                The type of the object. Always `stdio`.

                - `"stdio"`

              - `args?: Array<string> | null`

                Arguments passed to the MCP server command.

                `minItems: 0`, `maxItems: 16384`

              - `env?: Record<string, string> | null`

                Environment variables set for the MCP server process.

              - `env_vars?: Array<string> | null`

                Environment variable names to inherit from the selected execution environment.

                `minItems: 0`, `maxItems: 16384`

          - `type: "mcp"`

            The type of the object. Always `mcp`.

            - `"mcp"`

          - `allowed_tools?: Array<string> | null`

            The MCP tools the agent may call. All server tools are allowed when omitted.

            `minItems: 0`, `maxItems: 16384`

          - `connection_origin?: "service" | "environment" | null`

            Selects where outbound MCP HTTP connections originate. Omitted or `service` uses the Managed Agents service network; `environment` uses the session's selected environment.

            - `"service"`

              Uses the Managed Agents service network.

            - `"environment"`

              Uses the session's execution environment.

          - `credential_id?: string | null`

            The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL.

            `minLength: 0`, `maxLength: 1048576`

          - `request_metadata?: Record<string, unknown> | null`

            Metadata included with requests to this MCP server.

          - `required?: boolean`

            Whether this MCP server must initialize before the first turn. Defaults to `false`.

        - `AgentToolConfigParamWebSearch`

          Web search.

          - `type: "web_search"`

            The type of the object. Always `web_search`.

            - `"web_search"`

          - `allowed_domains?: Array<string> | null`

            Domains the search may include.

            `minItems: 0`, `maxItems: 16384`

          - `context_size?: "low" | "medium" | "high" | null`

            The amount of search context made available to the model. Defaults to `medium`.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `location?: Location | null`

            Approximate location used to localize search results.

            - `city?: string | null`

              The city name.

              `minLength: 0`, `maxLength: 1048576`

            - `country?: string | null`

              The two-letter ISO country code, such as `US`.

              `minLength: 0`, `maxLength: 1048576`

            - `region?: string | null`

              The region or state name.

              `minLength: 0`, `maxLength: 1048576`

            - `timezone?: string | null`

              The IANA timezone, such as `America/Los_Angeles`.

              `minLength: 0`, `maxLength: 1048576`

          - `mode?: "disabled" | "cached" | "live" | null`

            The source used for web search results. Defaults to `live`.

            - `"disabled"`

              Disables web search.

            - `"cached"`

              Uses cached search results.

            - `"live"`

              Searches the live web.

        - `AgentToolConfigParamComputerUse`

          Browser use in an OpenAI-hosted session.

          - `type: "computer_use"`

            The type of the object. Always `computer_use`.

            - `"computer_use"`

          - `include_screenshots?: boolean`

            Whether computer tool outputs include screenshots. Defaults to `false`.

        - `AgentToolConfigParamAutomations`

          Lets the agent manage its own scheduled wakeups.

          - `type: "automations"`

            The type of the object. Always `automations`.

            - `"automations"`

    - `agent_id?: string`

      The ID of a saved reusable agent. Omit `agent` to use its configuration unchanged.

      `minLength: 0`, `maxLength: 64`

    - `input?: string | Array<AgentSessionInputMessageParam> | null`

      Initial input to submit when the session is created. A string is shorthand for a single user message. Required when `environment.type` is `none`, or when `stream` is `true` for an environment that is not `self_hosted`; optional for self-hosted and non-streaming execution environments.

      - `string`

      - `Array<AgentSessionInputMessageParam>`

        - `content: Array<InputContentParam>`

          The content of the message.

          `minItems: 0`, `maxItems: 16384`

          - `InputContentParamInputText`

            Text input to the model.

            - `text: string`

              The text sent to the model.

              `minLength: 0`, `maxLength: 1048576`

            - `type: "input_text"`

              The type of the object. Always `input_text`.

              - `"input_text"`

          - `InputContentParamInputImage`

            Image input to the model.

            - `image_url: string`

              The URL of the image sent to the model.

              `minLength: 0`, `maxLength: 1048576`

            - `type: "input_image"`

              The type of the object. Always `input_image`.

              - `"input_image"`

        - `role: "user"`

          The role of the message author. Always `user`.

          - `"user"`

        - `type?: "message"`

          The type of the input item. Always `message`.

          - `"message"`

    - `metadata?: Record<string, string> | null`

      Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map.

    - `prompt_cache_options?: PromptCacheOptions | null`

      Default prompt cache lifetime for turns in this session. Omit to use the model default.

      - `ttl?: "30m" | "12h"`

        Minimum lifetime for new prompt cache entries. Defaults to 30 minutes.

        - `"30m"`

        - `"12h"`

    - `review?: "none" | "auto_review"`

      Action review mode. Omit to use none.

      - `"none"`

        Keep the existing execution behavior without automatic action review.

      - `"auto_review"`

        Review eligible actions automatically. Deny manual approval fallbacks.

    - `spend_control?: SpendControl | null`

      Optional spending limit in USD cents. Omission or null creates an unlimited session.

      - `limit: number | null`

        Positive USD cents, or null to remove the limit.

        `format: int64`, `minimum: 1`, `maximum: 4503599627370495`

    - `stream?: false`

      Whether to stream session events as server-sent events. Defaults to `false`.

      - `false`

    - `stream_options?: StreamOptions`

      Options for the event stream. Only allowed when `stream` is `true`.

      - `include_obfuscation?: boolean`

        Whether to include obfuscation padding in events on this connection. Defaults to `true`.

    - `vault_ids?: Array<string> | null`

      The IDs of vaults made available to the session.

      `minItems: 0`, `maxItems: 16384`

  - `SessionCreateParamsNonStreaming extends SessionCreateParamsBase`

    - `stream?: false`

      Whether to stream session events as server-sent events. Defaults to `false`.

  - `SessionCreateParamsStreaming extends SessionCreateParamsBase`

    - `stream: true`

      Whether to stream session events as server-sent events. Defaults to `false`.

      - `true`

### Returns

- `AgentSession`

  A Managed Agents session.

  - `id: string`

    The ID of the session.

    `minLength: 0`

  - `agent: Agent`

    The agent running in the session.

    - `id: string`

      The ID of the agent.

      `minLength: 0`

    - `instructions: string | null`

      Custom instructions appended to the agent's default base instructions.

      `minLength: 0`

    - `model: string`

      The model used by the agent.

      `minLength: 0`

    - `multi_agent: MultiAgentConfig`

      Configuration for creating and coordinating subagents.

      - `enabled: boolean`

        Whether subagent tools are enabled. Defaults to false.

      - `max_concurrent_subagents: number | null`

        Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

        `format: int64`, `minimum: 1`, `maximum: 4294967295`

    - `name: string | null`

      The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

      `minLength: 0`

    - `reasoning: AgentReasoning`

      The agent's reasoning configuration.

      - `effort: "none" | "minimal" | "low" | 4 more | null`

        The requested reasoning effort, or `null` when the model selects its own default.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `summary: "concise" | "detailed" | "auto" | null`

        The requested reasoning summary format, or `null` when summaries are disabled.

        - `"concise"`

          Returns a concise reasoning summary when supported.

        - `"detailed"`

          Returns a detailed reasoning summary when supported.

        - `"auto"`

          Automatically selects the most detailed summary supported by the model.

    - `service_tier: "auto" | "default" | "flex" | 3 more`

      The effective service-tier policy for model requests. Defaults to `auto`.

      - `"auto"`

      - `"default"`

      - `"flex"`

      - `"priority"`

      - `"fast"`

      - `"ultrafast"`

    - `text: AgentText`

      Configuration for text generated by the agent.

      - `format: TextFormat`

        The effective output format. Defaults to ordinary text.

        - `TextFormatResourceText`

          Generates ordinary text without a structured-output constraint.

          - `type: "text"`

            The type of the object. Always `text`.

            - `"text"`

        - `TextFormatResourceJSONSchema`

          Constrains generated text to a JSON Schema.

          - `schema: Record<string, unknown>`

            The JSON Schema that generated text must match.

          - `type: "json_schema"`

            The type of the object. Always `json_schema`.

            - `"json_schema"`

      - `verbosity: "low" | "medium" | "high"`

        The amount of text produced by the agent. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tools: Array<AgentTool>`

      Tools available to the agent.

      `minItems: 0`, `maxItems: 2000`

      - `AgentToolResourceFunction`

        A function defined by the application.

        - `defer_loading: boolean`

          Whether the function is deferred and discovered through tool search.

        - `description: string`

          A description of what the function does.

          `minLength: 0`

        - `name: string`

          The name of the function.

          `minLength: 0`

        - `parameters: Record<string, unknown>`

          A JSON Schema object describing the function's arguments.

        - `type: "function"`

          The type of the object. Always `function`.

          - `"function"`

        - `async?: boolean`

          Whether the agent continues without waiting for the function result.

      - `AgentToolResourceProgrammaticToolCalling`

        Enables calling tools from model-generated code.

        - `enabled: boolean`

          Whether tools can be called from model-generated code.

        - `type: "programmatic_tool_calling"`

          The type of the object. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `AgentToolResourceMcp`

        Tools provided by a remote MCP server.

        - `allowed_tools: Array<string> | null`

          The MCP tools the agent may call.

          `minItems: 0`, `maxItems: 2000`

        - `connection_origin: "service" | "environment"`

          Where outbound MCP HTTP connections originate.

          - `"service"`

          - `"environment"`

        - `credential_id: string | null`

          The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

          `minLength: 0`

        - `request_metadata: Record<string, unknown>`

          Metadata included with requests to this MCP server.

        - `required: boolean`

          Whether this MCP server must initialize before the first turn.

        - `server_label: string`

          A label used to identify the MCP server in tool calls.

          `minLength: 0`

        - `transport: McpTransport`

          The transport used to connect to the MCP server.

          - `McpTransportResourceHTTP`

            Connects to an MCP server over HTTP.

            - `server_url: string`

              The URL of the MCP server.

              `minLength: 0`

            - `type: "http"`

              The type of the object. Always `http`.

              - `"http"`

          - `McpTransportResourceStdio`

            Starts an MCP server as a local process.

            - `args: Array<string>`

              Arguments passed to the MCP server command.

              `minItems: 0`, `maxItems: 2000`

            - `command: string`

              The command used to start the MCP server.

              `minLength: 0`

            - `cwd: string`

              The working directory used to start the MCP server.

              `minLength: 0`

            - `env_vars: Array<string>`

              Environment variable names inherited from the execution environment.

              `minItems: 0`, `maxItems: 2000`

            - `type: "stdio"`

              The type of the object. Always `stdio`.

              - `"stdio"`

        - `type: "mcp"`

          The type of the object. Always `mcp`.

          - `"mcp"`

      - `AgentToolResourceWebSearch`

        Web search.

        - `allowed_domains: Array<string> | null`

          Allowed search domains, or `null` when the search is unrestricted.

          `minItems: 0`, `maxItems: 2000`

        - `context_size: "low" | "medium" | "high"`

          The amount of search context made available to the model. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `location: Location | null`

          Approximate location used to localize search results, if provided.

          - `city: string | null`

            The city name.

            `minLength: 0`

          - `country: string | null`

            The two-letter ISO country code, such as `US`.

            `minLength: 0`

          - `region: string | null`

            The region or state name.

            `minLength: 0`

          - `timezone: string | null`

            The IANA timezone, such as `America/Los_Angeles`.

            `minLength: 0`

        - `mode: "disabled" | "cached" | "live"`

          The source used for web search results.

          - `"disabled"`

          - `"cached"`

          - `"live"`

        - `type: "web_search"`

          The type of the object. Always `web_search`.

          - `"web_search"`

      - `AgentToolResourceComputerUse`

        Browser use in an OpenAI-hosted session.

        - `include_screenshots: boolean`

          Whether computer tool outputs include screenshots.

        - `type: "computer_use"`

          The type of the object. Always `computer_use`.

          - `"computer_use"`

      - `AgentToolResourceAutomations`

        Lets the agent manage its own scheduled wakeups.

        - `type: "automations"`

          The type of the object. Always `automations`.

          - `"automations"`

    - `compaction?: Compaction`

      The effective context compaction settings.

      - `async: boolean`

        Whether context is compacted in the background. Defaults to true.

    - `experimental?: Experimental`

      The effective experimental settings for the agent.

      - `time_awareness: boolean`

        Whether the model receives periodic current-time reminders.

  - `created_at: number`

    The Unix timestamp, in seconds, when the session was created.

    `format: int64`

  - `environment: Environment`

    The execution environment for the session.

    - `EnvironmentResourceNone`

      The session talks to CCA without selecting or provisioning an execution environment.

      - `type: "none"`

        The type of the object. Always `none`.

        - `"none"`

    - `EnvironmentResourceOpenAIHosted`

      An environment hosted by OpenAI.

      - `id: string`

        The public ID of the environment.

        `minLength: 0`

      - `capability_directories: Array<string>`

        Directories that contain capabilities exposed to the agent.

        `minItems: 0`, `maxItems: 2000`

      - `files: Array<HostedEnvironmentFile>`

        Files available in the environment, excluding their contents.

        `minItems: 0`, `maxItems: 50`

        - `HostedEnvironmentFileID`

          A file copied from the OpenAI Files API.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

            `minLength: 0`

          - `file_id: string`

            The ID of the uploaded file.

            `minLength: 0`

          - `path: string`

            The file's absolute path inside the environment.

            `minLength: 0`

          - `size_bytes: number`

            The decoded file size in bytes.

            `format: int64`, `minimum: 0`

          - `type: "file_id"`

            The type of the object. Always `file_id`.

            - `"file_id"`

        - `HostedEnvironmentFileResourceInline`

          A file supplied inline when the session was created.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

            `minLength: 0`

          - `path: string`

            The file's absolute path inside the environment.

            `minLength: 0`

          - `size_bytes: number`

            The decoded file size in bytes.

            `format: int64`, `minimum: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `network: Network`

        The effective network access policy for the environment.

        - `access: "enabled" | "disabled" | "restricted"`

          The environment's network access mode.

          - `"enabled"`

            Allows unrestricted network access.

          - `"disabled"`

            Disables network access.

          - `"restricted"`

            Applies the configured domain restrictions.

        - `allowed_domains: Array<string>`

          Domains the environment may access when network access is restricted.

          `minItems: 0`, `maxItems: 2000`

      - `packages: Packages`

        Packages installed in the environment.

        - `npm: Array<string>`

          npm packages installed globally in the environment.

          `minItems: 0`, `maxItems: 16384`

        - `python: Array<string>`

          Python packages installed in the environment.

          `minItems: 0`, `maxItems: 16384`

        - `system: Array<string>`

          System packages installed in the environment.

          `minItems: 0`, `maxItems: 16384`

      - `plugins: Array<HostedPlugin>`

        Plugins installed in the environment, excluding their archive contents.

        `minItems: 0`, `maxItems: 2000`

        - `description: string`

          The installed plugin description.

          `minLength: 0`

        - `name: string`

          The installed plugin name.

          `minLength: 0`

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

      - `skills: Array<HostedSkill>`

        Skills installed in the environment, excluding their archive contents.

        `minItems: 0`, `maxItems: 2000`

        - `HostedSkillReference`

          A skill installed from the Skills API.

          - `description: string`

            The installed skill description.

            `minLength: 0`

          - `name: string`

            The installed skill name.

            `minLength: 0`

          - `skill_id: string`

            The referenced skill ID.

            `minLength: 0`

          - `type: "skill_reference"`

            The type of the object. Always `skill_reference`.

            - `"skill_reference"`

          - `version: string`

            The concrete skill version installed for this session.

            `minLength: 0`

        - `HostedSkillResourceInline`

          A skill installed from an inline ZIP archive.

          - `description: string`

            The installed skill description.

            `minLength: 0`

          - `name: string`

            The installed skill name.

            `minLength: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `type: "openai_hosted"`

        The type of the object. Always `openai_hosted`.

        - `"openai_hosted"`

      - `container_size?: "small" | "medium" | "large" | null`

        The effective CPU and memory tier, or null when unknown or outside the public tiers.

        - `"small"`

        - `"medium"`

        - `"large"`

      - `desktop?: Desktop`

        The effective desktop configuration.

        - `enabled: boolean`

          Whether the environment provisions a desktop and browser proxy.

    - `EnvironmentResourceSelfHosted`

      An environment hosted by the application.

      - `id: string`

        The public ID of the environment.

        `minLength: 0`

      - `capability_directories: Array<string>`

        Directories that contain capabilities exposed to the agent.

        `minItems: 0`, `maxItems: 2000`

      - `remote_url: string`

        Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

        `minLength: 0`

      - `type: "self_hosted"`

        The type of the object. Always `self_hosted`.

        - `"self_hosted"`

      - `workspace_directory: string`

        The absolute project directory inside the environment. Defaults to `/workspace`.

        `minLength: 0`

  - `error: string | null`

    The error that caused the session to fail, if any.

    `minLength: 0`

  - `last_active_at: number`

    The Unix timestamp, in seconds, when the session was last active.

    `format: int64`

  - `metadata: Record<string, string>`

    Custom string key-value pairs attached to the session.

  - `object: "agent.session"`

    The object type. Always `agent.session`.

    - `"agent.session"`

  - `required_actions: Array<SessionRequiredActionResourceComputerUseApprovalRequest | SessionRequiredActionResourceFunctionCall | SessionRequiredActionResourceEnvironmentConnection>`

    Actions that must be completed before the session can continue.

    `minItems: 0`, `maxItems: 2000`

    - `SessionRequiredActionResourceComputerUseApprovalRequest`

      Respond to a computer-use request.

      - `request: ComputerUseApprovalRequestKindResourceBrowserAuthentication | ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

        The information needed to render the request.

        - `ComputerUseApprovalRequestKindResourceBrowserAuthentication`

          A registered form awaiting the application's response.

          - `credential_origin: string | null`

            The registered form or frame origin where values will be entered.

            `minLength: 0`

          - `fields: Array<Field>`

            Controls to render. All submitted values are sensitive.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The field ID to submit as field_id in a fields entry.

              `minLength: 0`

            - `label: string`

              The label to display beside the control.

              `minLength: 0`

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

              `minLength: 0`

          - `options: Array<Option>`

            Sign-in methods. Empty for a plain form.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The option ID to submit as selected_option.

              `minLength: 0`

            - `field_ids: Array<string>`

              IDs from the registered fields that this method accepts.

              `minItems: 0`, `maxItems: 2000`

            - `label: string`

              The method label to display.

              `minLength: 0`

          - `reason: string | null`

            Why the agent needs the user to sign in.

            `minLength: 0`

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

          A browser origin awaiting the application's approval decision.

          - `origin: string`

            The origin the browser needs permission to access.

            `minLength: 0`

          - `reason: string | null`

            The browser's explanation for this request, or null when unavailable.

            `minLength: 0`

          - `type: "browser_origin_access"`

            The type of the object. Always `browser_origin_access`.

            - `"browser_origin_access"`

      - `request_id: string`

        The registered request ID to echo when responding.

        `minLength: 0`

      - `turn_id: string`

        The turn that requested approval.

        `minLength: 0`

      - `type: "computer_use_approval_request"`

        The type of the object. Always `computer_use_approval_request`.

        - `"computer_use_approval_request"`

    - `SessionRequiredActionResourceFunctionCall`

      Run a function tool and submit its result.

      - `arguments: unknown`

        The arguments supplied by the model.

      - `call_id: string`

        The ID to include when submitting the function result.

        `minLength: 0`

      - `name: string`

        The function name.

        `minLength: 0`

      - `turn_id: string`

        The ID of the turn that requested the function call.

        `minLength: 0`

      - `type: "function_call"`

        The type of the object. Always `function_call`.

        - `"function_call"`

    - `SessionRequiredActionResourceEnvironmentConnection`

      Reconnect a session environment.

      - `environment_id: string`

        The ID of the environment to reconnect.

        `minLength: 0`

      - `type: "environment_connection"`

        The type of the object. Always `environment_connection`.

        - `"environment_connection"`

  - `status: "idle" | "in_progress" | "requires_action" | "failed"`

    The current status of the session.

    - `"idle"`

      The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

    - `"in_progress"`

      The session is processing a turn.

    - `"requires_action"`

      The session is waiting for one or more required actions.

    - `"failed"`

      The session failed.

  - `usage: TokenUsage | null`

    Best-effort token usage for the session, or null if unknown. Recorded usage may change.

    - `input_tokens: number`

      The number of input tokens used by the agent.

      `format: int64`

    - `input_tokens_details: InputTokensDetails`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

        `format: int64`

    - `output_tokens: number`

      The number of output tokens generated by the agent.

      `format: int64`

    - `output_tokens_details: OutputTokensDetails`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

        `format: int64`

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

      `format: int64`

  - `vault_ids: Array<string>`

    The IDs of vaults made available to the session.

    `minItems: 0`, `maxItems: 2000`

  - `prompt_cache_options?: PromptCacheOptions | null`

    Default prompt cache lifetime for turns in this session, when configured.

    - `ttl: "30m" | "12h"`

      - `"30m"`

      - `"12h"`

  - `review?: "none" | "auto_review"`

    Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none.

    - `"none"`

    - `"auto_review"`

  - `spend_control?: SpendControl`

    Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object.

    - `consumed: number | null`

      Best-effort recorded spend floored to whole USD cents, or null when unavailable.

      `minimum: 0`

    - `limit: number`

      The configured positive limit in USD cents.

      `format: int64`, `minimum: 1`, `maximum: 4503599627370495`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const agentSession = await client.beta.agents.sessions.create({ environment: { type: 'none' } });

console.log(agentSession.id);
```

#### 201 — Example

```json
{
  "id": "id",
  "agent": {
    "id": "id",
    "instructions": "instructions",
    "model": "model",
    "multi_agent": {
      "enabled": true,
      "max_concurrent_subagents": 1
    },
    "name": "name",
    "reasoning": {
      "effort": "none",
      "summary": "concise"
    },
    "service_tier": "auto",
    "text": {
      "format": {
        "type": "text"
      },
      "verbosity": "low"
    },
    "tools": [
      {
        "defer_loading": true,
        "description": "description",
        "name": "name",
        "parameters": {
          "foo": "bar"
        },
        "type": "function",
        "async": true
      }
    ],
    "compaction": {
      "async": true
    },
    "experimental": {
      "time_awareness": true
    }
  },
  "created_at": 0,
  "environment": {
    "type": "none"
  },
  "error": "error",
  "last_active_at": 0,
  "metadata": {
    "foo": "string"
  },
  "object": "agent.session",
  "required_actions": [
    {
      "request": {
        "credential_origin": "credential_origin",
        "fields": [
          {
            "id": "id",
            "label": "label",
            "required": true,
            "type": "type"
          }
        ],
        "options": [
          {
            "id": "id",
            "field_ids": [
              "string"
            ],
            "label": "label"
          }
        ],
        "reason": "reason",
        "type": "browser_authentication"
      },
      "request_id": "request_id",
      "turn_id": "turn_id",
      "type": "computer_use_approval_request"
    }
  ],
  "status": "idle",
  "usage": {
    "input_tokens": 0,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 0,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 0
  },
  "vault_ids": [
    "string"
  ],
  "prompt_cache_options": {
    "ttl": "30m"
  },
  "review": "none",
  "spend_control": {
    "consumed": 0,
    "limit": 1
  }
}
```

## Delete an agent session

`client.beta.agents.sessions.delete(stringsessionID, RequestOptionsoptions?): AgentSessionDeleted`

**delete** `/agents/sessions/{session_id}`

Removes a managed agent session from the public API and returns a deletion confirmation. If backend execution has ended, deletion can cancel a still-open public turn and abandon unpublished outputs. Running execution must be cancelled first. Physical cleanup may continue asynchronously. See [managing sessions](/api/docs/guides/agents-api/sessions/manage).

### Parameters

- `sessionID: string`

  `minLength: 0`, `maxLength: 1048576`

### Returns

- `AgentSessionDeleted`

  A Managed Agents session removed from the public API. Physical cleanup may continue asynchronously.

  - `id: string`

    The ID of the deleted session.

    `minLength: 0`

  - `deleted: boolean`

    Whether the session has been removed from the public API. Always `true`. Physical cleanup may still be in progress.

  - `object: "agent.session.deleted"`

    The object type. Always `agent.session.deleted`.

    - `"agent.session.deleted"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const agentSessionDeleted = await client.beta.agents.sessions.delete('session_id');

console.log(agentSessionDeleted.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "deleted": true,
  "object": "agent.session.deleted"
}
```

## List agent sessions

`client.beta.agents.sessions.list(SessionListParamsquery?, RequestOptionsoptions?): CursorPage<AgentSession>`

**get** `/agents/sessions`

Lists managed agent sessions using ID-based pagination and the requested sort order. See [managing sessions](/api/docs/guides/agents-api/sessions/manage).

### Parameters

- `query: SessionListParams`

  - `after?: string`

    Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `agent_id?: string`

    Only return sessions whose root agent has this ID. Omit to return sessions for all agents.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `metadata?: Record<string, string>`

    Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. New sessions and metadata updates may take time to appear in filtered results.

  - `order?: "asc" | "desc"`

    The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

### Returns

- `AgentSession`

  A Managed Agents session.

  - `id: string`

    The ID of the session.

    `minLength: 0`

  - `agent: Agent`

    The agent running in the session.

    - `id: string`

      The ID of the agent.

      `minLength: 0`

    - `instructions: string | null`

      Custom instructions appended to the agent's default base instructions.

      `minLength: 0`

    - `model: string`

      The model used by the agent.

      `minLength: 0`

    - `multi_agent: MultiAgentConfig`

      Configuration for creating and coordinating subagents.

      - `enabled: boolean`

        Whether subagent tools are enabled. Defaults to false.

      - `max_concurrent_subagents: number | null`

        Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

        `format: int64`, `minimum: 1`, `maximum: 4294967295`

    - `name: string | null`

      The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

      `minLength: 0`

    - `reasoning: AgentReasoning`

      The agent's reasoning configuration.

      - `effort: "none" | "minimal" | "low" | 4 more | null`

        The requested reasoning effort, or `null` when the model selects its own default.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `summary: "concise" | "detailed" | "auto" | null`

        The requested reasoning summary format, or `null` when summaries are disabled.

        - `"concise"`

          Returns a concise reasoning summary when supported.

        - `"detailed"`

          Returns a detailed reasoning summary when supported.

        - `"auto"`

          Automatically selects the most detailed summary supported by the model.

    - `service_tier: "auto" | "default" | "flex" | 3 more`

      The effective service-tier policy for model requests. Defaults to `auto`.

      - `"auto"`

      - `"default"`

      - `"flex"`

      - `"priority"`

      - `"fast"`

      - `"ultrafast"`

    - `text: AgentText`

      Configuration for text generated by the agent.

      - `format: TextFormat`

        The effective output format. Defaults to ordinary text.

        - `TextFormatResourceText`

          Generates ordinary text without a structured-output constraint.

          - `type: "text"`

            The type of the object. Always `text`.

            - `"text"`

        - `TextFormatResourceJSONSchema`

          Constrains generated text to a JSON Schema.

          - `schema: Record<string, unknown>`

            The JSON Schema that generated text must match.

          - `type: "json_schema"`

            The type of the object. Always `json_schema`.

            - `"json_schema"`

      - `verbosity: "low" | "medium" | "high"`

        The amount of text produced by the agent. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tools: Array<AgentTool>`

      Tools available to the agent.

      `minItems: 0`, `maxItems: 2000`

      - `AgentToolResourceFunction`

        A function defined by the application.

        - `defer_loading: boolean`

          Whether the function is deferred and discovered through tool search.

        - `description: string`

          A description of what the function does.

          `minLength: 0`

        - `name: string`

          The name of the function.

          `minLength: 0`

        - `parameters: Record<string, unknown>`

          A JSON Schema object describing the function's arguments.

        - `type: "function"`

          The type of the object. Always `function`.

          - `"function"`

        - `async?: boolean`

          Whether the agent continues without waiting for the function result.

      - `AgentToolResourceProgrammaticToolCalling`

        Enables calling tools from model-generated code.

        - `enabled: boolean`

          Whether tools can be called from model-generated code.

        - `type: "programmatic_tool_calling"`

          The type of the object. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `AgentToolResourceMcp`

        Tools provided by a remote MCP server.

        - `allowed_tools: Array<string> | null`

          The MCP tools the agent may call.

          `minItems: 0`, `maxItems: 2000`

        - `connection_origin: "service" | "environment"`

          Where outbound MCP HTTP connections originate.

          - `"service"`

          - `"environment"`

        - `credential_id: string | null`

          The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

          `minLength: 0`

        - `request_metadata: Record<string, unknown>`

          Metadata included with requests to this MCP server.

        - `required: boolean`

          Whether this MCP server must initialize before the first turn.

        - `server_label: string`

          A label used to identify the MCP server in tool calls.

          `minLength: 0`

        - `transport: McpTransport`

          The transport used to connect to the MCP server.

          - `McpTransportResourceHTTP`

            Connects to an MCP server over HTTP.

            - `server_url: string`

              The URL of the MCP server.

              `minLength: 0`

            - `type: "http"`

              The type of the object. Always `http`.

              - `"http"`

          - `McpTransportResourceStdio`

            Starts an MCP server as a local process.

            - `args: Array<string>`

              Arguments passed to the MCP server command.

              `minItems: 0`, `maxItems: 2000`

            - `command: string`

              The command used to start the MCP server.

              `minLength: 0`

            - `cwd: string`

              The working directory used to start the MCP server.

              `minLength: 0`

            - `env_vars: Array<string>`

              Environment variable names inherited from the execution environment.

              `minItems: 0`, `maxItems: 2000`

            - `type: "stdio"`

              The type of the object. Always `stdio`.

              - `"stdio"`

        - `type: "mcp"`

          The type of the object. Always `mcp`.

          - `"mcp"`

      - `AgentToolResourceWebSearch`

        Web search.

        - `allowed_domains: Array<string> | null`

          Allowed search domains, or `null` when the search is unrestricted.

          `minItems: 0`, `maxItems: 2000`

        - `context_size: "low" | "medium" | "high"`

          The amount of search context made available to the model. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `location: Location | null`

          Approximate location used to localize search results, if provided.

          - `city: string | null`

            The city name.

            `minLength: 0`

          - `country: string | null`

            The two-letter ISO country code, such as `US`.

            `minLength: 0`

          - `region: string | null`

            The region or state name.

            `minLength: 0`

          - `timezone: string | null`

            The IANA timezone, such as `America/Los_Angeles`.

            `minLength: 0`

        - `mode: "disabled" | "cached" | "live"`

          The source used for web search results.

          - `"disabled"`

          - `"cached"`

          - `"live"`

        - `type: "web_search"`

          The type of the object. Always `web_search`.

          - `"web_search"`

      - `AgentToolResourceComputerUse`

        Browser use in an OpenAI-hosted session.

        - `include_screenshots: boolean`

          Whether computer tool outputs include screenshots.

        - `type: "computer_use"`

          The type of the object. Always `computer_use`.

          - `"computer_use"`

      - `AgentToolResourceAutomations`

        Lets the agent manage its own scheduled wakeups.

        - `type: "automations"`

          The type of the object. Always `automations`.

          - `"automations"`

    - `compaction?: Compaction`

      The effective context compaction settings.

      - `async: boolean`

        Whether context is compacted in the background. Defaults to true.

    - `experimental?: Experimental`

      The effective experimental settings for the agent.

      - `time_awareness: boolean`

        Whether the model receives periodic current-time reminders.

  - `created_at: number`

    The Unix timestamp, in seconds, when the session was created.

    `format: int64`

  - `environment: Environment`

    The execution environment for the session.

    - `EnvironmentResourceNone`

      The session talks to CCA without selecting or provisioning an execution environment.

      - `type: "none"`

        The type of the object. Always `none`.

        - `"none"`

    - `EnvironmentResourceOpenAIHosted`

      An environment hosted by OpenAI.

      - `id: string`

        The public ID of the environment.

        `minLength: 0`

      - `capability_directories: Array<string>`

        Directories that contain capabilities exposed to the agent.

        `minItems: 0`, `maxItems: 2000`

      - `files: Array<HostedEnvironmentFile>`

        Files available in the environment, excluding their contents.

        `minItems: 0`, `maxItems: 50`

        - `HostedEnvironmentFileID`

          A file copied from the OpenAI Files API.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

            `minLength: 0`

          - `file_id: string`

            The ID of the uploaded file.

            `minLength: 0`

          - `path: string`

            The file's absolute path inside the environment.

            `minLength: 0`

          - `size_bytes: number`

            The decoded file size in bytes.

            `format: int64`, `minimum: 0`

          - `type: "file_id"`

            The type of the object. Always `file_id`.

            - `"file_id"`

        - `HostedEnvironmentFileResourceInline`

          A file supplied inline when the session was created.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

            `minLength: 0`

          - `path: string`

            The file's absolute path inside the environment.

            `minLength: 0`

          - `size_bytes: number`

            The decoded file size in bytes.

            `format: int64`, `minimum: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `network: Network`

        The effective network access policy for the environment.

        - `access: "enabled" | "disabled" | "restricted"`

          The environment's network access mode.

          - `"enabled"`

            Allows unrestricted network access.

          - `"disabled"`

            Disables network access.

          - `"restricted"`

            Applies the configured domain restrictions.

        - `allowed_domains: Array<string>`

          Domains the environment may access when network access is restricted.

          `minItems: 0`, `maxItems: 2000`

      - `packages: Packages`

        Packages installed in the environment.

        - `npm: Array<string>`

          npm packages installed globally in the environment.

          `minItems: 0`, `maxItems: 16384`

        - `python: Array<string>`

          Python packages installed in the environment.

          `minItems: 0`, `maxItems: 16384`

        - `system: Array<string>`

          System packages installed in the environment.

          `minItems: 0`, `maxItems: 16384`

      - `plugins: Array<HostedPlugin>`

        Plugins installed in the environment, excluding their archive contents.

        `minItems: 0`, `maxItems: 2000`

        - `description: string`

          The installed plugin description.

          `minLength: 0`

        - `name: string`

          The installed plugin name.

          `minLength: 0`

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

      - `skills: Array<HostedSkill>`

        Skills installed in the environment, excluding their archive contents.

        `minItems: 0`, `maxItems: 2000`

        - `HostedSkillReference`

          A skill installed from the Skills API.

          - `description: string`

            The installed skill description.

            `minLength: 0`

          - `name: string`

            The installed skill name.

            `minLength: 0`

          - `skill_id: string`

            The referenced skill ID.

            `minLength: 0`

          - `type: "skill_reference"`

            The type of the object. Always `skill_reference`.

            - `"skill_reference"`

          - `version: string`

            The concrete skill version installed for this session.

            `minLength: 0`

        - `HostedSkillResourceInline`

          A skill installed from an inline ZIP archive.

          - `description: string`

            The installed skill description.

            `minLength: 0`

          - `name: string`

            The installed skill name.

            `minLength: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `type: "openai_hosted"`

        The type of the object. Always `openai_hosted`.

        - `"openai_hosted"`

      - `container_size?: "small" | "medium" | "large" | null`

        The effective CPU and memory tier, or null when unknown or outside the public tiers.

        - `"small"`

        - `"medium"`

        - `"large"`

      - `desktop?: Desktop`

        The effective desktop configuration.

        - `enabled: boolean`

          Whether the environment provisions a desktop and browser proxy.

    - `EnvironmentResourceSelfHosted`

      An environment hosted by the application.

      - `id: string`

        The public ID of the environment.

        `minLength: 0`

      - `capability_directories: Array<string>`

        Directories that contain capabilities exposed to the agent.

        `minItems: 0`, `maxItems: 2000`

      - `remote_url: string`

        Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

        `minLength: 0`

      - `type: "self_hosted"`

        The type of the object. Always `self_hosted`.

        - `"self_hosted"`

      - `workspace_directory: string`

        The absolute project directory inside the environment. Defaults to `/workspace`.

        `minLength: 0`

  - `error: string | null`

    The error that caused the session to fail, if any.

    `minLength: 0`

  - `last_active_at: number`

    The Unix timestamp, in seconds, when the session was last active.

    `format: int64`

  - `metadata: Record<string, string>`

    Custom string key-value pairs attached to the session.

  - `object: "agent.session"`

    The object type. Always `agent.session`.

    - `"agent.session"`

  - `required_actions: Array<SessionRequiredActionResourceComputerUseApprovalRequest | SessionRequiredActionResourceFunctionCall | SessionRequiredActionResourceEnvironmentConnection>`

    Actions that must be completed before the session can continue.

    `minItems: 0`, `maxItems: 2000`

    - `SessionRequiredActionResourceComputerUseApprovalRequest`

      Respond to a computer-use request.

      - `request: ComputerUseApprovalRequestKindResourceBrowserAuthentication | ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

        The information needed to render the request.

        - `ComputerUseApprovalRequestKindResourceBrowserAuthentication`

          A registered form awaiting the application's response.

          - `credential_origin: string | null`

            The registered form or frame origin where values will be entered.

            `minLength: 0`

          - `fields: Array<Field>`

            Controls to render. All submitted values are sensitive.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The field ID to submit as field_id in a fields entry.

              `minLength: 0`

            - `label: string`

              The label to display beside the control.

              `minLength: 0`

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

              `minLength: 0`

          - `options: Array<Option>`

            Sign-in methods. Empty for a plain form.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The option ID to submit as selected_option.

              `minLength: 0`

            - `field_ids: Array<string>`

              IDs from the registered fields that this method accepts.

              `minItems: 0`, `maxItems: 2000`

            - `label: string`

              The method label to display.

              `minLength: 0`

          - `reason: string | null`

            Why the agent needs the user to sign in.

            `minLength: 0`

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

          A browser origin awaiting the application's approval decision.

          - `origin: string`

            The origin the browser needs permission to access.

            `minLength: 0`

          - `reason: string | null`

            The browser's explanation for this request, or null when unavailable.

            `minLength: 0`

          - `type: "browser_origin_access"`

            The type of the object. Always `browser_origin_access`.

            - `"browser_origin_access"`

      - `request_id: string`

        The registered request ID to echo when responding.

        `minLength: 0`

      - `turn_id: string`

        The turn that requested approval.

        `minLength: 0`

      - `type: "computer_use_approval_request"`

        The type of the object. Always `computer_use_approval_request`.

        - `"computer_use_approval_request"`

    - `SessionRequiredActionResourceFunctionCall`

      Run a function tool and submit its result.

      - `arguments: unknown`

        The arguments supplied by the model.

      - `call_id: string`

        The ID to include when submitting the function result.

        `minLength: 0`

      - `name: string`

        The function name.

        `minLength: 0`

      - `turn_id: string`

        The ID of the turn that requested the function call.

        `minLength: 0`

      - `type: "function_call"`

        The type of the object. Always `function_call`.

        - `"function_call"`

    - `SessionRequiredActionResourceEnvironmentConnection`

      Reconnect a session environment.

      - `environment_id: string`

        The ID of the environment to reconnect.

        `minLength: 0`

      - `type: "environment_connection"`

        The type of the object. Always `environment_connection`.

        - `"environment_connection"`

  - `status: "idle" | "in_progress" | "requires_action" | "failed"`

    The current status of the session.

    - `"idle"`

      The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

    - `"in_progress"`

      The session is processing a turn.

    - `"requires_action"`

      The session is waiting for one or more required actions.

    - `"failed"`

      The session failed.

  - `usage: TokenUsage | null`

    Best-effort token usage for the session, or null if unknown. Recorded usage may change.

    - `input_tokens: number`

      The number of input tokens used by the agent.

      `format: int64`

    - `input_tokens_details: InputTokensDetails`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

        `format: int64`

    - `output_tokens: number`

      The number of output tokens generated by the agent.

      `format: int64`

    - `output_tokens_details: OutputTokensDetails`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

        `format: int64`

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

      `format: int64`

  - `vault_ids: Array<string>`

    The IDs of vaults made available to the session.

    `minItems: 0`, `maxItems: 2000`

  - `prompt_cache_options?: PromptCacheOptions | null`

    Default prompt cache lifetime for turns in this session, when configured.

    - `ttl: "30m" | "12h"`

      - `"30m"`

      - `"12h"`

  - `review?: "none" | "auto_review"`

    Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none.

    - `"none"`

    - `"auto_review"`

  - `spend_control?: SpendControl`

    Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object.

    - `consumed: number | null`

      Best-effort recorded spend floored to whole USD cents, or null when unavailable.

      `minimum: 0`

    - `limit: number`

      The configured positive limit in USD cents.

      `format: int64`, `minimum: 1`, `maximum: 4503599627370495`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const agentSession of client.beta.agents.sessions.list()) {
  console.log(agentSession.id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "agent": {
        "id": "id",
        "instructions": "instructions",
        "model": "model",
        "multi_agent": {
          "enabled": true,
          "max_concurrent_subagents": 1
        },
        "name": "name",
        "reasoning": {
          "effort": "none",
          "summary": "concise"
        },
        "service_tier": "auto",
        "text": {
          "format": {
            "type": "text"
          },
          "verbosity": "low"
        },
        "tools": [
          {
            "defer_loading": true,
            "description": "description",
            "name": "name",
            "parameters": {
              "foo": "bar"
            },
            "type": "function",
            "async": true
          }
        ],
        "compaction": {
          "async": true
        },
        "experimental": {
          "time_awareness": true
        }
      },
      "created_at": 0,
      "environment": {
        "type": "none"
      },
      "error": "error",
      "last_active_at": 0,
      "metadata": {
        "foo": "string"
      },
      "object": "agent.session",
      "required_actions": [
        {
          "request": {
            "credential_origin": "credential_origin",
            "fields": [
              {
                "id": "id",
                "label": "label",
                "required": true,
                "type": "type"
              }
            ],
            "options": [
              {
                "id": "id",
                "field_ids": [
                  "string"
                ],
                "label": "label"
              }
            ],
            "reason": "reason",
            "type": "browser_authentication"
          },
          "request_id": "request_id",
          "turn_id": "turn_id",
          "type": "computer_use_approval_request"
        }
      ],
      "status": "idle",
      "usage": {
        "input_tokens": 0,
        "input_tokens_details": {
          "cached_tokens": 0
        },
        "output_tokens": 0,
        "output_tokens_details": {
          "reasoning_tokens": 0
        },
        "total_tokens": 0
      },
      "vault_ids": [
        "string"
      ],
      "prompt_cache_options": {
        "ttl": "30m"
      },
      "review": "none",
      "spend_control": {
        "consumed": 0,
        "limit": 1
      }
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve an agent session

`client.beta.agents.sessions.retrieve(stringsessionID, RequestOptionsoptions?): AgentSession`

**get** `/agents/sessions/{session_id}`

Retrieves the current state of a managed agent session. See [managing sessions](/api/docs/guides/agents-api/sessions/manage).

### Parameters

- `sessionID: string`

  `minLength: 0`, `maxLength: 1048576`

### Returns

- `AgentSession`

  A Managed Agents session.

  - `id: string`

    The ID of the session.

    `minLength: 0`

  - `agent: Agent`

    The agent running in the session.

    - `id: string`

      The ID of the agent.

      `minLength: 0`

    - `instructions: string | null`

      Custom instructions appended to the agent's default base instructions.

      `minLength: 0`

    - `model: string`

      The model used by the agent.

      `minLength: 0`

    - `multi_agent: MultiAgentConfig`

      Configuration for creating and coordinating subagents.

      - `enabled: boolean`

        Whether subagent tools are enabled. Defaults to false.

      - `max_concurrent_subagents: number | null`

        Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

        `format: int64`, `minimum: 1`, `maximum: 4294967295`

    - `name: string | null`

      The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

      `minLength: 0`

    - `reasoning: AgentReasoning`

      The agent's reasoning configuration.

      - `effort: "none" | "minimal" | "low" | 4 more | null`

        The requested reasoning effort, or `null` when the model selects its own default.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `summary: "concise" | "detailed" | "auto" | null`

        The requested reasoning summary format, or `null` when summaries are disabled.

        - `"concise"`

          Returns a concise reasoning summary when supported.

        - `"detailed"`

          Returns a detailed reasoning summary when supported.

        - `"auto"`

          Automatically selects the most detailed summary supported by the model.

    - `service_tier: "auto" | "default" | "flex" | 3 more`

      The effective service-tier policy for model requests. Defaults to `auto`.

      - `"auto"`

      - `"default"`

      - `"flex"`

      - `"priority"`

      - `"fast"`

      - `"ultrafast"`

    - `text: AgentText`

      Configuration for text generated by the agent.

      - `format: TextFormat`

        The effective output format. Defaults to ordinary text.

        - `TextFormatResourceText`

          Generates ordinary text without a structured-output constraint.

          - `type: "text"`

            The type of the object. Always `text`.

            - `"text"`

        - `TextFormatResourceJSONSchema`

          Constrains generated text to a JSON Schema.

          - `schema: Record<string, unknown>`

            The JSON Schema that generated text must match.

          - `type: "json_schema"`

            The type of the object. Always `json_schema`.

            - `"json_schema"`

      - `verbosity: "low" | "medium" | "high"`

        The amount of text produced by the agent. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tools: Array<AgentTool>`

      Tools available to the agent.

      `minItems: 0`, `maxItems: 2000`

      - `AgentToolResourceFunction`

        A function defined by the application.

        - `defer_loading: boolean`

          Whether the function is deferred and discovered through tool search.

        - `description: string`

          A description of what the function does.

          `minLength: 0`

        - `name: string`

          The name of the function.

          `minLength: 0`

        - `parameters: Record<string, unknown>`

          A JSON Schema object describing the function's arguments.

        - `type: "function"`

          The type of the object. Always `function`.

          - `"function"`

        - `async?: boolean`

          Whether the agent continues without waiting for the function result.

      - `AgentToolResourceProgrammaticToolCalling`

        Enables calling tools from model-generated code.

        - `enabled: boolean`

          Whether tools can be called from model-generated code.

        - `type: "programmatic_tool_calling"`

          The type of the object. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `AgentToolResourceMcp`

        Tools provided by a remote MCP server.

        - `allowed_tools: Array<string> | null`

          The MCP tools the agent may call.

          `minItems: 0`, `maxItems: 2000`

        - `connection_origin: "service" | "environment"`

          Where outbound MCP HTTP connections originate.

          - `"service"`

          - `"environment"`

        - `credential_id: string | null`

          The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

          `minLength: 0`

        - `request_metadata: Record<string, unknown>`

          Metadata included with requests to this MCP server.

        - `required: boolean`

          Whether this MCP server must initialize before the first turn.

        - `server_label: string`

          A label used to identify the MCP server in tool calls.

          `minLength: 0`

        - `transport: McpTransport`

          The transport used to connect to the MCP server.

          - `McpTransportResourceHTTP`

            Connects to an MCP server over HTTP.

            - `server_url: string`

              The URL of the MCP server.

              `minLength: 0`

            - `type: "http"`

              The type of the object. Always `http`.

              - `"http"`

          - `McpTransportResourceStdio`

            Starts an MCP server as a local process.

            - `args: Array<string>`

              Arguments passed to the MCP server command.

              `minItems: 0`, `maxItems: 2000`

            - `command: string`

              The command used to start the MCP server.

              `minLength: 0`

            - `cwd: string`

              The working directory used to start the MCP server.

              `minLength: 0`

            - `env_vars: Array<string>`

              Environment variable names inherited from the execution environment.

              `minItems: 0`, `maxItems: 2000`

            - `type: "stdio"`

              The type of the object. Always `stdio`.

              - `"stdio"`

        - `type: "mcp"`

          The type of the object. Always `mcp`.

          - `"mcp"`

      - `AgentToolResourceWebSearch`

        Web search.

        - `allowed_domains: Array<string> | null`

          Allowed search domains, or `null` when the search is unrestricted.

          `minItems: 0`, `maxItems: 2000`

        - `context_size: "low" | "medium" | "high"`

          The amount of search context made available to the model. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `location: Location | null`

          Approximate location used to localize search results, if provided.

          - `city: string | null`

            The city name.

            `minLength: 0`

          - `country: string | null`

            The two-letter ISO country code, such as `US`.

            `minLength: 0`

          - `region: string | null`

            The region or state name.

            `minLength: 0`

          - `timezone: string | null`

            The IANA timezone, such as `America/Los_Angeles`.

            `minLength: 0`

        - `mode: "disabled" | "cached" | "live"`

          The source used for web search results.

          - `"disabled"`

          - `"cached"`

          - `"live"`

        - `type: "web_search"`

          The type of the object. Always `web_search`.

          - `"web_search"`

      - `AgentToolResourceComputerUse`

        Browser use in an OpenAI-hosted session.

        - `include_screenshots: boolean`

          Whether computer tool outputs include screenshots.

        - `type: "computer_use"`

          The type of the object. Always `computer_use`.

          - `"computer_use"`

      - `AgentToolResourceAutomations`

        Lets the agent manage its own scheduled wakeups.

        - `type: "automations"`

          The type of the object. Always `automations`.

          - `"automations"`

    - `compaction?: Compaction`

      The effective context compaction settings.

      - `async: boolean`

        Whether context is compacted in the background. Defaults to true.

    - `experimental?: Experimental`

      The effective experimental settings for the agent.

      - `time_awareness: boolean`

        Whether the model receives periodic current-time reminders.

  - `created_at: number`

    The Unix timestamp, in seconds, when the session was created.

    `format: int64`

  - `environment: Environment`

    The execution environment for the session.

    - `EnvironmentResourceNone`

      The session talks to CCA without selecting or provisioning an execution environment.

      - `type: "none"`

        The type of the object. Always `none`.

        - `"none"`

    - `EnvironmentResourceOpenAIHosted`

      An environment hosted by OpenAI.

      - `id: string`

        The public ID of the environment.

        `minLength: 0`

      - `capability_directories: Array<string>`

        Directories that contain capabilities exposed to the agent.

        `minItems: 0`, `maxItems: 2000`

      - `files: Array<HostedEnvironmentFile>`

        Files available in the environment, excluding their contents.

        `minItems: 0`, `maxItems: 50`

        - `HostedEnvironmentFileID`

          A file copied from the OpenAI Files API.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

            `minLength: 0`

          - `file_id: string`

            The ID of the uploaded file.

            `minLength: 0`

          - `path: string`

            The file's absolute path inside the environment.

            `minLength: 0`

          - `size_bytes: number`

            The decoded file size in bytes.

            `format: int64`, `minimum: 0`

          - `type: "file_id"`

            The type of the object. Always `file_id`.

            - `"file_id"`

        - `HostedEnvironmentFileResourceInline`

          A file supplied inline when the session was created.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

            `minLength: 0`

          - `path: string`

            The file's absolute path inside the environment.

            `minLength: 0`

          - `size_bytes: number`

            The decoded file size in bytes.

            `format: int64`, `minimum: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `network: Network`

        The effective network access policy for the environment.

        - `access: "enabled" | "disabled" | "restricted"`

          The environment's network access mode.

          - `"enabled"`

            Allows unrestricted network access.

          - `"disabled"`

            Disables network access.

          - `"restricted"`

            Applies the configured domain restrictions.

        - `allowed_domains: Array<string>`

          Domains the environment may access when network access is restricted.

          `minItems: 0`, `maxItems: 2000`

      - `packages: Packages`

        Packages installed in the environment.

        - `npm: Array<string>`

          npm packages installed globally in the environment.

          `minItems: 0`, `maxItems: 16384`

        - `python: Array<string>`

          Python packages installed in the environment.

          `minItems: 0`, `maxItems: 16384`

        - `system: Array<string>`

          System packages installed in the environment.

          `minItems: 0`, `maxItems: 16384`

      - `plugins: Array<HostedPlugin>`

        Plugins installed in the environment, excluding their archive contents.

        `minItems: 0`, `maxItems: 2000`

        - `description: string`

          The installed plugin description.

          `minLength: 0`

        - `name: string`

          The installed plugin name.

          `minLength: 0`

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

      - `skills: Array<HostedSkill>`

        Skills installed in the environment, excluding their archive contents.

        `minItems: 0`, `maxItems: 2000`

        - `HostedSkillReference`

          A skill installed from the Skills API.

          - `description: string`

            The installed skill description.

            `minLength: 0`

          - `name: string`

            The installed skill name.

            `minLength: 0`

          - `skill_id: string`

            The referenced skill ID.

            `minLength: 0`

          - `type: "skill_reference"`

            The type of the object. Always `skill_reference`.

            - `"skill_reference"`

          - `version: string`

            The concrete skill version installed for this session.

            `minLength: 0`

        - `HostedSkillResourceInline`

          A skill installed from an inline ZIP archive.

          - `description: string`

            The installed skill description.

            `minLength: 0`

          - `name: string`

            The installed skill name.

            `minLength: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `type: "openai_hosted"`

        The type of the object. Always `openai_hosted`.

        - `"openai_hosted"`

      - `container_size?: "small" | "medium" | "large" | null`

        The effective CPU and memory tier, or null when unknown or outside the public tiers.

        - `"small"`

        - `"medium"`

        - `"large"`

      - `desktop?: Desktop`

        The effective desktop configuration.

        - `enabled: boolean`

          Whether the environment provisions a desktop and browser proxy.

    - `EnvironmentResourceSelfHosted`

      An environment hosted by the application.

      - `id: string`

        The public ID of the environment.

        `minLength: 0`

      - `capability_directories: Array<string>`

        Directories that contain capabilities exposed to the agent.

        `minItems: 0`, `maxItems: 2000`

      - `remote_url: string`

        Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

        `minLength: 0`

      - `type: "self_hosted"`

        The type of the object. Always `self_hosted`.

        - `"self_hosted"`

      - `workspace_directory: string`

        The absolute project directory inside the environment. Defaults to `/workspace`.

        `minLength: 0`

  - `error: string | null`

    The error that caused the session to fail, if any.

    `minLength: 0`

  - `last_active_at: number`

    The Unix timestamp, in seconds, when the session was last active.

    `format: int64`

  - `metadata: Record<string, string>`

    Custom string key-value pairs attached to the session.

  - `object: "agent.session"`

    The object type. Always `agent.session`.

    - `"agent.session"`

  - `required_actions: Array<SessionRequiredActionResourceComputerUseApprovalRequest | SessionRequiredActionResourceFunctionCall | SessionRequiredActionResourceEnvironmentConnection>`

    Actions that must be completed before the session can continue.

    `minItems: 0`, `maxItems: 2000`

    - `SessionRequiredActionResourceComputerUseApprovalRequest`

      Respond to a computer-use request.

      - `request: ComputerUseApprovalRequestKindResourceBrowserAuthentication | ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

        The information needed to render the request.

        - `ComputerUseApprovalRequestKindResourceBrowserAuthentication`

          A registered form awaiting the application's response.

          - `credential_origin: string | null`

            The registered form or frame origin where values will be entered.

            `minLength: 0`

          - `fields: Array<Field>`

            Controls to render. All submitted values are sensitive.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The field ID to submit as field_id in a fields entry.

              `minLength: 0`

            - `label: string`

              The label to display beside the control.

              `minLength: 0`

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

              `minLength: 0`

          - `options: Array<Option>`

            Sign-in methods. Empty for a plain form.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The option ID to submit as selected_option.

              `minLength: 0`

            - `field_ids: Array<string>`

              IDs from the registered fields that this method accepts.

              `minItems: 0`, `maxItems: 2000`

            - `label: string`

              The method label to display.

              `minLength: 0`

          - `reason: string | null`

            Why the agent needs the user to sign in.

            `minLength: 0`

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

          A browser origin awaiting the application's approval decision.

          - `origin: string`

            The origin the browser needs permission to access.

            `minLength: 0`

          - `reason: string | null`

            The browser's explanation for this request, or null when unavailable.

            `minLength: 0`

          - `type: "browser_origin_access"`

            The type of the object. Always `browser_origin_access`.

            - `"browser_origin_access"`

      - `request_id: string`

        The registered request ID to echo when responding.

        `minLength: 0`

      - `turn_id: string`

        The turn that requested approval.

        `minLength: 0`

      - `type: "computer_use_approval_request"`

        The type of the object. Always `computer_use_approval_request`.

        - `"computer_use_approval_request"`

    - `SessionRequiredActionResourceFunctionCall`

      Run a function tool and submit its result.

      - `arguments: unknown`

        The arguments supplied by the model.

      - `call_id: string`

        The ID to include when submitting the function result.

        `minLength: 0`

      - `name: string`

        The function name.

        `minLength: 0`

      - `turn_id: string`

        The ID of the turn that requested the function call.

        `minLength: 0`

      - `type: "function_call"`

        The type of the object. Always `function_call`.

        - `"function_call"`

    - `SessionRequiredActionResourceEnvironmentConnection`

      Reconnect a session environment.

      - `environment_id: string`

        The ID of the environment to reconnect.

        `minLength: 0`

      - `type: "environment_connection"`

        The type of the object. Always `environment_connection`.

        - `"environment_connection"`

  - `status: "idle" | "in_progress" | "requires_action" | "failed"`

    The current status of the session.

    - `"idle"`

      The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

    - `"in_progress"`

      The session is processing a turn.

    - `"requires_action"`

      The session is waiting for one or more required actions.

    - `"failed"`

      The session failed.

  - `usage: TokenUsage | null`

    Best-effort token usage for the session, or null if unknown. Recorded usage may change.

    - `input_tokens: number`

      The number of input tokens used by the agent.

      `format: int64`

    - `input_tokens_details: InputTokensDetails`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

        `format: int64`

    - `output_tokens: number`

      The number of output tokens generated by the agent.

      `format: int64`

    - `output_tokens_details: OutputTokensDetails`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

        `format: int64`

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

      `format: int64`

  - `vault_ids: Array<string>`

    The IDs of vaults made available to the session.

    `minItems: 0`, `maxItems: 2000`

  - `prompt_cache_options?: PromptCacheOptions | null`

    Default prompt cache lifetime for turns in this session, when configured.

    - `ttl: "30m" | "12h"`

      - `"30m"`

      - `"12h"`

  - `review?: "none" | "auto_review"`

    Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none.

    - `"none"`

    - `"auto_review"`

  - `spend_control?: SpendControl`

    Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object.

    - `consumed: number | null`

      Best-effort recorded spend floored to whole USD cents, or null when unavailable.

      `minimum: 0`

    - `limit: number`

      The configured positive limit in USD cents.

      `format: int64`, `minimum: 1`, `maximum: 4503599627370495`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const agentSession = await client.beta.agents.sessions.retrieve('session_id');

console.log(agentSession.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "agent": {
    "id": "id",
    "instructions": "instructions",
    "model": "model",
    "multi_agent": {
      "enabled": true,
      "max_concurrent_subagents": 1
    },
    "name": "name",
    "reasoning": {
      "effort": "none",
      "summary": "concise"
    },
    "service_tier": "auto",
    "text": {
      "format": {
        "type": "text"
      },
      "verbosity": "low"
    },
    "tools": [
      {
        "defer_loading": true,
        "description": "description",
        "name": "name",
        "parameters": {
          "foo": "bar"
        },
        "type": "function",
        "async": true
      }
    ],
    "compaction": {
      "async": true
    },
    "experimental": {
      "time_awareness": true
    }
  },
  "created_at": 0,
  "environment": {
    "type": "none"
  },
  "error": "error",
  "last_active_at": 0,
  "metadata": {
    "foo": "string"
  },
  "object": "agent.session",
  "required_actions": [
    {
      "request": {
        "credential_origin": "credential_origin",
        "fields": [
          {
            "id": "id",
            "label": "label",
            "required": true,
            "type": "type"
          }
        ],
        "options": [
          {
            "id": "id",
            "field_ids": [
              "string"
            ],
            "label": "label"
          }
        ],
        "reason": "reason",
        "type": "browser_authentication"
      },
      "request_id": "request_id",
      "turn_id": "turn_id",
      "type": "computer_use_approval_request"
    }
  ],
  "status": "idle",
  "usage": {
    "input_tokens": 0,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 0,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 0
  },
  "vault_ids": [
    "string"
  ],
  "prompt_cache_options": {
    "ttl": "30m"
  },
  "review": "none",
  "spend_control": {
    "consumed": 0,
    "limit": 1
  }
}
```

## Update an agent session

`client.beta.agents.sessions.update(stringsessionID, SessionUpdateParamsbody?, RequestOptionsoptions?): AgentSession`

**post** `/agents/sessions/{session_id}`

Updates session tools, metadata, model, reasoning effort, service tier, or the default prompt cache lifetime. Model settings apply to subsequent turns. Omitted fields are unchanged. See [managing sessions](/api/docs/guides/agents-api/sessions/manage).

### Parameters

- `sessionID: string`

  `minLength: 0`, `maxLength: 1048576`

- `body: SessionUpdateParams`

  - `agent?: Agent`

    Agent settings to update on this session. Omitted fields stay unchanged.

    - `model?: string`

      The model for subsequent turns. Omit to keep the current model.

      `minLength: 0`, `maxLength: 1048576`

    - `reasoning?: Reasoning`

      Reasoning settings to update. Omit to keep the current effort.

      - `effort?: "none" | "minimal" | "low" | 4 more | null`

        Omit to keep the current effort. Null selects the model's default effort.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

    - `service_tier?: "auto" | "default" | "flex" | 3 more | null`

      Omit to keep the current tier. Null resets it to auto.

      - `auto` - Selects the service tier automatically.
      - `default` - Uses the default service tier.
      - `flex` - Uses the flex service tier.
      - `priority` - Uses the priority service tier.
      - `fast` - Uses the fast service tier.
      - `ultrafast` - Uses the ultrafast service tier.

      - `"auto"`

        Selects the service tier automatically.

      - `"default"`

        Uses the default service tier.

      - `"flex"`

        Uses the flex service tier.

      - `"priority"`

        Uses the priority service tier.

      - `"fast"`

        Uses the fast service tier.

      - `"ultrafast"`

        Uses the ultrafast service tier.

    - `tools?: Array<AgentToolParam> | null`

      Replaces the session tools. Functions and MCP servers change on the next model call. Built-in tools change by the next turn. Omit to keep the current tools, or pass null or an empty array to clear them.

      `minItems: 0`, `maxItems: 16384`

      - `AgentToolConfigParamFunction`

        A function defined by the application.

        - `description: string`

          A description of what the function does.

          `minLength: 0`, `maxLength: 1048576`

        - `name: string`

          The name of the function.

          `minLength: 0`, `maxLength: 1048576`

        - `parameters: Record<string, unknown>`

          A JSON Schema object describing the function's arguments.

        - `type: "function"`

          The type of the object. Always `function`.

          - `"function"`

        - `async?: boolean`

          Whether the agent continues without waiting for the function result. Defaults to `false`.

        - `defer_loading?: boolean`

          Whether this function is deferred and discovered through tool search. Defaults to `false`.

      - `AgentToolConfigParamToolSearch`

        Discovers deferred function tools and loads them into the model context.

        - `type: "tool_search"`

          The type of the object. Always `tool_search`.

          - `"tool_search"`

      - `AgentToolConfigParamProgrammaticToolCalling`

        Enables calling tools from model-generated code.

        - `type: "programmatic_tool_calling"`

          The type of the object. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

        - `enabled?: boolean`

          Whether tools can be called from model-generated code. Defaults to `true`.

      - `AgentToolConfigParamMcp`

        Tools provided by a remote MCP server.

        - `server_label: string`

          A label used to identify the MCP server in tool calls.

          `minLength: 0`, `maxLength: 1048576`

        - `transport: McpTransportParam`

          The transport used to connect to the MCP server.

          - `McpTransportConfigParamHTTP`

            Connects to an MCP server over HTTP.

            - `server_url: string`

              The URL of the MCP server.

              `minLength: 0`, `maxLength: 1048576`

            - `type: "http"`

              The type of the object. Always `http`.

              - `"http"`

            - `authorization?: string | null`

              The authorization value sent to the MCP server, if any.

              `minLength: 0`, `maxLength: 1048576`

            - `headers?: Record<string, string> | null`

              Additional HTTP headers sent to the MCP server.

          - `McpTransportConfigParamStdio`

            Starts an MCP server as a local process.

            - `command: string`

              The command used to start the MCP server.

              `minLength: 0`, `maxLength: 1048576`

            - `cwd: string`

              The working directory used to start the MCP server.

              `minLength: 0`, `maxLength: 1048576`

            - `type: "stdio"`

              The type of the object. Always `stdio`.

              - `"stdio"`

            - `args?: Array<string> | null`

              Arguments passed to the MCP server command.

              `minItems: 0`, `maxItems: 16384`

            - `env?: Record<string, string> | null`

              Environment variables set for the MCP server process.

            - `env_vars?: Array<string> | null`

              Environment variable names to inherit from the selected execution environment.

              `minItems: 0`, `maxItems: 16384`

        - `type: "mcp"`

          The type of the object. Always `mcp`.

          - `"mcp"`

        - `allowed_tools?: Array<string> | null`

          The MCP tools the agent may call. All server tools are allowed when omitted.

          `minItems: 0`, `maxItems: 16384`

        - `connection_origin?: "service" | "environment" | null`

          Selects where outbound MCP HTTP connections originate. Omitted or `service` uses the Managed Agents service network; `environment` uses the session's selected environment.

          - `"service"`

            Uses the Managed Agents service network.

          - `"environment"`

            Uses the session's execution environment.

        - `credential_id?: string | null`

          The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL.

          `minLength: 0`, `maxLength: 1048576`

        - `request_metadata?: Record<string, unknown> | null`

          Metadata included with requests to this MCP server.

        - `required?: boolean`

          Whether this MCP server must initialize before the first turn. Defaults to `false`.

      - `AgentToolConfigParamWebSearch`

        Web search.

        - `type: "web_search"`

          The type of the object. Always `web_search`.

          - `"web_search"`

        - `allowed_domains?: Array<string> | null`

          Domains the search may include.

          `minItems: 0`, `maxItems: 16384`

        - `context_size?: "low" | "medium" | "high" | null`

          The amount of search context made available to the model. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `location?: Location | null`

          Approximate location used to localize search results.

          - `city?: string | null`

            The city name.

            `minLength: 0`, `maxLength: 1048576`

          - `country?: string | null`

            The two-letter ISO country code, such as `US`.

            `minLength: 0`, `maxLength: 1048576`

          - `region?: string | null`

            The region or state name.

            `minLength: 0`, `maxLength: 1048576`

          - `timezone?: string | null`

            The IANA timezone, such as `America/Los_Angeles`.

            `minLength: 0`, `maxLength: 1048576`

        - `mode?: "disabled" | "cached" | "live" | null`

          The source used for web search results. Defaults to `live`.

          - `"disabled"`

            Disables web search.

          - `"cached"`

            Uses cached search results.

          - `"live"`

            Searches the live web.

      - `AgentToolConfigParamComputerUse`

        Browser use in an OpenAI-hosted session.

        - `type: "computer_use"`

          The type of the object. Always `computer_use`.

          - `"computer_use"`

        - `include_screenshots?: boolean`

          Whether computer tool outputs include screenshots. Defaults to `false`.

      - `AgentToolConfigParamAutomations`

        Lets the agent manage its own scheduled wakeups.

        - `type: "automations"`

          The type of the object. Always `automations`.

          - `"automations"`

  - `metadata?: Record<string, string> | null`

    Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters.

  - `prompt_cache_options?: PromptCacheOptions | null`

    Default prompt cache lifetime for future turns. Send null to clear the session default.

    - `ttl?: "30m" | "12h"`

      Minimum lifetime for new prompt cache entries. Defaults to 30 minutes.

      - `"30m"`

      - `"12h"`

  - `review?: "none" | "auto_review"`

    Default action review for new root turns. Existing turns and their subagents keep their review mode.

    - `"none"`

      Keep the existing execution behavior without automatic action review.

    - `"auto_review"`

      Review eligible actions automatically. Deny manual approval fallbacks.

  - `spend_control?: SpendControl | null`

    Omit to retain the limit; null or a null limit removes it without resetting spend.

    - `limit: number | null`

      Positive USD cents, or null to remove the limit.

      `format: int64`, `minimum: 1`, `maximum: 4503599627370495`

### Returns

- `AgentSession`

  A Managed Agents session.

  - `id: string`

    The ID of the session.

    `minLength: 0`

  - `agent: Agent`

    The agent running in the session.

    - `id: string`

      The ID of the agent.

      `minLength: 0`

    - `instructions: string | null`

      Custom instructions appended to the agent's default base instructions.

      `minLength: 0`

    - `model: string`

      The model used by the agent.

      `minLength: 0`

    - `multi_agent: MultiAgentConfig`

      Configuration for creating and coordinating subagents.

      - `enabled: boolean`

        Whether subagent tools are enabled. Defaults to false.

      - `max_concurrent_subagents: number | null`

        Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

        `format: int64`, `minimum: 1`, `maximum: 4294967295`

    - `name: string | null`

      The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

      `minLength: 0`

    - `reasoning: AgentReasoning`

      The agent's reasoning configuration.

      - `effort: "none" | "minimal" | "low" | 4 more | null`

        The requested reasoning effort, or `null` when the model selects its own default.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `summary: "concise" | "detailed" | "auto" | null`

        The requested reasoning summary format, or `null` when summaries are disabled.

        - `"concise"`

          Returns a concise reasoning summary when supported.

        - `"detailed"`

          Returns a detailed reasoning summary when supported.

        - `"auto"`

          Automatically selects the most detailed summary supported by the model.

    - `service_tier: "auto" | "default" | "flex" | 3 more`

      The effective service-tier policy for model requests. Defaults to `auto`.

      - `"auto"`

      - `"default"`

      - `"flex"`

      - `"priority"`

      - `"fast"`

      - `"ultrafast"`

    - `text: AgentText`

      Configuration for text generated by the agent.

      - `format: TextFormat`

        The effective output format. Defaults to ordinary text.

        - `TextFormatResourceText`

          Generates ordinary text without a structured-output constraint.

          - `type: "text"`

            The type of the object. Always `text`.

            - `"text"`

        - `TextFormatResourceJSONSchema`

          Constrains generated text to a JSON Schema.

          - `schema: Record<string, unknown>`

            The JSON Schema that generated text must match.

          - `type: "json_schema"`

            The type of the object. Always `json_schema`.

            - `"json_schema"`

      - `verbosity: "low" | "medium" | "high"`

        The amount of text produced by the agent. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tools: Array<AgentTool>`

      Tools available to the agent.

      `minItems: 0`, `maxItems: 2000`

      - `AgentToolResourceFunction`

        A function defined by the application.

        - `defer_loading: boolean`

          Whether the function is deferred and discovered through tool search.

        - `description: string`

          A description of what the function does.

          `minLength: 0`

        - `name: string`

          The name of the function.

          `minLength: 0`

        - `parameters: Record<string, unknown>`

          A JSON Schema object describing the function's arguments.

        - `type: "function"`

          The type of the object. Always `function`.

          - `"function"`

        - `async?: boolean`

          Whether the agent continues without waiting for the function result.

      - `AgentToolResourceProgrammaticToolCalling`

        Enables calling tools from model-generated code.

        - `enabled: boolean`

          Whether tools can be called from model-generated code.

        - `type: "programmatic_tool_calling"`

          The type of the object. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `AgentToolResourceMcp`

        Tools provided by a remote MCP server.

        - `allowed_tools: Array<string> | null`

          The MCP tools the agent may call.

          `minItems: 0`, `maxItems: 2000`

        - `connection_origin: "service" | "environment"`

          Where outbound MCP HTTP connections originate.

          - `"service"`

          - `"environment"`

        - `credential_id: string | null`

          The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

          `minLength: 0`

        - `request_metadata: Record<string, unknown>`

          Metadata included with requests to this MCP server.

        - `required: boolean`

          Whether this MCP server must initialize before the first turn.

        - `server_label: string`

          A label used to identify the MCP server in tool calls.

          `minLength: 0`

        - `transport: McpTransport`

          The transport used to connect to the MCP server.

          - `McpTransportResourceHTTP`

            Connects to an MCP server over HTTP.

            - `server_url: string`

              The URL of the MCP server.

              `minLength: 0`

            - `type: "http"`

              The type of the object. Always `http`.

              - `"http"`

          - `McpTransportResourceStdio`

            Starts an MCP server as a local process.

            - `args: Array<string>`

              Arguments passed to the MCP server command.

              `minItems: 0`, `maxItems: 2000`

            - `command: string`

              The command used to start the MCP server.

              `minLength: 0`

            - `cwd: string`

              The working directory used to start the MCP server.

              `minLength: 0`

            - `env_vars: Array<string>`

              Environment variable names inherited from the execution environment.

              `minItems: 0`, `maxItems: 2000`

            - `type: "stdio"`

              The type of the object. Always `stdio`.

              - `"stdio"`

        - `type: "mcp"`

          The type of the object. Always `mcp`.

          - `"mcp"`

      - `AgentToolResourceWebSearch`

        Web search.

        - `allowed_domains: Array<string> | null`

          Allowed search domains, or `null` when the search is unrestricted.

          `minItems: 0`, `maxItems: 2000`

        - `context_size: "low" | "medium" | "high"`

          The amount of search context made available to the model. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `location: Location | null`

          Approximate location used to localize search results, if provided.

          - `city: string | null`

            The city name.

            `minLength: 0`

          - `country: string | null`

            The two-letter ISO country code, such as `US`.

            `minLength: 0`

          - `region: string | null`

            The region or state name.

            `minLength: 0`

          - `timezone: string | null`

            The IANA timezone, such as `America/Los_Angeles`.

            `minLength: 0`

        - `mode: "disabled" | "cached" | "live"`

          The source used for web search results.

          - `"disabled"`

          - `"cached"`

          - `"live"`

        - `type: "web_search"`

          The type of the object. Always `web_search`.

          - `"web_search"`

      - `AgentToolResourceComputerUse`

        Browser use in an OpenAI-hosted session.

        - `include_screenshots: boolean`

          Whether computer tool outputs include screenshots.

        - `type: "computer_use"`

          The type of the object. Always `computer_use`.

          - `"computer_use"`

      - `AgentToolResourceAutomations`

        Lets the agent manage its own scheduled wakeups.

        - `type: "automations"`

          The type of the object. Always `automations`.

          - `"automations"`

    - `compaction?: Compaction`

      The effective context compaction settings.

      - `async: boolean`

        Whether context is compacted in the background. Defaults to true.

    - `experimental?: Experimental`

      The effective experimental settings for the agent.

      - `time_awareness: boolean`

        Whether the model receives periodic current-time reminders.

  - `created_at: number`

    The Unix timestamp, in seconds, when the session was created.

    `format: int64`

  - `environment: Environment`

    The execution environment for the session.

    - `EnvironmentResourceNone`

      The session talks to CCA without selecting or provisioning an execution environment.

      - `type: "none"`

        The type of the object. Always `none`.

        - `"none"`

    - `EnvironmentResourceOpenAIHosted`

      An environment hosted by OpenAI.

      - `id: string`

        The public ID of the environment.

        `minLength: 0`

      - `capability_directories: Array<string>`

        Directories that contain capabilities exposed to the agent.

        `minItems: 0`, `maxItems: 2000`

      - `files: Array<HostedEnvironmentFile>`

        Files available in the environment, excluding their contents.

        `minItems: 0`, `maxItems: 50`

        - `HostedEnvironmentFileID`

          A file copied from the OpenAI Files API.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

            `minLength: 0`

          - `file_id: string`

            The ID of the uploaded file.

            `minLength: 0`

          - `path: string`

            The file's absolute path inside the environment.

            `minLength: 0`

          - `size_bytes: number`

            The decoded file size in bytes.

            `format: int64`, `minimum: 0`

          - `type: "file_id"`

            The type of the object. Always `file_id`.

            - `"file_id"`

        - `HostedEnvironmentFileResourceInline`

          A file supplied inline when the session was created.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

            `minLength: 0`

          - `path: string`

            The file's absolute path inside the environment.

            `minLength: 0`

          - `size_bytes: number`

            The decoded file size in bytes.

            `format: int64`, `minimum: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `network: Network`

        The effective network access policy for the environment.

        - `access: "enabled" | "disabled" | "restricted"`

          The environment's network access mode.

          - `"enabled"`

            Allows unrestricted network access.

          - `"disabled"`

            Disables network access.

          - `"restricted"`

            Applies the configured domain restrictions.

        - `allowed_domains: Array<string>`

          Domains the environment may access when network access is restricted.

          `minItems: 0`, `maxItems: 2000`

      - `packages: Packages`

        Packages installed in the environment.

        - `npm: Array<string>`

          npm packages installed globally in the environment.

          `minItems: 0`, `maxItems: 16384`

        - `python: Array<string>`

          Python packages installed in the environment.

          `minItems: 0`, `maxItems: 16384`

        - `system: Array<string>`

          System packages installed in the environment.

          `minItems: 0`, `maxItems: 16384`

      - `plugins: Array<HostedPlugin>`

        Plugins installed in the environment, excluding their archive contents.

        `minItems: 0`, `maxItems: 2000`

        - `description: string`

          The installed plugin description.

          `minLength: 0`

        - `name: string`

          The installed plugin name.

          `minLength: 0`

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

      - `skills: Array<HostedSkill>`

        Skills installed in the environment, excluding their archive contents.

        `minItems: 0`, `maxItems: 2000`

        - `HostedSkillReference`

          A skill installed from the Skills API.

          - `description: string`

            The installed skill description.

            `minLength: 0`

          - `name: string`

            The installed skill name.

            `minLength: 0`

          - `skill_id: string`

            The referenced skill ID.

            `minLength: 0`

          - `type: "skill_reference"`

            The type of the object. Always `skill_reference`.

            - `"skill_reference"`

          - `version: string`

            The concrete skill version installed for this session.

            `minLength: 0`

        - `HostedSkillResourceInline`

          A skill installed from an inline ZIP archive.

          - `description: string`

            The installed skill description.

            `minLength: 0`

          - `name: string`

            The installed skill name.

            `minLength: 0`

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `type: "openai_hosted"`

        The type of the object. Always `openai_hosted`.

        - `"openai_hosted"`

      - `container_size?: "small" | "medium" | "large" | null`

        The effective CPU and memory tier, or null when unknown or outside the public tiers.

        - `"small"`

        - `"medium"`

        - `"large"`

      - `desktop?: Desktop`

        The effective desktop configuration.

        - `enabled: boolean`

          Whether the environment provisions a desktop and browser proxy.

    - `EnvironmentResourceSelfHosted`

      An environment hosted by the application.

      - `id: string`

        The public ID of the environment.

        `minLength: 0`

      - `capability_directories: Array<string>`

        Directories that contain capabilities exposed to the agent.

        `minItems: 0`, `maxItems: 2000`

      - `remote_url: string`

        Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

        `minLength: 0`

      - `type: "self_hosted"`

        The type of the object. Always `self_hosted`.

        - `"self_hosted"`

      - `workspace_directory: string`

        The absolute project directory inside the environment. Defaults to `/workspace`.

        `minLength: 0`

  - `error: string | null`

    The error that caused the session to fail, if any.

    `minLength: 0`

  - `last_active_at: number`

    The Unix timestamp, in seconds, when the session was last active.

    `format: int64`

  - `metadata: Record<string, string>`

    Custom string key-value pairs attached to the session.

  - `object: "agent.session"`

    The object type. Always `agent.session`.

    - `"agent.session"`

  - `required_actions: Array<SessionRequiredActionResourceComputerUseApprovalRequest | SessionRequiredActionResourceFunctionCall | SessionRequiredActionResourceEnvironmentConnection>`

    Actions that must be completed before the session can continue.

    `minItems: 0`, `maxItems: 2000`

    - `SessionRequiredActionResourceComputerUseApprovalRequest`

      Respond to a computer-use request.

      - `request: ComputerUseApprovalRequestKindResourceBrowserAuthentication | ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

        The information needed to render the request.

        - `ComputerUseApprovalRequestKindResourceBrowserAuthentication`

          A registered form awaiting the application's response.

          - `credential_origin: string | null`

            The registered form or frame origin where values will be entered.

            `minLength: 0`

          - `fields: Array<Field>`

            Controls to render. All submitted values are sensitive.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The field ID to submit as field_id in a fields entry.

              `minLength: 0`

            - `label: string`

              The label to display beside the control.

              `minLength: 0`

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

              `minLength: 0`

          - `options: Array<Option>`

            Sign-in methods. Empty for a plain form.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The option ID to submit as selected_option.

              `minLength: 0`

            - `field_ids: Array<string>`

              IDs from the registered fields that this method accepts.

              `minItems: 0`, `maxItems: 2000`

            - `label: string`

              The method label to display.

              `minLength: 0`

          - `reason: string | null`

            Why the agent needs the user to sign in.

            `minLength: 0`

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

          A browser origin awaiting the application's approval decision.

          - `origin: string`

            The origin the browser needs permission to access.

            `minLength: 0`

          - `reason: string | null`

            The browser's explanation for this request, or null when unavailable.

            `minLength: 0`

          - `type: "browser_origin_access"`

            The type of the object. Always `browser_origin_access`.

            - `"browser_origin_access"`

      - `request_id: string`

        The registered request ID to echo when responding.

        `minLength: 0`

      - `turn_id: string`

        The turn that requested approval.

        `minLength: 0`

      - `type: "computer_use_approval_request"`

        The type of the object. Always `computer_use_approval_request`.

        - `"computer_use_approval_request"`

    - `SessionRequiredActionResourceFunctionCall`

      Run a function tool and submit its result.

      - `arguments: unknown`

        The arguments supplied by the model.

      - `call_id: string`

        The ID to include when submitting the function result.

        `minLength: 0`

      - `name: string`

        The function name.

        `minLength: 0`

      - `turn_id: string`

        The ID of the turn that requested the function call.

        `minLength: 0`

      - `type: "function_call"`

        The type of the object. Always `function_call`.

        - `"function_call"`

    - `SessionRequiredActionResourceEnvironmentConnection`

      Reconnect a session environment.

      - `environment_id: string`

        The ID of the environment to reconnect.

        `minLength: 0`

      - `type: "environment_connection"`

        The type of the object. Always `environment_connection`.

        - `"environment_connection"`

  - `status: "idle" | "in_progress" | "requires_action" | "failed"`

    The current status of the session.

    - `"idle"`

      The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

    - `"in_progress"`

      The session is processing a turn.

    - `"requires_action"`

      The session is waiting for one or more required actions.

    - `"failed"`

      The session failed.

  - `usage: TokenUsage | null`

    Best-effort token usage for the session, or null if unknown. Recorded usage may change.

    - `input_tokens: number`

      The number of input tokens used by the agent.

      `format: int64`

    - `input_tokens_details: InputTokensDetails`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

        `format: int64`

    - `output_tokens: number`

      The number of output tokens generated by the agent.

      `format: int64`

    - `output_tokens_details: OutputTokensDetails`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

        `format: int64`

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

      `format: int64`

  - `vault_ids: Array<string>`

    The IDs of vaults made available to the session.

    `minItems: 0`, `maxItems: 2000`

  - `prompt_cache_options?: PromptCacheOptions | null`

    Default prompt cache lifetime for turns in this session, when configured.

    - `ttl: "30m" | "12h"`

      - `"30m"`

      - `"12h"`

  - `review?: "none" | "auto_review"`

    Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none.

    - `"none"`

    - `"auto_review"`

  - `spend_control?: SpendControl`

    Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object.

    - `consumed: number | null`

      Best-effort recorded spend floored to whole USD cents, or null when unavailable.

      `minimum: 0`

    - `limit: number`

      The configured positive limit in USD cents.

      `format: int64`, `minimum: 1`, `maximum: 4503599627370495`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const agentSession = await client.beta.agents.sessions.update('session_id');

console.log(agentSession.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "agent": {
    "id": "id",
    "instructions": "instructions",
    "model": "model",
    "multi_agent": {
      "enabled": true,
      "max_concurrent_subagents": 1
    },
    "name": "name",
    "reasoning": {
      "effort": "none",
      "summary": "concise"
    },
    "service_tier": "auto",
    "text": {
      "format": {
        "type": "text"
      },
      "verbosity": "low"
    },
    "tools": [
      {
        "defer_loading": true,
        "description": "description",
        "name": "name",
        "parameters": {
          "foo": "bar"
        },
        "type": "function",
        "async": true
      }
    ],
    "compaction": {
      "async": true
    },
    "experimental": {
      "time_awareness": true
    }
  },
  "created_at": 0,
  "environment": {
    "type": "none"
  },
  "error": "error",
  "last_active_at": 0,
  "metadata": {
    "foo": "string"
  },
  "object": "agent.session",
  "required_actions": [
    {
      "request": {
        "credential_origin": "credential_origin",
        "fields": [
          {
            "id": "id",
            "label": "label",
            "required": true,
            "type": "type"
          }
        ],
        "options": [
          {
            "id": "id",
            "field_ids": [
              "string"
            ],
            "label": "label"
          }
        ],
        "reason": "reason",
        "type": "browser_authentication"
      },
      "request_id": "request_id",
      "turn_id": "turn_id",
      "type": "computer_use_approval_request"
    }
  ],
  "status": "idle",
  "usage": {
    "input_tokens": 0,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 0,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 0
  },
  "vault_ids": [
    "string"
  ],
  "prompt_cache_options": {
    "ttl": "30m"
  },
  "review": "none",
  "spend_control": {
    "consumed": 0,
    "limit": 1
  }
}
```

# Artifacts

## Retrieve agent session artifact content

`client.beta.agents.sessions.artifacts.content(stringartifactID, ArtifactContentParamsparams, RequestOptionsoptions?): Response`

**get** `/agents/sessions/{session_id}/artifacts/{artifact_id}/content`

Downloads immutable session artifact bytes after the execution environment expires. See [session artifacts](/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).

### Parameters

- `artifactID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: ArtifactContentParams`

  - `session_id: string`

    The ID of the session that owns the artifact.

    `minLength: 0`, `maxLength: 1048576`

### Returns

- `unnamed_schema_2 = Response`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const response = await client.beta.agents.sessions.artifacts.content('artifact_id', {
  session_id: 'session_id',
});

console.log(response);

const content = await response.blob();
console.log(content);
```

## Delete an agent session artifact

`client.beta.agents.sessions.artifacts.delete(stringartifactID, ArtifactDeleteParamsparams, RequestOptionsoptions?): SessionArtifactDeleted`

**delete** `/agents/sessions/{session_id}/artifacts/{artifact_id}`

Deletes an immutable session artifact without deleting its live environment file or original Files API object. See [session artifacts](/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).

### Parameters

- `artifactID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: ArtifactDeleteParams`

  - `session_id: string`

    The ID of the session that owns the artifact.

    `minLength: 0`, `maxLength: 1048576`

### Returns

- `SessionArtifactDeleted`

  Confirmation that an immutable session artifact was deleted.

  - `id: string`

    The ID of the deleted session artifact.

    `minLength: 0`

  - `deleted: boolean`

    Whether the session artifact was deleted. Always `true`.

  - `object: "agent.session.artifact.deleted"`

    The object type. Always `agent.session.artifact.deleted`.

    - `"agent.session.artifact.deleted"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const sessionArtifactDeleted = await client.beta.agents.sessions.artifacts.delete('artifact_id', {
  session_id: 'session_id',
});

console.log(sessionArtifactDeleted.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "deleted": true,
  "object": "agent.session.artifact.deleted"
}
```

## List agent session artifacts

`client.beta.agents.sessions.artifacts.list(stringsessionID, ArtifactListParamsquery?, RequestOptionsoptions?): CursorPage<SessionArtifact>`

**get** `/agents/sessions/{session_id}/artifacts`

Lists immutable artifacts published by completed hosted session turns. See [session artifacts](/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).

### Parameters

- `sessionID: string`

  `minLength: 0`, `maxLength: 1048576`

- `query: ArtifactListParams`

  - `after?: string`

    Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `environment_id?: string | null`

    Restrict the listing to artifacts produced by this environment.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

### Returns

- `SessionArtifact`

  An immutable file published by a completed hosted session turn.

  - `id: string`

    The immutable artifact ID.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp, in seconds, when the artifact was published.

    `format: int64`

  - `environment_id: string`

    The ID of the environment that produced the artifact.

    `minLength: 0`

  - `object: "agent.session.artifact"`

    The object type. Always `agent.session.artifact`.

    - `"agent.session.artifact"`

  - `path: string`

    The original absolute file path in the execution environment.

    `minLength: 0`

  - `session_id: string`

    The ID of the session that owns the artifact.

    `minLength: 0`

  - `size_bytes: number`

    The immutable artifact size in bytes.

    `format: int64`, `minimum: 0`

  - `turn_id: string`

    The ID of the completed turn that published the artifact.

    `minLength: 0`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const sessionArtifact of client.beta.agents.sessions.artifacts.list('session_id')) {
  console.log(sessionArtifact.id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "environment_id": "environment_id",
      "object": "agent.session.artifact",
      "path": "path",
      "session_id": "session_id",
      "size_bytes": 0,
      "turn_id": "turn_id"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve an agent session artifact

`client.beta.agents.sessions.artifacts.retrieve(stringartifactID, ArtifactRetrieveParamsparams, RequestOptionsoptions?): SessionArtifact`

**get** `/agents/sessions/{session_id}/artifacts/{artifact_id}`

Retrieves immutable metadata for one durable session artifact. See [session artifacts](/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).

### Parameters

- `artifactID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: ArtifactRetrieveParams`

  - `session_id: string`

    The ID of the session that owns the artifact.

    `minLength: 0`, `maxLength: 1048576`

### Returns

- `SessionArtifact`

  An immutable file published by a completed hosted session turn.

  - `id: string`

    The immutable artifact ID.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp, in seconds, when the artifact was published.

    `format: int64`

  - `environment_id: string`

    The ID of the environment that produced the artifact.

    `minLength: 0`

  - `object: "agent.session.artifact"`

    The object type. Always `agent.session.artifact`.

    - `"agent.session.artifact"`

  - `path: string`

    The original absolute file path in the execution environment.

    `minLength: 0`

  - `session_id: string`

    The ID of the session that owns the artifact.

    `minLength: 0`

  - `size_bytes: number`

    The immutable artifact size in bytes.

    `format: int64`, `minimum: 0`

  - `turn_id: string`

    The ID of the completed turn that published the artifact.

    `minLength: 0`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const sessionArtifact = await client.beta.agents.sessions.artifacts.retrieve('artifact_id', {
  session_id: 'session_id',
});

console.log(sessionArtifact.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "environment_id": "environment_id",
  "object": "agent.session.artifact",
  "path": "path",
  "session_id": "session_id",
  "size_bytes": 0,
  "turn_id": "turn_id"
}
```

## Domain Types

### Session Artifact

- `SessionArtifact`

  An immutable file published by a completed hosted session turn.

  - `id: string`

    The immutable artifact ID.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp, in seconds, when the artifact was published.

    `format: int64`

  - `environment_id: string`

    The ID of the environment that produced the artifact.

    `minLength: 0`

  - `object: "agent.session.artifact"`

    The object type. Always `agent.session.artifact`.

    - `"agent.session.artifact"`

  - `path: string`

    The original absolute file path in the execution environment.

    `minLength: 0`

  - `session_id: string`

    The ID of the session that owns the artifact.

    `minLength: 0`

  - `size_bytes: number`

    The immutable artifact size in bytes.

    `format: int64`, `minimum: 0`

  - `turn_id: string`

    The ID of the completed turn that published the artifact.

    `minLength: 0`

### Session Artifact Deleted

- `SessionArtifactDeleted`

  Confirmation that an immutable session artifact was deleted.

  - `id: string`

    The ID of the deleted session artifact.

    `minLength: 0`

  - `deleted: boolean`

    Whether the session artifact was deleted. Always `true`.

  - `object: "agent.session.artifact.deleted"`

    The object type. Always `agent.session.artifact.deleted`.

    - `"agent.session.artifact.deleted"`

# Events

## Create agent session input events

`client.beta.agents.sessions.events.create(stringsessionID, EventCreateParamsparams, RequestOptionsoptions?): void`

**post** `/agents/sessions/{session_id}/events`

Submits message, cancellation, tool-result, or computer-use approval-response events to a managed agent session. Cancellation can recover a still-open turn whose backend execution has ended by marking it cancelled and abandoning unpublished outputs. Saved results, published files, and existing terminal outcomes are preserved. HTTP 202 confirms acceptance, not durable completion. See [session events](/api/docs/guides/agents-api/sessions/events).

### Parameters

- `sessionID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: EventCreateParams`

  - `events: Array<AgentSessionInputParam>`

    Body param: The input events to submit to the session.

    `minItems: 0`, `maxItems: 16384`

    - `SessionInputParamAgentSessionInputComputerUseApprovalRequestResult`

      Responds to a pending Computer Use approval request.

      - `request_id: string`

        The registered request ID from the required action.

        `minLength: 0`, `maxLength: 1048576`

      - `response: AgentBrowserAuthenticationSubmitParam | AgentBrowserAuthenticationCancelParam | AgentBrowserOriginAccessParam`

        The response for this request type.

        - `AgentBrowserAuthenticationSubmitParam`

          - `action: "submit"`

            - `"submit"`

          - `fields: Array<Field>`

            Values for up to six active fields in the required action. The submitted field-value mapping and selected option must fit within 120 KiB of JSON.

            `minItems: 0`, `maxItems: 6`

            - `field_id: string`

              The field ID from the required action.

              `minLength: 0`, `maxLength: 1048576`

            - `value: string`

              The value to enter into the registered control.

              `minLength: 0`, `maxLength: 16384`

          - `type: "browser_authentication"`

            - `"browser_authentication"`

          - `selected_option?: string | null`

            The chosen method. Required when the required action contains options.

            `minLength: 0`, `maxLength: 1048576`

        - `AgentBrowserAuthenticationCancelParam`

          - `action: "cancel"`

            - `"cancel"`

          - `type: "browser_authentication"`

            - `"browser_authentication"`

        - `AgentBrowserOriginAccessParam`

          - `decision: "approve" | "deny" | "cancel"`

            Whether to allow, deny, or cancel the requested origin access.

            - `"approve"`

              Allow the browser to access this origin.

            - `"deny"`

              Deny access to this origin.

            - `"cancel"`

              Dismiss this request without approving access.

          - `type: "browser_origin_access"`

            - `"browser_origin_access"`

      - `type: "agent.session.input.computer_use_approval_request_result"`

        The type of the object. Always `agent.session.input.computer_use_approval_request_result`.

        - `"agent.session.input.computer_use_approval_request_result"`

    - `SessionInputParamAgentSessionInputMessage`

      Adds one or more user messages and starts a turn.

      - `input: Array<AgentSessionInputMessageParam>`

        The user messages to add to the session.

        `minItems: 0`, `maxItems: 16384`

        - `content: Array<InputContentParam>`

          The content of the message.

          `minItems: 0`, `maxItems: 16384`

          - `InputContentParamInputText`

            Text input to the model.

            - `text: string`

              The text sent to the model.

              `minLength: 0`, `maxLength: 1048576`

            - `type: "input_text"`

              The type of the object. Always `input_text`.

              - `"input_text"`

          - `InputContentParamInputImage`

            Image input to the model.

            - `image_url: string`

              The URL of the image sent to the model.

              `minLength: 0`, `maxLength: 1048576`

            - `type: "input_image"`

              The type of the object. Always `input_image`.

              - `"input_image"`

        - `role: "user"`

          The role of the message author. Always `user`.

          - `"user"`

        - `type?: "message"`

          The type of the input item. Always `message`.

          - `"message"`

      - `type: "agent.session.input.message"`

        The type of the object. Always `agent.session.input.message`.

        - `"agent.session.input.message"`

    - `SessionInputParamAgentSessionInputCancel`

      Cancels the session's active turn.

      - `type: "agent.session.input.cancel"`

        The type of the object. Always `agent.session.input.cancel`.

        - `"agent.session.input.cancel"`

    - `SessionInputParamAgentSessionInputToolResult`

      Submits the result of a function call.

      - `call_id: string`

        The ID of the function call.

        `minLength: 0`, `maxLength: 1048576`

      - `success: boolean`

        Whether the function call succeeded.

      - `turn_id: string`

        The ID of the turn that requested the function call.

        `minLength: 0`, `maxLength: 1048576`

      - `type: "agent.session.input.tool_result"`

        The type of the object. Always `agent.session.input.tool_result`.

        - `"agent.session.input.tool_result"`

      - `error?: string | null`

        The error message when the call failed.

        `minLength: 0`, `maxLength: 1048576`

      - `output?: AgentFunctionCallOutputParam | null`

        The function result when the call succeeded.

        - `string`

        - `Array<InputContentParam>`

          - `InputContentParamInputText`

            Text input to the model.

          - `InputContentParamInputImage`

            Image input to the model.

  - `idempotencyKey?: string`

    Header param: An optional client-generated key that makes retries of submitted messages idempotent.

    `minLength: 1`, `maxLength: 256`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

await client.beta.agents.sessions.events.create('session_id', {
  events: [
    {
      request_id: 'request_id',
      response: {
        action: 'submit',
        fields: [{ field_id: 'field_id', value: 'value' }],
        type: 'browser_authentication',
      },
      type: 'agent.session.input.computer_use_approval_request_result',
    },
  ],
});
```

## Stream agent session events

`client.beta.agents.sessions.events.stream(stringsessionID, EventStreamParamsquery?, RequestOptionsoptions?): AgentSessionEvent | Stream<AgentSessionEvent>`

**get** `/agents/sessions/{session_id}/events`

Streams live events for an agent session. See [session events](/api/docs/guides/agents-api/sessions/events).

### Parameters

- `sessionID: string`

  `minLength: 0`, `maxLength: 1048576`

- `query: EventStreamParams`

  - `include_obfuscation?: boolean`

    Whether to include obfuscation padding in events on this connection. Defaults to `true`.

### Returns

- `AgentSessionEvent = AgentSessionErrorEvent | AgentSessionEnvironmentReadyEvent | AgentSessionEnvironmentSuspendedEvent | 30 more`

  An event emitted by a Managed Agents session.

  - `AgentSessionErrorEvent`

    Emitted when a turn or session fails.

    - `error: SessionError`

      The error that occurred.

      - `code: string | null`

        The machine-readable error code, if any.

        `minLength: 0`

      - `message: string`

        A customer-safe explanation of the error.

        `minLength: 0`

      - `param: string | null`

        The request parameter associated with the error, if any.

        `minLength: 0`

      - `type: string`

        The error type.

        `minLength: 0`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `type: "error"`

      The type of the object. Always `error`.

      - `"error"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentReadyEvent`

    Emitted when a hosted session environment is ready to connect.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

      - `id: string`

        The public ID of the environment.

        `minLength: 0`

      - `error: Error | null`

        The error reported while preparing the environment, if any.

        - `code: string`

          A machine-readable error code.

          `minLength: 0`

        - `message: string`

          A human-readable error message.

          `minLength: 0`

        - `type: string`

          The error type.

          `minLength: 0`

      - `status: "pending" | "ready" | "connected" | 4 more`

        The environment's connection status.

        - `"pending"`

          The environment is being prepared.

        - `"ready"`

          The environment is ready to connect.

        - `"connected"`

          The environment is connected.

        - `"disconnected"`

          The environment is disconnected.

        - `"suspended"`

          The environment is stopped and can be resumed from its private checkpoint.

        - `"expired"`

          The environment and its private checkpoint have expired.

        - `"failed"`

          The environment failed to connect.

      - `type: string`

        The environment type.

        `minLength: 0`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.ready"`

      The type of the object. Always `agent.session.environment.ready`.

      - `"agent.session.environment.ready"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentSuspendedEvent`

    Emitted after an idle hosted session environment is checkpointed and stopped.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.suspended"`

      The type of the object. Always `agent.session.environment.suspended`.

      - `"agent.session.environment.suspended"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentExpiredEvent`

    Emitted after a suspended hosted session environment and its checkpoint expire.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.expired"`

      The type of the object. Always `agent.session.environment.expired`.

      - `"agent.session.environment.expired"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentResetEvent`

    Emitted after a hosted sandbox is replaced. Conversation history survives; changes to the previous sandbox's files and processes do not.

    - `environment_id: string`

      The stable environment ID, retained across sandbox replacements.

      `minLength: 0`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `reset_count: number`

      Monotonically increasing reset number. Repeated notifications share this number.

      `format: int64`, `minimum: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The associated turn, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.reset"`

      The type of the object. Always `agent.session.environment.reset`.

      - `"agent.session.environment.reset"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentOutputCommandExecutionOutputDeltaEvent`

    Emitted when command execution produces an output delta.

    - `delta: string`

      The output text that was appended.

      `minLength: 0`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the command execution item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.output.command_execution_output.delta"`

      The type of the object. Always `agent.output.command_execution_output.delta`.

      - `"agent.output.command_execution_output.delta"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionCreatedEvent`

    Emitted when a session is created.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session: AgentSession`

      The session that was created.

      - `id: string`

        The ID of the session.

        `minLength: 0`

      - `agent: Agent`

        The agent running in the session.

        - `id: string`

          The ID of the agent.

          `minLength: 0`

        - `instructions: string | null`

          Custom instructions appended to the agent's default base instructions.

          `minLength: 0`

        - `model: string`

          The model used by the agent.

          `minLength: 0`

        - `multi_agent: MultiAgentConfig`

          Configuration for creating and coordinating subagents.

          - `enabled: boolean`

            Whether subagent tools are enabled. Defaults to false.

          - `max_concurrent_subagents: number | null`

            Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

            `format: int64`, `minimum: 1`, `maximum: 4294967295`

        - `name: string | null`

          The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

          `minLength: 0`

        - `reasoning: AgentReasoning`

          The agent's reasoning configuration.

          - `effort: "none" | "minimal" | "low" | 4 more | null`

            The requested reasoning effort, or `null` when the model selects its own default.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

          - `summary: "concise" | "detailed" | "auto" | null`

            The requested reasoning summary format, or `null` when summaries are disabled.

            - `"concise"`

              Returns a concise reasoning summary when supported.

            - `"detailed"`

              Returns a detailed reasoning summary when supported.

            - `"auto"`

              Automatically selects the most detailed summary supported by the model.

        - `service_tier: "auto" | "default" | "flex" | 3 more`

          The effective service-tier policy for model requests. Defaults to `auto`.

          - `"auto"`

          - `"default"`

          - `"flex"`

          - `"priority"`

          - `"fast"`

          - `"ultrafast"`

        - `text: AgentText`

          Configuration for text generated by the agent.

          - `format: TextFormat`

            The effective output format. Defaults to ordinary text.

            - `TextFormatResourceText`

              Generates ordinary text without a structured-output constraint.

              - `type: "text"`

                The type of the object. Always `text`.

                - `"text"`

            - `TextFormatResourceJSONSchema`

              Constrains generated text to a JSON Schema.

              - `schema: Record<string, unknown>`

                The JSON Schema that generated text must match.

              - `type: "json_schema"`

                The type of the object. Always `json_schema`.

                - `"json_schema"`

          - `verbosity: "low" | "medium" | "high"`

            The amount of text produced by the agent. Defaults to `medium`.

            - `"low"`

            - `"medium"`

            - `"high"`

        - `tools: Array<AgentTool>`

          Tools available to the agent.

          `minItems: 0`, `maxItems: 2000`

          - `AgentToolResourceFunction`

            A function defined by the application.

            - `defer_loading: boolean`

              Whether the function is deferred and discovered through tool search.

            - `description: string`

              A description of what the function does.

              `minLength: 0`

            - `name: string`

              The name of the function.

              `minLength: 0`

            - `parameters: Record<string, unknown>`

              A JSON Schema object describing the function's arguments.

            - `type: "function"`

              The type of the object. Always `function`.

              - `"function"`

            - `async?: boolean`

              Whether the agent continues without waiting for the function result.

          - `AgentToolResourceProgrammaticToolCalling`

            Enables calling tools from model-generated code.

            - `enabled: boolean`

              Whether tools can be called from model-generated code.

            - `type: "programmatic_tool_calling"`

              The type of the object. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `AgentToolResourceMcp`

            Tools provided by a remote MCP server.

            - `allowed_tools: Array<string> | null`

              The MCP tools the agent may call.

              `minItems: 0`, `maxItems: 2000`

            - `connection_origin: "service" | "environment"`

              Where outbound MCP HTTP connections originate.

              - `"service"`

              - `"environment"`

            - `credential_id: string | null`

              The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

              `minLength: 0`

            - `request_metadata: Record<string, unknown>`

              Metadata included with requests to this MCP server.

            - `required: boolean`

              Whether this MCP server must initialize before the first turn.

            - `server_label: string`

              A label used to identify the MCP server in tool calls.

              `minLength: 0`

            - `transport: McpTransport`

              The transport used to connect to the MCP server.

              - `McpTransportResourceHTTP`

                Connects to an MCP server over HTTP.

                - `server_url: string`

                  The URL of the MCP server.

                  `minLength: 0`

                - `type: "http"`

                  The type of the object. Always `http`.

                  - `"http"`

              - `McpTransportResourceStdio`

                Starts an MCP server as a local process.

                - `args: Array<string>`

                  Arguments passed to the MCP server command.

                  `minItems: 0`, `maxItems: 2000`

                - `command: string`

                  The command used to start the MCP server.

                  `minLength: 0`

                - `cwd: string`

                  The working directory used to start the MCP server.

                  `minLength: 0`

                - `env_vars: Array<string>`

                  Environment variable names inherited from the execution environment.

                  `minItems: 0`, `maxItems: 2000`

                - `type: "stdio"`

                  The type of the object. Always `stdio`.

                  - `"stdio"`

            - `type: "mcp"`

              The type of the object. Always `mcp`.

              - `"mcp"`

          - `AgentToolResourceWebSearch`

            Web search.

            - `allowed_domains: Array<string> | null`

              Allowed search domains, or `null` when the search is unrestricted.

              `minItems: 0`, `maxItems: 2000`

            - `context_size: "low" | "medium" | "high"`

              The amount of search context made available to the model. Defaults to `medium`.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `location: Location | null`

              Approximate location used to localize search results, if provided.

              - `city: string | null`

                The city name.

                `minLength: 0`

              - `country: string | null`

                The two-letter ISO country code, such as `US`.

                `minLength: 0`

              - `region: string | null`

                The region or state name.

                `minLength: 0`

              - `timezone: string | null`

                The IANA timezone, such as `America/Los_Angeles`.

                `minLength: 0`

            - `mode: "disabled" | "cached" | "live"`

              The source used for web search results.

              - `"disabled"`

              - `"cached"`

              - `"live"`

            - `type: "web_search"`

              The type of the object. Always `web_search`.

              - `"web_search"`

          - `AgentToolResourceComputerUse`

            Browser use in an OpenAI-hosted session.

            - `include_screenshots: boolean`

              Whether computer tool outputs include screenshots.

            - `type: "computer_use"`

              The type of the object. Always `computer_use`.

              - `"computer_use"`

          - `AgentToolResourceAutomations`

            Lets the agent manage its own scheduled wakeups.

            - `type: "automations"`

              The type of the object. Always `automations`.

              - `"automations"`

        - `compaction?: Compaction`

          The effective context compaction settings.

          - `async: boolean`

            Whether context is compacted in the background. Defaults to true.

        - `experimental?: Experimental`

          The effective experimental settings for the agent.

          - `time_awareness: boolean`

            Whether the model receives periodic current-time reminders.

      - `created_at: number`

        The Unix timestamp, in seconds, when the session was created.

        `format: int64`

      - `environment: Environment`

        The execution environment for the session.

        - `EnvironmentResourceNone`

          The session talks to CCA without selecting or provisioning an execution environment.

          - `type: "none"`

            The type of the object. Always `none`.

            - `"none"`

        - `EnvironmentResourceOpenAIHosted`

          An environment hosted by OpenAI.

          - `id: string`

            The public ID of the environment.

            `minLength: 0`

          - `capability_directories: Array<string>`

            Directories that contain capabilities exposed to the agent.

            `minItems: 0`, `maxItems: 2000`

          - `files: Array<HostedEnvironmentFile>`

            Files available in the environment, excluding their contents.

            `minItems: 0`, `maxItems: 50`

            - `HostedEnvironmentFileID`

              A file copied from the OpenAI Files API.

              - `id: string`

                The session-scoped ID of the file in the execution environment.

                `minLength: 0`

              - `file_id: string`

                The ID of the uploaded file.

                `minLength: 0`

              - `path: string`

                The file's absolute path inside the environment.

                `minLength: 0`

              - `size_bytes: number`

                The decoded file size in bytes.

                `format: int64`, `minimum: 0`

              - `type: "file_id"`

                The type of the object. Always `file_id`.

                - `"file_id"`

            - `HostedEnvironmentFileResourceInline`

              A file supplied inline when the session was created.

              - `id: string`

                The session-scoped ID of the file in the execution environment.

                `minLength: 0`

              - `path: string`

                The file's absolute path inside the environment.

                `minLength: 0`

              - `size_bytes: number`

                The decoded file size in bytes.

                `format: int64`, `minimum: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

          - `network: Network`

            The effective network access policy for the environment.

            - `access: "enabled" | "disabled" | "restricted"`

              The environment's network access mode.

              - `"enabled"`

                Allows unrestricted network access.

              - `"disabled"`

                Disables network access.

              - `"restricted"`

                Applies the configured domain restrictions.

            - `allowed_domains: Array<string>`

              Domains the environment may access when network access is restricted.

              `minItems: 0`, `maxItems: 2000`

          - `packages: Packages`

            Packages installed in the environment.

            - `npm: Array<string>`

              npm packages installed globally in the environment.

              `minItems: 0`, `maxItems: 16384`

            - `python: Array<string>`

              Python packages installed in the environment.

              `minItems: 0`, `maxItems: 16384`

            - `system: Array<string>`

              System packages installed in the environment.

              `minItems: 0`, `maxItems: 16384`

          - `plugins: Array<HostedPlugin>`

            Plugins installed in the environment, excluding their archive contents.

            `minItems: 0`, `maxItems: 2000`

            - `description: string`

              The installed plugin description.

              `minLength: 0`

            - `name: string`

              The installed plugin name.

              `minLength: 0`

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

          - `skills: Array<HostedSkill>`

            Skills installed in the environment, excluding their archive contents.

            `minItems: 0`, `maxItems: 2000`

            - `HostedSkillReference`

              A skill installed from the Skills API.

              - `description: string`

                The installed skill description.

                `minLength: 0`

              - `name: string`

                The installed skill name.

                `minLength: 0`

              - `skill_id: string`

                The referenced skill ID.

                `minLength: 0`

              - `type: "skill_reference"`

                The type of the object. Always `skill_reference`.

                - `"skill_reference"`

              - `version: string`

                The concrete skill version installed for this session.

                `minLength: 0`

            - `HostedSkillResourceInline`

              A skill installed from an inline ZIP archive.

              - `description: string`

                The installed skill description.

                `minLength: 0`

              - `name: string`

                The installed skill name.

                `minLength: 0`

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

          - `type: "openai_hosted"`

            The type of the object. Always `openai_hosted`.

            - `"openai_hosted"`

          - `container_size?: "small" | "medium" | "large" | null`

            The effective CPU and memory tier, or null when unknown or outside the public tiers.

            - `"small"`

            - `"medium"`

            - `"large"`

          - `desktop?: Desktop`

            The effective desktop configuration.

            - `enabled: boolean`

              Whether the environment provisions a desktop and browser proxy.

        - `EnvironmentResourceSelfHosted`

          An environment hosted by the application.

          - `id: string`

            The public ID of the environment.

            `minLength: 0`

          - `capability_directories: Array<string>`

            Directories that contain capabilities exposed to the agent.

            `minItems: 0`, `maxItems: 2000`

          - `remote_url: string`

            Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

            `minLength: 0`

          - `type: "self_hosted"`

            The type of the object. Always `self_hosted`.

            - `"self_hosted"`

          - `workspace_directory: string`

            The absolute project directory inside the environment. Defaults to `/workspace`.

            `minLength: 0`

      - `error: string | null`

        The error that caused the session to fail, if any.

        `minLength: 0`

      - `last_active_at: number`

        The Unix timestamp, in seconds, when the session was last active.

        `format: int64`

      - `metadata: Record<string, string>`

        Custom string key-value pairs attached to the session.

      - `object: "agent.session"`

        The object type. Always `agent.session`.

        - `"agent.session"`

      - `required_actions: Array<SessionRequiredActionResourceComputerUseApprovalRequest | SessionRequiredActionResourceFunctionCall | SessionRequiredActionResourceEnvironmentConnection>`

        Actions that must be completed before the session can continue.

        `minItems: 0`, `maxItems: 2000`

        - `SessionRequiredActionResourceComputerUseApprovalRequest`

          Respond to a computer-use request.

          - `request: ComputerUseApprovalRequestKindResourceBrowserAuthentication | ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

            The information needed to render the request.

            - `ComputerUseApprovalRequestKindResourceBrowserAuthentication`

              A registered form awaiting the application's response.

              - `credential_origin: string | null`

                The registered form or frame origin where values will be entered.

                `minLength: 0`

              - `fields: Array<Field>`

                Controls to render. All submitted values are sensitive.

                `minItems: 0`, `maxItems: 2000`

                - `id: string`

                  The field ID to submit as field_id in a fields entry.

                  `minLength: 0`

                - `label: string`

                  The label to display beside the control.

                  `minLength: 0`

                - `required: boolean`

                  Whether this control requires a nonempty value.

                - `type: string`

                  The rendering type, such as email, password, or text.

                  `minLength: 0`

              - `options: Array<Option>`

                Sign-in methods. Empty for a plain form.

                `minItems: 0`, `maxItems: 2000`

                - `id: string`

                  The option ID to submit as selected_option.

                  `minLength: 0`

                - `field_ids: Array<string>`

                  IDs from the registered fields that this method accepts.

                  `minItems: 0`, `maxItems: 2000`

                - `label: string`

                  The method label to display.

                  `minLength: 0`

              - `reason: string | null`

                Why the agent needs the user to sign in.

                `minLength: 0`

              - `type: "browser_authentication"`

                The type of the object. Always `browser_authentication`.

                - `"browser_authentication"`

            - `ComputerUseApprovalRequestKindResourceBrowserOriginAccess`

              A browser origin awaiting the application's approval decision.

              - `origin: string`

                The origin the browser needs permission to access.

                `minLength: 0`

              - `reason: string | null`

                The browser's explanation for this request, or null when unavailable.

                `minLength: 0`

              - `type: "browser_origin_access"`

                The type of the object. Always `browser_origin_access`.

                - `"browser_origin_access"`

          - `request_id: string`

            The registered request ID to echo when responding.

            `minLength: 0`

          - `turn_id: string`

            The turn that requested approval.

            `minLength: 0`

          - `type: "computer_use_approval_request"`

            The type of the object. Always `computer_use_approval_request`.

            - `"computer_use_approval_request"`

        - `SessionRequiredActionResourceFunctionCall`

          Run a function tool and submit its result.

          - `arguments: unknown`

            The arguments supplied by the model.

          - `call_id: string`

            The ID to include when submitting the function result.

            `minLength: 0`

          - `name: string`

            The function name.

            `minLength: 0`

          - `turn_id: string`

            The ID of the turn that requested the function call.

            `minLength: 0`

          - `type: "function_call"`

            The type of the object. Always `function_call`.

            - `"function_call"`

        - `SessionRequiredActionResourceEnvironmentConnection`

          Reconnect a session environment.

          - `environment_id: string`

            The ID of the environment to reconnect.

            `minLength: 0`

          - `type: "environment_connection"`

            The type of the object. Always `environment_connection`.

            - `"environment_connection"`

      - `status: "idle" | "in_progress" | "requires_action" | "failed"`

        The current status of the session.

        - `"idle"`

          The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

        - `"in_progress"`

          The session is processing a turn.

        - `"requires_action"`

          The session is waiting for one or more required actions.

        - `"failed"`

          The session failed.

      - `usage: TokenUsage | null`

        Best-effort token usage for the session, or null if unknown. Recorded usage may change.

        - `input_tokens: number`

          The number of input tokens used by the agent.

          `format: int64`

        - `input_tokens_details: InputTokensDetails`

          A breakdown of the agent's input token usage.

          - `cached_tokens: number`

            The number of input tokens retrieved from the prompt cache.

            `format: int64`

        - `output_tokens: number`

          The number of output tokens generated by the agent.

          `format: int64`

        - `output_tokens_details: OutputTokensDetails`

          A breakdown of the agent's output token usage.

          - `reasoning_tokens: number`

            The number of output tokens used for reasoning.

            `format: int64`

        - `total_tokens: number`

          The total number of input and output tokens used by the agent.

          `format: int64`

      - `vault_ids: Array<string>`

        The IDs of vaults made available to the session.

        `minItems: 0`, `maxItems: 2000`

      - `prompt_cache_options?: PromptCacheOptions | null`

        Default prompt cache lifetime for turns in this session, when configured.

        - `ttl: "30m" | "12h"`

          - `"30m"`

          - `"12h"`

      - `review?: "none" | "auto_review"`

        Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none.

        - `"none"`

        - `"auto_review"`

      - `spend_control?: SpendControl`

        Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object.

        - `consumed: number | null`

          Best-effort recorded spend floored to whole USD cents, or null when unavailable.

          `minimum: 0`

        - `limit: number`

          The configured positive limit in USD cents.

          `format: int64`, `minimum: 1`, `maximum: 4503599627370495`

    - `type: "agent.session.created"`

      The type of the object. Always `agent.session.created`.

      - `"agent.session.created"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnCreatedEvent`

    Emitted when a turn is created.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn: Turn`

      The turn at the time it was created.

      - `id: string`

        The ID of the turn.

        `minLength: 0`

      - `agent_id: string`

        The ID of the agent that ran the turn.

        `minLength: 0`

      - `completed_at: number | null`

        The Unix timestamp, in seconds, when the turn reached a terminal state.

        `format: int64`

      - `created_at: number`

        The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

        `format: int64`

      - `error: SessionTurnError | null`

        A customer-safe error. Non-null only for a failed turn.

        - `code: "context_length_exceeded" | "max_output_tokens" | "session_budget_exceeded" | 21 more`

          A stable, machine-readable failure category.

          - `"context_length_exceeded"`

            The request exceeds the model's context window.

          - `"max_output_tokens"`

            The model reached its output token limit before finishing the response.

          - `"session_budget_exceeded"`

            The session has reached its usage budget.

          - `"usage_limit_exceeded"`

            The organization has reached a usage, plan, or billing limit.

          - `"project_spend_limit_exceeded"`

            The project has reached its enforced spend limit.

          - `"organization_spend_limit_exceeded"`

            The organization has reached its enforced spend limit.

          - `"organization_usage_limit_exceeded"`

            The organization has reached its OpenAI-assigned usage limit.

          - `"billing_not_active"`

            Billing is not active for the account.

          - `"credit_balance_exhausted"`

            The organization has no API credits remaining.

          - `"rate_limit_exceeded"`

            The request exceeds the available rate limit.

          - `"flex_unavailable"`

            Flex processing is temporarily unavailable.

          - `"server_overloaded"`

            The model service is temporarily overloaded.

          - `"cyber_policy"`

            The request was rejected by a safety policy.

          - `"misalignment_policy_violation"`

            The request was blocked by the safety systems.

          - `"connection_failed"`

            The request could not connect to the model service.

          - `"server_error"`

            The model service encountered an unexpected error.

          - `"authentication_error"`

            The API credentials are invalid or lack the required access.

          - `"invalid_request"`

            The request contains invalid input or configuration.

          - `"resource_not_found"`

            The requested model or resource is unavailable.

          - `"sandbox_error"`

            The request could not complete in its execution environment.

          - `"executor_version_incompatible"`

            The executor must be upgraded before it can run this turn.

          - `"active_turn_not_steerable"`

            The session cannot accept additional input while a request is running.

          - `"request_timeout"`

            The request timed out before the model service responded.

          - `"internal_error"`

            An unexpected internal error prevented the session request from completing.

        - `message: string`

          A customer-safe explanation of the failure.

          `minLength: 0`

      - `object: "agent.session.turn"`

        The object type. Always `agent.session.turn`.

        - `"agent.session.turn"`

      - `session_id: string`

        The ID of the session that owns the turn.

        `minLength: 0`

      - `started_at: number | null`

        The Unix timestamp, in seconds, when the turn started.

        `format: int64`

      - `status: "queued" | "in_progress" | "waiting" | 3 more`

        The current status of the turn.

        - `"queued"`

          The turn is waiting to start.

        - `"in_progress"`

          The turn is in progress.

        - `"waiting"`

          The turn is waiting for external input.

        - `"completed"`

          The turn completed successfully.

        - `"failed"`

          The turn failed.

        - `"cancelled"`

          The turn was cancelled.

      - `subagent_id: string | null`

        The ID of the subagent that ran the turn, if applicable.

        `minLength: 0`

      - `usage: TokenUsage | null`

        Best-effort token usage for the turn, or null if unknown. Recorded usage may change.

      - `prompt_cache_options?: PromptCacheOptions | null`

        Prompt cache lifetime selected when this turn started, including an inherited session TTL. Null when the turn used the model default or no TTL was recorded.

        - `ttl: "30m" | "12h"`

          - `"30m"`

          - `"12h"`

    - `turn_id: string`

      The ID of the turn associated with the event.

      `minLength: 0`

    - `type: "agent.session.turn.created"`

      The type of the object. Always `agent.session.turn.created`.

      - `"agent.session.turn.created"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnInProgressEvent`

    Emitted when a turn starts running.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn: Turn`

      The turn at the time it started running.

    - `turn_id: string`

      The ID of the turn associated with the event.

      `minLength: 0`

    - `type: "agent.session.turn.in_progress"`

      The type of the object. Always `agent.session.turn.in_progress`.

      - `"agent.session.turn.in_progress"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnCompletedEvent`

    Emitted when a turn completes.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn: Turn`

      The completed turn.

    - `turn_id: string`

      The ID of the turn associated with the event.

      `minLength: 0`

    - `type: "agent.session.turn.completed"`

      The type of the object. Always `agent.session.turn.completed`.

      - `"agent.session.turn.completed"`

    - `usage: TokenUsage | null`

      Token usage by the root agent during the turn, when available.

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnFailedEvent`

    Emitted when a turn fails.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn: Turn`

      The failed turn.

    - `turn_id: string`

      The ID of the turn associated with the event.

      `minLength: 0`

    - `type: "agent.session.turn.failed"`

      The type of the object. Always `agent.session.turn.failed`.

      - `"agent.session.turn.failed"`

    - `usage: TokenUsage | null`

      Token usage by the root agent during the turn, when available.

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnCancelledEvent`

    Emitted when a turn is cancelled.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn: Turn`

      The cancelled turn.

    - `turn_id: string`

      The ID of the turn associated with the event.

      `minLength: 0`

    - `type: "agent.session.turn.cancelled"`

      The type of the object. Always `agent.session.turn.cancelled`.

      - `"agent.session.turn.cancelled"`

    - `usage: TokenUsage | null`

      Token usage by the root agent during the turn, when available.

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnItemAddedEvent`

    Emitted when an item is added to a turn.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item: AgentSessionItem`

      The item that was added.

      - `AgentSessionMessage`

        A user or assistant message recorded in a session.

        - `id: string | null`

          The ID of this item, or null for legacy user messages whose ID was not recorded.

          `minLength: 0`

        - `content: Array<AgentSessionMessageContent>`

          The content of the message. User messages contain input text or images; assistant messages contain output text.

          `minItems: 0`, `maxItems: 2000`

          - `MessageContentResourceInputText`

            Text supplied by the user.

            - `text: string`

              The text supplied by the user.

              `minLength: 0`

            - `type: "input_text"`

              The type of the object. Always `input_text`.

              - `"input_text"`

          - `MessageContentResourceInputImage`

            An image supplied by the user.

            - `image_url: string`

              The URL of the image supplied by the user, which may be a base64-encoded data URL.

              `minLength: 0`

            - `type: "input_image"`

              The type of the object. Always `input_image`.

              - `"input_image"`

          - `MessageContentResourceOutputText`

            Text produced by the assistant.

            - `text: string`

              The text produced by the assistant.

              `minLength: 0`

            - `type: "output_text"`

              The type of the object. Always `output_text`.

              - `"output_text"`

        - `phase: "commentary" | "final_answer" | null`

          The phase of an assistant message. Null for user messages.

          - `"commentary"`

            Commentary produced while the agent works.

          - `"final_answer"`

            The agent's final answer.

        - `role: "user" | "assistant"`

          The role of the message author.

          - `"user"`

          - `"assistant"`

        - `status: AgentOutputItemStatus`

          The status of the message. User messages are always `completed`.

          - `"in_progress"`

            The item is in progress.

          - `"completed"`

            The item is complete.

          - `"incomplete"`

            The item stopped before completing.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "message"`

          The item type. Always `message`.

          - `"message"`

      - `AgentReasoningItem`

        A reasoning item produced by the agent.

        - `id: string`

          The ID of the reasoning item.

          `minLength: 0`

        - `status: AgentOutputItemStatus | null`

          The status of the reasoning item.

        - `summary: Array<SummaryText>`

          The reasoning summaries produced by the agent.

          `minItems: 0`, `maxItems: 2000`

          - `text: string`

            The reasoning summary text.

            `minLength: 0`

          - `type: "summary_text"`

            The content type. Always `summary_text`.

            - `"summary_text"`

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "reasoning"`

          The item type. Always `reasoning`.

          - `"reasoning"`

      - `AgentFunctionCallItem`

        A function call produced by the agent.

        - `id: string`

          The ID of the function call item.

          `minLength: 0`

        - `arguments: unknown`

          The arguments to pass to the function.

        - `call_id: string`

          The ID used to submit the function result.

          `minLength: 0`

        - `name: string`

          The name of the function to call.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the function call.

          - `"in_progress"`

            The call is in progress.

          - `"completed"`

            The call completed successfully.

          - `"failed"`

            The call failed.

          - `"incomplete"`

            The call stopped before completing.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "function_call"`

          The item type. Always `function_call`.

          - `"function_call"`

      - `FunctionCallOutputItemResource`

        The result supplied for a function call.

        - `id: string`

          The ID of the function call output item.

          `minLength: 0`

        - `call_id: string`

          The ID of the function call that produced this output.

          `minLength: 0`

        - `error: string | null`

          The error message, if the call failed.

          `minLength: 0`

        - `output: AgentFunctionCallOutput | null`

          The function result, if the call succeeded.

          - `string`

          - `Array<InputContent>`

            - `InputContentResourceInputText`

              Text input recorded in a session item.

              - `text: string`

                The text supplied to the agent.

                `minLength: 0`

              - `type: "input_text"`

                The type of the object. Always `input_text`.

                - `"input_text"`

            - `InputContentResourceInputImage`

              Image input recorded in a session item.

              - `image_url: string`

                The URL of the image supplied to the agent, which may be a base64-encoded data URL.

                `minLength: 0`

              - `type: "input_image"`

                The type of the object. Always `input_image`.

                - `"input_image"`

        - `status: AgentFunctionCallStatus`

          The status of the function call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "function_call_output"`

          The item type. Always `function_call_output`.

          - `"function_call_output"`

      - `AgentMessageItemResource`

        A message exchanged between agent threads.

        - `id: string`

          The ID of the message.

          `minLength: 0`

        - `content: Array<AgentContent>`

          The content exchanged between the agents.

          `minItems: 0`, `maxItems: 2000`

          - `OutputText`

            A text content part produced by the agent.

            - `text: string`

              The text produced by the agent.

              `minLength: 0`

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

          - `EncryptedContentResource`

            Encrypted content exchanged between agents.

            - `encrypted_content: string`

              The encrypted content payload.

              `minLength: 0`

            - `type: "encrypted_content"`

              The content type. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient_agent_id: string`

          The ID or name of the receiving agent.

          `minLength: 0`

        - `sender_agent_id: string`

          The ID or name of the sending agent.

          `minLength: 0`

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

      - `AgentMcpCallItem`

        A call to a tool on an MCP server.

        - `id: string`

          The ID of the MCP call item.

          `minLength: 0`

        - `arguments: unknown`

          The arguments passed to the MCP tool.

        - `error: unknown`

          The error returned by the MCP tool, if any.

        - `name: string`

          The name of the MCP tool.

          `minLength: 0`

        - `output: unknown`

          The output returned by the MCP tool, if any.

        - `server_label: string`

          The label of the MCP server.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the MCP tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "mcp_call"`

          The item type. Always `mcp_call`.

          - `"mcp_call"`

      - `ComputerUseCallItemResource`

        One execution of the platform-provided computer-use capability.

        - `id: string`

          The ID of the activity item.

          `minLength: 0`

        - `output: Output | null`

          The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot.

          - `image_url: string`

            The complete JPEG image as a base64 data URL.

            `minLength: 0`

          - `type: "computer_screenshot"`

            The content type. Always `computer_screenshot`.

            - `"computer_screenshot"`

        - `status: AgentFunctionCallStatus`

          The execution status of the activity.

        - `title: string | null`

          A model-generated description of the activity, when available.

          `minLength: 0`

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "computer_use_call"`

          The item type. Always `computer_use_call`.

          - `"computer_use_call"`

      - `BrowserAuthenticationRequestItemResource`

        A credential-free history record of the emitted login request.

        - `id: string`

          The stable history item ID.

          `minLength: 0`

        - `request: Request`

          A registered form awaiting the application's response.

          - `credential_origin: string | null`

            The registered form or frame origin where values will be entered.

            `minLength: 0`

          - `fields: Array<Field>`

            Controls to render. All submitted values are sensitive.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The field ID to submit as field_id in a fields entry.

              `minLength: 0`

            - `label: string`

              The label to display beside the control.

              `minLength: 0`

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

              `minLength: 0`

          - `options: Array<Option>`

            Sign-in methods. Empty for a plain form.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The option ID to submit as selected_option.

              `minLength: 0`

            - `field_ids: Array<string>`

              IDs from the registered fields that this method accepts.

              `minItems: 0`, `maxItems: 2000`

            - `label: string`

              The method label to display.

              `minLength: 0`

          - `reason: string | null`

            Why the agent needs the user to sign in.

            `minLength: 0`

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `request_id: string`

          `minLength: 0`

        - `turn_id: string`

          `minLength: 0`

        - `type: "computer_use_approval_request"`

          The item type. Always computer_use_approval_request.

          - `"computer_use_approval_request"`

      - `ComputerUseApprovalRequestResultItemResource`

        A credential-free record of an admitted response, not proof of completion.

        - `id: string`

          The stable history item ID.

          `minLength: 0`

        - `request_id: string`

          The registered request answered by this item.

          `minLength: 0`

        - `response: ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource | ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

          The admitted response, without submitted credential values.

          - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource`

            - `action: "submit"`

              - `"submit"`

            - `selected_option: string | null`

              The chosen sign-in method, or null when no options were offered.

              `minLength: 0`

            - `type: "browser_authentication"`

              - `"browser_authentication"`

          - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

            - `action: "cancel"`

              - `"cancel"`

            - `type: "browser_authentication"`

              - `"browser_authentication"`

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "computer_use_approval_request_result"`

          - `"computer_use_approval_request_result"`

      - `AgentWebSearchCallItem`

        A web search call produced by the agent.

        - `id: string`

          The ID of the web search call.

          `minLength: 0`

        - `action: WebSearchAction | null`

          The action performed by the web search tool.

          - `WebSearchActionResourceSearch`

            A search query or group of search queries.

            - `queries: Array<string> | null`

              The search queries, when multiple queries were used.

              `minItems: 0`, `maxItems: 2000`

            - `query: string | null`

              The search query, when a single query was used.

              `minLength: 0`

            - `type: "search"`

              The type of the object. Always `search`.

              - `"search"`

          - `WebSearchActionResourceOpenPage`

            Opens a web page.

            - `type: "open_page"`

              The type of the object. Always `open_page`.

              - `"open_page"`

            - `url: string | null`

              The URL of the page that was opened.

              `minLength: 0`

          - `WebSearchActionResourceFindInPage`

            Finds text within a web page.

            - `pattern: string | null`

              The text pattern that was searched for.

              `minLength: 0`

            - `type: "find_in_page"`

              The type of the object. Always `find_in_page`.

              - `"find_in_page"`

            - `url: string | null`

              The URL of the page that was searched.

              `minLength: 0`

          - `WebSearchActionResourceOther`

            Another web search action.

            - `type: "other"`

              The type of the object. Always `other`.

              - `"other"`

        - `status: AgentOutputItemStatus`

          The status of the web search call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "web_search_call"`

          The item type. Always `web_search_call`.

          - `"web_search_call"`

      - `AgentCommandExecutionItem`

        A command execution produced by the agent.

        - `id: string`

          The ID of the command execution item.

          `minLength: 0`

        - `command: string`

          The command that was executed.

          `minLength: 0`

        - `cwd: string | null`

          The working directory used to execute the command.

          `minLength: 0`

        - `duration_ms: number | null`

          The command duration in milliseconds.

          `format: int64`

        - `exit_code: number | null`

          The process exit code, if the command completed.

          `format: int64`

        - `output: string | null`

          The command output, if available.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the command execution.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "command_execution"`

          The item type. Always `command_execution`.

          - `"command_execution"`

      - `AgentCreateSubagentCallItem`

        A request to spawn a subagent.

        - `id: string`

          The ID of the tool call item.

          `minLength: 0`

        - `agent_id: string`

          The ID of the agent that requested the subagent.

          `minLength: 0`

        - `content: Array<AgentContent>`

          The task given to the spawned agent.

          `minItems: 0`, `maxItems: 2000`

          - `OutputText`

            A text content part produced by the agent.

          - `EncryptedContentResource`

            Encrypted content exchanged between agents.

        - `model: string | null`

          The model requested for the spawned agent.

          `minLength: 0`

        - `reasoning_effort: string | null`

          The reasoning effort requested for the spawned agent.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "create_subagent_call"`

          The item type. Always `create_subagent_call`.

          - `"create_subagent_call"`

      - `AgentSendSubagentInputCallItem`

        A request to send input to another agent.

        - `id: string`

          The ID of the tool call item.

          `minLength: 0`

        - `content: Array<AgentContent>`

          The input sent to the receiving agent.

          `minItems: 0`, `maxItems: 2000`

          - `OutputText`

            A text content part produced by the agent.

          - `EncryptedContentResource`

            Encrypted content exchanged between agents.

        - `recipient_agent_id: string`

          The ID of the agent receiving the input.

          `minLength: 0`

        - `sender_agent_id: string`

          The ID of the agent sending the input.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "send_subagent_input_call"`

          The item type. Always `send_subagent_input_call`.

          - `"send_subagent_input_call"`

      - `AgentResumeSubagentCallItem`

        A request to resume a subagent.

        - `id: string`

          The ID of the tool call item.

          `minLength: 0`

        - `recipient_agent_id: string`

          The ID of the agent to resume.

          `minLength: 0`

        - `sender_agent_id: string`

          The ID of the agent requesting the resume.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "resume_subagent_call"`

          The item type. Always `resume_subagent_call`.

          - `"resume_subagent_call"`

      - `AgentWaitForSubagentsCallItem`

        A request to wait for one or more subagents.

        - `id: string`

          The ID of the tool call item.

          `minLength: 0`

        - `recipient_agent_ids: Array<string>`

          The IDs of the agents to wait for.

          `minItems: 0`, `maxItems: 2000`

        - `sender_agent_id: string`

          The ID of the agent waiting for results.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "wait_for_subagents_call"`

          The item type. Always `wait_for_subagents_call`.

          - `"wait_for_subagents_call"`

      - `AgentInterruptSubagentCallItem`

        A request to interrupt a subagent's current turn. The subagent remains available.

        - `id: string`

          The ID of the tool call item.

          `minLength: 0`

        - `recipient_agent_id: string`

          The ID of the agent to interrupt.

          `minLength: 0`

        - `sender_agent_id: string`

          The ID of the agent requesting the interrupt.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "interrupt_subagent_call"`

          The item type. Always `interrupt_subagent_call`.

          - `"interrupt_subagent_call"`

      - `AgentCloseSubagentCallItem`

        A request to close a subagent.

        - `id: string`

          The ID of the tool call item.

          `minLength: 0`

        - `recipient_agent_id: string`

          The ID of the agent to close.

          `minLength: 0`

        - `sender_agent_id: string`

          The ID of the agent requesting the close.

          `minLength: 0`

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "close_subagent_call"`

          The item type. Always `close_subagent_call`.

          - `"close_subagent_call"`

    - `output_index: number | null`

      The index of the item in the turn output, when the item is agent output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.item.added"`

      The type of the object. Always `agent.session.turn.item.added`.

      - `"agent.session.turn.item.added"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionIdleEvent`

    Emitted when a session becomes idle.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session: AgentSession`

      The session that became idle.

    - `type: "agent.session.idle"`

      The type of the object. Always `agent.session.idle`.

      - `"agent.session.idle"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionInProgressEvent`

    Emitted when a session starts processing a turn.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session: AgentSession`

      The session that started processing.

    - `type: "agent.session.in_progress"`

      The type of the object. Always `agent.session.in_progress`.

      - `"agent.session.in_progress"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionRequiresActionEvent`

    Emitted when a session is waiting for one or more required actions.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session: AgentSession`

      The session and its current required actions.

    - `type: "agent.session.requires_action"`

      The type of the object. Always `agent.session.requires_action`.

      - `"agent.session.requires_action"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionFailedEvent`

    Emitted when a session fails.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session: AgentSession`

      The failed session.

    - `type: "agent.session.failed"`

      The type of the object. Always `agent.session.failed`.

      - `"agent.session.failed"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentPendingEvent`

    Emitted while a session environment is being prepared.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.pending"`

      The type of the object. Always `agent.session.environment.pending`.

      - `"agent.session.environment.pending"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentConnectedEvent`

    Emitted when a session environment connects.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.connected"`

      The type of the object. Always `agent.session.environment.connected`.

      - `"agent.session.environment.connected"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentDisconnectedEvent`

    Emitted when a session environment disconnects.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.disconnected"`

      The type of the object. Always `agent.session.environment.disconnected`.

      - `"agent.session.environment.disconnected"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionEnvironmentFailedEvent`

    Emitted when a session environment fails.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.environment.failed"`

      The type of the object. Always `agent.session.environment.failed`.

      - `"agent.session.environment.failed"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionSubagentCreatedEvent`

    Emitted when a subagent is created.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `subagent: Subagent`

      The subagent that was created.

      - `id: string`

        The ID of the subagent.

        `minLength: 0`

      - `closed_at: number | null`

        The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume.

        `format: int64`

      - `instructions: Array<AgentContent> | null`

        Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available.

        `minItems: 0`, `maxItems: 2000`

        - `OutputText`

          A text content part produced by the agent.

        - `EncryptedContentResource`

          Encrypted content exchanged between agents.

      - `name: string | null`

        The runner-assigned nickname, or null when unavailable.

        `minLength: 0`

      - `object: "agent.session.subagent"`

        The object type. Always `agent.session.subagent`.

        - `"agent.session.subagent"`

      - `opened_at: number`

        The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it.

        `format: int64`

      - `parent_agent_id: string`

        The ID of the agent that created this subagent.

        `minLength: 0`

      - `session_id: string`

        The ID of the session that owns the subagent.

        `minLength: 0`

      - `status: "active" | "closed"`

        The current status of the subagent.

        - `"active"`

          The subagent remains available, including while idle between turns.

        - `"closed"`

          The subagent is closed.

    - `type: "agent.session.subagent.created"`

      The type of the object. Always `agent.session.subagent.created`.

      - `"agent.session.subagent.created"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionSubagentActiveEvent`

    Emitted when a closed subagent successfully resumes.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `subagent: Subagent`

      The subagent that resumed.

    - `type: "agent.session.subagent.active"`

      The type of the object. Always `agent.session.subagent.active`.

      - `"agent.session.subagent.active"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionSubagentClosedEvent`

    Emitted when a subagent is closed.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `subagent: Subagent`

      The subagent that was closed.

    - `type: "agent.session.subagent.closed"`

      The type of the object. Always `agent.session.subagent.closed`.

      - `"agent.session.subagent.closed"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnItemDoneEvent`

    Emitted when an output item is complete.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item: AgentOutputItem`

      The completed output item.

      - `AgentSessionAssistantMessage`

        An assistant message produced by the agent.

        - `id: string`

          The ID of the message.

          `minLength: 0`

        - `content: Array<OutputText>`

          The content of the message.

          `minItems: 0`, `maxItems: 2000`

          - `text: string`

            The text produced by the agent.

            `minLength: 0`

          - `type: "output_text"`

            The content type. Always `output_text`.

        - `phase: "commentary" | "final_answer" | null`

          The phase of the assistant message.

          - `"commentary"`

            Commentary produced while the agent works.

          - `"final_answer"`

            The agent's final answer.

        - `role: "assistant"`

          The role of the message author. Always `assistant`.

          - `"assistant"`

        - `status: AgentOutputItemStatus`

          The status of the message.

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "message"`

          The item type. Always `message`.

          - `"message"`

      - `AgentReasoningItem`

        A reasoning item produced by the agent.

      - `AgentFunctionCallItem`

        A function call produced by the agent.

      - `AgentMcpCallItem`

        A call to a tool on an MCP server.

      - `ComputerUseCallItemResource`

        One execution of the platform-provided computer-use capability.

        - `id: string`

          The ID of the activity item.

          `minLength: 0`

        - `output: Output | null`

          The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot.

          - `image_url: string`

            The complete JPEG image as a base64 data URL.

            `minLength: 0`

          - `type: "computer_screenshot"`

            The content type. Always `computer_screenshot`.

            - `"computer_screenshot"`

        - `status: AgentFunctionCallStatus`

          The execution status of the activity.

        - `title: string | null`

          A model-generated description of the activity, when available.

          `minLength: 0`

        - `turn_id: string`

          The ID of the turn that contains this item.

          `minLength: 0`

        - `type: "computer_use_call"`

          The item type. Always `computer_use_call`.

          - `"computer_use_call"`

      - `BrowserAuthenticationRequestItemResource`

        A credential-free history record of the emitted login request.

        - `id: string`

          The stable history item ID.

          `minLength: 0`

        - `request: Request`

          A registered form awaiting the application's response.

          - `credential_origin: string | null`

            The registered form or frame origin where values will be entered.

            `minLength: 0`

          - `fields: Array<Field>`

            Controls to render. All submitted values are sensitive.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The field ID to submit as field_id in a fields entry.

              `minLength: 0`

            - `label: string`

              The label to display beside the control.

              `minLength: 0`

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

              `minLength: 0`

          - `options: Array<Option>`

            Sign-in methods. Empty for a plain form.

            `minItems: 0`, `maxItems: 2000`

            - `id: string`

              The option ID to submit as selected_option.

              `minLength: 0`

            - `field_ids: Array<string>`

              IDs from the registered fields that this method accepts.

              `minItems: 0`, `maxItems: 2000`

            - `label: string`

              The method label to display.

              `minLength: 0`

          - `reason: string | null`

            Why the agent needs the user to sign in.

            `minLength: 0`

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `request_id: string`

          `minLength: 0`

        - `turn_id: string`

          `minLength: 0`

        - `type: "computer_use_approval_request"`

          The item type. Always computer_use_approval_request.

          - `"computer_use_approval_request"`

      - `AgentWebSearchCallItem`

        A web search call produced by the agent.

      - `AgentCommandExecutionItem`

        A command execution produced by the agent.

      - `AgentCreateSubagentCallItem`

        A request to spawn a subagent.

      - `AgentSendSubagentInputCallItem`

        A request to send input to another agent.

      - `AgentResumeSubagentCallItem`

        A request to resume a subagent.

      - `AgentWaitForSubagentsCallItem`

        A request to wait for one or more subagents.

      - `AgentInterruptSubagentCallItem`

        A request to interrupt a subagent's current turn. The subagent remains available.

      - `AgentCloseSubagentCallItem`

        A request to close a subagent.

    - `output_index: number`

      The index of the output item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.item.done"`

      The type of the object. Always `agent.session.turn.item.done`.

      - `"agent.session.turn.item.done"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnContentPartAddedEvent`

    Emitted when an output text content part is added.

    - `content_index: number`

      The index of the content part in the message.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the message item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `part: OutputText`

      The initial content part.

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.content_part.added"`

      The type of the object. Always `agent.session.turn.content_part.added`.

      - `"agent.session.turn.content_part.added"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnContentPartDoneEvent`

    Emitted when an output content part is complete.

    - `content_index: number`

      The index of the content part in the message.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the message item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `part: OutputText`

      The completed content part.

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.content_part.done"`

      The type of the object. Always `agent.session.turn.content_part.done`.

      - `"agent.session.turn.content_part.done"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnOutputTextDeltaEvent`

    Emitted when text is appended to an output text content part.

    - `content_index: number`

      The index of the content part in the message.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `delta: string`

      The text that was appended.

      `minLength: 0`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the message item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.output_text.delta"`

      The type of the object. Always `agent.session.turn.output_text.delta`.

      - `"agent.session.turn.output_text.delta"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnOutputTextDoneEvent`

    Emitted when an output text content part is complete.

    - `content_index: number`

      The index of the content part in the message.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the message item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `text: string`

      The complete output text.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.output_text.done"`

      The type of the object. Always `agent.session.turn.output_text.done`.

      - `"agent.session.turn.output_text.done"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnReasoningSummaryPartAddedEvent`

    Emitted when a reasoning summary content part is added.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the reasoning item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `part: SummaryText`

      The initial summary part.

      - `text: string`

        The reasoning summary text.

        `minLength: 0`

      - `type: "summary_text"`

        The content type. Always `summary_text`.

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `summary_index: number`

      The index of the summary content part.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.reasoning_summary_part.added"`

      The type of the object. Always `agent.session.turn.reasoning_summary_part.added`.

      - `"agent.session.turn.reasoning_summary_part.added"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnReasoningSummaryPartDoneEvent`

    Emitted when a reasoning summary part is complete.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the reasoning item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `part: SummaryText`

      The completed summary part.

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `status: "incomplete" | null`

      Present as `incomplete` when summary generation was interrupted.

      - `"incomplete"`

    - `summary_index: number`

      The index of the summary part.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.reasoning_summary_part.done"`

      The type of the object. Always `agent.session.turn.reasoning_summary_part.done`.

      - `"agent.session.turn.reasoning_summary_part.done"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnReasoningSummaryTextDeltaEvent`

    Emitted when text is appended to a reasoning summary.

    - `delta: string`

      The summary text that was appended.

      `minLength: 0`

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the reasoning item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `summary_index: number`

      The index of the summary content part.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.reasoning_summary_text.delta"`

      The type of the object. Always `agent.session.turn.reasoning_summary_text.delta`.

      - `"agent.session.turn.reasoning_summary_text.delta"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

  - `AgentSessionTurnReasoningSummaryTextDoneEvent`

    Emitted when a reasoning summary content part is complete.

    - `event_id: string`

      The unique ID of the event.

      `minLength: 0`

    - `item_id: string`

      The ID of the reasoning item.

      `minLength: 0`

    - `output_index: number`

      The index of the item in the turn output.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `session_id: string`

      The ID of the session associated with the event.

      `minLength: 0`

    - `summary_index: number`

      The index of the summary content part.

      `format: int64`, `minimum: 0`, `maximum: 4294967295`

    - `text: string`

      The complete reasoning summary text.

      `minLength: 0`

    - `turn_id: string | null`

      The ID of the turn associated with the event, when applicable.

      `minLength: 0`

    - `type: "agent.session.turn.reasoning_summary_text.done"`

      The type of the object. Always `agent.session.turn.reasoning_summary_text.done`.

      - `"agent.session.turn.reasoning_summary_text.done"`

    - `obfuscation?: string`

      Random alphanumeric padding. Present when stream obfuscation is enabled.

      `minLength: 0`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const agentSessionEvent = await client.beta.agents.sessions.events.stream('session_id');

console.log(agentSessionEvent);
```

# Items

## List agent session items

`client.beta.agents.sessions.items.list(stringsessionID, ItemListParamsquery?, RequestOptionsoptions?): CursorPage<AgentSessionItem>`

**get** `/agents/sessions/{session_id}/items`

Lists items produced by the session's root agent, including its interactions with subagents. Each subagent has its own item history. See [inspecting agent output](/api/docs/guides/agents-api/observability).

### Parameters

- `sessionID: string`

  `minLength: 0`, `maxLength: 1048576`

- `query: ItemListParams`

  - `after?: string`

    Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

### Returns

- `AgentSessionItem = AgentSessionMessage | AgentReasoningItem | AgentFunctionCallItem | 14 more`

  An item associated with a session turn.

  - `AgentSessionMessage`

    A user or assistant message recorded in a session.

    - `id: string | null`

      The ID of this item, or null for legacy user messages whose ID was not recorded.

      `minLength: 0`

    - `content: Array<AgentSessionMessageContent>`

      The content of the message. User messages contain input text or images; assistant messages contain output text.

      `minItems: 0`, `maxItems: 2000`

      - `MessageContentResourceInputText`

        Text supplied by the user.

        - `text: string`

          The text supplied by the user.

          `minLength: 0`

        - `type: "input_text"`

          The type of the object. Always `input_text`.

          - `"input_text"`

      - `MessageContentResourceInputImage`

        An image supplied by the user.

        - `image_url: string`

          The URL of the image supplied by the user, which may be a base64-encoded data URL.

          `minLength: 0`

        - `type: "input_image"`

          The type of the object. Always `input_image`.

          - `"input_image"`

      - `MessageContentResourceOutputText`

        Text produced by the assistant.

        - `text: string`

          The text produced by the assistant.

          `minLength: 0`

        - `type: "output_text"`

          The type of the object. Always `output_text`.

          - `"output_text"`

    - `phase: "commentary" | "final_answer" | null`

      The phase of an assistant message. Null for user messages.

      - `"commentary"`

        Commentary produced while the agent works.

      - `"final_answer"`

        The agent's final answer.

    - `role: "user" | "assistant"`

      The role of the message author.

      - `"user"`

      - `"assistant"`

    - `status: AgentOutputItemStatus`

      The status of the message. User messages are always `completed`.

      - `"in_progress"`

        The item is in progress.

      - `"completed"`

        The item is complete.

      - `"incomplete"`

        The item stopped before completing.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "message"`

      The item type. Always `message`.

      - `"message"`

  - `AgentReasoningItem`

    A reasoning item produced by the agent.

    - `id: string`

      The ID of the reasoning item.

      `minLength: 0`

    - `status: AgentOutputItemStatus | null`

      The status of the reasoning item.

    - `summary: Array<SummaryText>`

      The reasoning summaries produced by the agent.

      `minItems: 0`, `maxItems: 2000`

      - `text: string`

        The reasoning summary text.

        `minLength: 0`

      - `type: "summary_text"`

        The content type. Always `summary_text`.

        - `"summary_text"`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "reasoning"`

      The item type. Always `reasoning`.

      - `"reasoning"`

  - `AgentFunctionCallItem`

    A function call produced by the agent.

    - `id: string`

      The ID of the function call item.

      `minLength: 0`

    - `arguments: unknown`

      The arguments to pass to the function.

    - `call_id: string`

      The ID used to submit the function result.

      `minLength: 0`

    - `name: string`

      The name of the function to call.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the function call.

      - `"in_progress"`

        The call is in progress.

      - `"completed"`

        The call completed successfully.

      - `"failed"`

        The call failed.

      - `"incomplete"`

        The call stopped before completing.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "function_call"`

      The item type. Always `function_call`.

      - `"function_call"`

  - `FunctionCallOutputItemResource`

    The result supplied for a function call.

    - `id: string`

      The ID of the function call output item.

      `minLength: 0`

    - `call_id: string`

      The ID of the function call that produced this output.

      `minLength: 0`

    - `error: string | null`

      The error message, if the call failed.

      `minLength: 0`

    - `output: AgentFunctionCallOutput | null`

      The function result, if the call succeeded.

      - `string`

      - `Array<InputContent>`

        - `InputContentResourceInputText`

          Text input recorded in a session item.

          - `text: string`

            The text supplied to the agent.

            `minLength: 0`

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputContentResourceInputImage`

          Image input recorded in a session item.

          - `image_url: string`

            The URL of the image supplied to the agent, which may be a base64-encoded data URL.

            `minLength: 0`

          - `type: "input_image"`

            The type of the object. Always `input_image`.

            - `"input_image"`

    - `status: AgentFunctionCallStatus`

      The status of the function call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "function_call_output"`

      The item type. Always `function_call_output`.

      - `"function_call_output"`

  - `AgentMessageItemResource`

    A message exchanged between agent threads.

    - `id: string`

      The ID of the message.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The content exchanged between the agents.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

          `minLength: 0`

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

          `minLength: 0`

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `recipient_agent_id: string`

      The ID or name of the receiving agent.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID or name of the sending agent.

      `minLength: 0`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "agent_message"`

      The item type. Always `agent_message`.

      - `"agent_message"`

  - `AgentMcpCallItem`

    A call to a tool on an MCP server.

    - `id: string`

      The ID of the MCP call item.

      `minLength: 0`

    - `arguments: unknown`

      The arguments passed to the MCP tool.

    - `error: unknown`

      The error returned by the MCP tool, if any.

    - `name: string`

      The name of the MCP tool.

      `minLength: 0`

    - `output: unknown`

      The output returned by the MCP tool, if any.

    - `server_label: string`

      The label of the MCP server.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the MCP tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "mcp_call"`

      The item type. Always `mcp_call`.

      - `"mcp_call"`

  - `ComputerUseCallItemResource`

    One execution of the platform-provided computer-use capability.

    - `id: string`

      The ID of the activity item.

      `minLength: 0`

    - `output: Output | null`

      The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot.

      - `image_url: string`

        The complete JPEG image as a base64 data URL.

        `minLength: 0`

      - `type: "computer_screenshot"`

        The content type. Always `computer_screenshot`.

        - `"computer_screenshot"`

    - `status: AgentFunctionCallStatus`

      The execution status of the activity.

    - `title: string | null`

      A model-generated description of the activity, when available.

      `minLength: 0`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "computer_use_call"`

      The item type. Always `computer_use_call`.

      - `"computer_use_call"`

  - `BrowserAuthenticationRequestItemResource`

    A credential-free history record of the emitted login request.

    - `id: string`

      The stable history item ID.

      `minLength: 0`

    - `request: Request`

      A registered form awaiting the application's response.

      - `credential_origin: string | null`

        The registered form or frame origin where values will be entered.

        `minLength: 0`

      - `fields: Array<Field>`

        Controls to render. All submitted values are sensitive.

        `minItems: 0`, `maxItems: 2000`

        - `id: string`

          The field ID to submit as field_id in a fields entry.

          `minLength: 0`

        - `label: string`

          The label to display beside the control.

          `minLength: 0`

        - `required: boolean`

          Whether this control requires a nonempty value.

        - `type: string`

          The rendering type, such as email, password, or text.

          `minLength: 0`

      - `options: Array<Option>`

        Sign-in methods. Empty for a plain form.

        `minItems: 0`, `maxItems: 2000`

        - `id: string`

          The option ID to submit as selected_option.

          `minLength: 0`

        - `field_ids: Array<string>`

          IDs from the registered fields that this method accepts.

          `minItems: 0`, `maxItems: 2000`

        - `label: string`

          The method label to display.

          `minLength: 0`

      - `reason: string | null`

        Why the agent needs the user to sign in.

        `minLength: 0`

      - `type: "browser_authentication"`

        The type of the object. Always `browser_authentication`.

        - `"browser_authentication"`

    - `request_id: string`

      `minLength: 0`

    - `turn_id: string`

      `minLength: 0`

    - `type: "computer_use_approval_request"`

      The item type. Always computer_use_approval_request.

      - `"computer_use_approval_request"`

  - `ComputerUseApprovalRequestResultItemResource`

    A credential-free record of an admitted response, not proof of completion.

    - `id: string`

      The stable history item ID.

      `minLength: 0`

    - `request_id: string`

      The registered request answered by this item.

      `minLength: 0`

    - `response: ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource | ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

      The admitted response, without submitted credential values.

      - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource`

        - `action: "submit"`

          - `"submit"`

        - `selected_option: string | null`

          The chosen sign-in method, or null when no options were offered.

          `minLength: 0`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

      - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

        - `action: "cancel"`

          - `"cancel"`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "computer_use_approval_request_result"`

      - `"computer_use_approval_request_result"`

  - `AgentWebSearchCallItem`

    A web search call produced by the agent.

    - `id: string`

      The ID of the web search call.

      `minLength: 0`

    - `action: WebSearchAction | null`

      The action performed by the web search tool.

      - `WebSearchActionResourceSearch`

        A search query or group of search queries.

        - `queries: Array<string> | null`

          The search queries, when multiple queries were used.

          `minItems: 0`, `maxItems: 2000`

        - `query: string | null`

          The search query, when a single query was used.

          `minLength: 0`

        - `type: "search"`

          The type of the object. Always `search`.

          - `"search"`

      - `WebSearchActionResourceOpenPage`

        Opens a web page.

        - `type: "open_page"`

          The type of the object. Always `open_page`.

          - `"open_page"`

        - `url: string | null`

          The URL of the page that was opened.

          `minLength: 0`

      - `WebSearchActionResourceFindInPage`

        Finds text within a web page.

        - `pattern: string | null`

          The text pattern that was searched for.

          `minLength: 0`

        - `type: "find_in_page"`

          The type of the object. Always `find_in_page`.

          - `"find_in_page"`

        - `url: string | null`

          The URL of the page that was searched.

          `minLength: 0`

      - `WebSearchActionResourceOther`

        Another web search action.

        - `type: "other"`

          The type of the object. Always `other`.

          - `"other"`

    - `status: AgentOutputItemStatus`

      The status of the web search call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "web_search_call"`

      The item type. Always `web_search_call`.

      - `"web_search_call"`

  - `AgentCommandExecutionItem`

    A command execution produced by the agent.

    - `id: string`

      The ID of the command execution item.

      `minLength: 0`

    - `command: string`

      The command that was executed.

      `minLength: 0`

    - `cwd: string | null`

      The working directory used to execute the command.

      `minLength: 0`

    - `duration_ms: number | null`

      The command duration in milliseconds.

      `format: int64`

    - `exit_code: number | null`

      The process exit code, if the command completed.

      `format: int64`

    - `output: string | null`

      The command output, if available.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the command execution.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "command_execution"`

      The item type. Always `command_execution`.

      - `"command_execution"`

  - `AgentCreateSubagentCallItem`

    A request to spawn a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `agent_id: string`

      The ID of the agent that requested the subagent.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The task given to the spawned agent.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

    - `model: string | null`

      The model requested for the spawned agent.

      `minLength: 0`

    - `reasoning_effort: string | null`

      The reasoning effort requested for the spawned agent.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "create_subagent_call"`

      The item type. Always `create_subagent_call`.

      - `"create_subagent_call"`

  - `AgentSendSubagentInputCallItem`

    A request to send input to another agent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The input sent to the receiving agent.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

    - `recipient_agent_id: string`

      The ID of the agent receiving the input.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent sending the input.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "send_subagent_input_call"`

      The item type. Always `send_subagent_input_call`.

      - `"send_subagent_input_call"`

  - `AgentResumeSubagentCallItem`

    A request to resume a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to resume.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the resume.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "resume_subagent_call"`

      The item type. Always `resume_subagent_call`.

      - `"resume_subagent_call"`

  - `AgentWaitForSubagentsCallItem`

    A request to wait for one or more subagents.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_ids: Array<string>`

      The IDs of the agents to wait for.

      `minItems: 0`, `maxItems: 2000`

    - `sender_agent_id: string`

      The ID of the agent waiting for results.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "wait_for_subagents_call"`

      The item type. Always `wait_for_subagents_call`.

      - `"wait_for_subagents_call"`

  - `AgentInterruptSubagentCallItem`

    A request to interrupt a subagent's current turn. The subagent remains available.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to interrupt.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the interrupt.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "interrupt_subagent_call"`

      The item type. Always `interrupt_subagent_call`.

      - `"interrupt_subagent_call"`

  - `AgentCloseSubagentCallItem`

    A request to close a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to close.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the close.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "close_subagent_call"`

      The item type. Always `close_subagent_call`.

      - `"close_subagent_call"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const agentSessionItem of client.beta.agents.sessions.items.list('session_id')) {
  console.log(agentSessionItem);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "content": [
        {
          "text": "text",
          "type": "input_text"
        }
      ],
      "phase": "commentary",
      "role": "user",
      "status": "in_progress",
      "turn_id": "turn_id",
      "type": "message"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

# Subagents

## List session subagents

`client.beta.agents.sessions.subagents.list(stringsessionID, SubagentListParamsquery?, RequestOptionsoptions?): CursorPage<Subagent>`

**get** `/agents/sessions/{session_id}/subagents`

Lists subagents in a session, including nested and closed subagents. See [subagent workflows](/api/docs/guides/agents-api/multi-agent).

### Parameters

- `sessionID: string`

  `minLength: 0`, `maxLength: 1048576`

- `query: SubagentListParams`

  - `after?: string`

    Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

### Returns

- `Subagent`

  A subagent created within a session.

  - `id: string`

    The ID of the subagent.

    `minLength: 0`

  - `closed_at: number | null`

    The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume.

    `format: int64`

  - `instructions: Array<AgentContent> | null`

    Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available.

    `minItems: 0`, `maxItems: 2000`

    - `OutputText`

      A text content part produced by the agent.

      - `text: string`

        The text produced by the agent.

        `minLength: 0`

      - `type: "output_text"`

        The content type. Always `output_text`.

        - `"output_text"`

    - `EncryptedContentResource`

      Encrypted content exchanged between agents.

      - `encrypted_content: string`

        The encrypted content payload.

        `minLength: 0`

      - `type: "encrypted_content"`

        The content type. Always `encrypted_content`.

        - `"encrypted_content"`

  - `name: string | null`

    The runner-assigned nickname, or null when unavailable.

    `minLength: 0`

  - `object: "agent.session.subagent"`

    The object type. Always `agent.session.subagent`.

    - `"agent.session.subagent"`

  - `opened_at: number`

    The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it.

    `format: int64`

  - `parent_agent_id: string`

    The ID of the agent that created this subagent.

    `minLength: 0`

  - `session_id: string`

    The ID of the session that owns the subagent.

    `minLength: 0`

  - `status: "active" | "closed"`

    The current status of the subagent.

    - `"active"`

      The subagent remains available, including while idle between turns.

    - `"closed"`

      The subagent is closed.

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const subagent of client.beta.agents.sessions.subagents.list('session_id')) {
  console.log(subagent.id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "closed_at": 0,
      "instructions": [
        {
          "text": "text",
          "type": "output_text"
        }
      ],
      "name": "name",
      "object": "agent.session.subagent",
      "opened_at": 0,
      "parent_agent_id": "parent_agent_id",
      "session_id": "session_id",
      "status": "active"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve a session subagent

`client.beta.agents.sessions.subagents.retrieve(stringsubagentID, SubagentRetrieveParamsparams, RequestOptionsoptions?): Subagent`

**get** `/agents/sessions/{session_id}/subagents/{subagent_id}`

Retrieves a subagent belonging to this session. See [subagent workflows](/api/docs/guides/agents-api/multi-agent).

### Parameters

- `subagentID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: SubagentRetrieveParams`

  - `session_id: string`

    The ID of the session.

    `minLength: 0`, `maxLength: 1048576`

### Returns

- `Subagent`

  A subagent created within a session.

  - `id: string`

    The ID of the subagent.

    `minLength: 0`

  - `closed_at: number | null`

    The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume.

    `format: int64`

  - `instructions: Array<AgentContent> | null`

    Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available.

    `minItems: 0`, `maxItems: 2000`

    - `OutputText`

      A text content part produced by the agent.

      - `text: string`

        The text produced by the agent.

        `minLength: 0`

      - `type: "output_text"`

        The content type. Always `output_text`.

        - `"output_text"`

    - `EncryptedContentResource`

      Encrypted content exchanged between agents.

      - `encrypted_content: string`

        The encrypted content payload.

        `minLength: 0`

      - `type: "encrypted_content"`

        The content type. Always `encrypted_content`.

        - `"encrypted_content"`

  - `name: string | null`

    The runner-assigned nickname, or null when unavailable.

    `minLength: 0`

  - `object: "agent.session.subagent"`

    The object type. Always `agent.session.subagent`.

    - `"agent.session.subagent"`

  - `opened_at: number`

    The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it.

    `format: int64`

  - `parent_agent_id: string`

    The ID of the agent that created this subagent.

    `minLength: 0`

  - `session_id: string`

    The ID of the session that owns the subagent.

    `minLength: 0`

  - `status: "active" | "closed"`

    The current status of the subagent.

    - `"active"`

      The subagent remains available, including while idle between turns.

    - `"closed"`

      The subagent is closed.

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const subagent = await client.beta.agents.sessions.subagents.retrieve('subagent_id', {
  session_id: 'session_id',
});

console.log(subagent.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "closed_at": 0,
  "instructions": [
    {
      "text": "text",
      "type": "output_text"
    }
  ],
  "name": "name",
  "object": "agent.session.subagent",
  "opened_at": 0,
  "parent_agent_id": "parent_agent_id",
  "session_id": "session_id",
  "status": "active"
}
```

# Items

## List subagent items

`client.beta.agents.sessions.subagents.items.list(stringsubagentID, ItemListParamsparams, RequestOptionsoptions?): CursorPage<AgentSessionItem>`

**get** `/agents/sessions/{session_id}/subagents/{subagent_id}/items`

Lists this subagent's own items across all of its turns. See [subagent workflows](/api/docs/guides/agents-api/multi-agent).

### Parameters

- `subagentID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: ItemListParams`

  - `session_id: string`

    Path param: The ID of the session.

    `minLength: 0`, `maxLength: 1048576`

  - `after?: string`

    Query param: Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    Query param: The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    Query param: The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

### Returns

- `AgentSessionItem = AgentSessionMessage | AgentReasoningItem | AgentFunctionCallItem | 14 more`

  An item associated with a session turn.

  - `AgentSessionMessage`

    A user or assistant message recorded in a session.

    - `id: string | null`

      The ID of this item, or null for legacy user messages whose ID was not recorded.

      `minLength: 0`

    - `content: Array<AgentSessionMessageContent>`

      The content of the message. User messages contain input text or images; assistant messages contain output text.

      `minItems: 0`, `maxItems: 2000`

      - `MessageContentResourceInputText`

        Text supplied by the user.

        - `text: string`

          The text supplied by the user.

          `minLength: 0`

        - `type: "input_text"`

          The type of the object. Always `input_text`.

          - `"input_text"`

      - `MessageContentResourceInputImage`

        An image supplied by the user.

        - `image_url: string`

          The URL of the image supplied by the user, which may be a base64-encoded data URL.

          `minLength: 0`

        - `type: "input_image"`

          The type of the object. Always `input_image`.

          - `"input_image"`

      - `MessageContentResourceOutputText`

        Text produced by the assistant.

        - `text: string`

          The text produced by the assistant.

          `minLength: 0`

        - `type: "output_text"`

          The type of the object. Always `output_text`.

          - `"output_text"`

    - `phase: "commentary" | "final_answer" | null`

      The phase of an assistant message. Null for user messages.

      - `"commentary"`

        Commentary produced while the agent works.

      - `"final_answer"`

        The agent's final answer.

    - `role: "user" | "assistant"`

      The role of the message author.

      - `"user"`

      - `"assistant"`

    - `status: AgentOutputItemStatus`

      The status of the message. User messages are always `completed`.

      - `"in_progress"`

        The item is in progress.

      - `"completed"`

        The item is complete.

      - `"incomplete"`

        The item stopped before completing.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "message"`

      The item type. Always `message`.

      - `"message"`

  - `AgentReasoningItem`

    A reasoning item produced by the agent.

    - `id: string`

      The ID of the reasoning item.

      `minLength: 0`

    - `status: AgentOutputItemStatus | null`

      The status of the reasoning item.

    - `summary: Array<SummaryText>`

      The reasoning summaries produced by the agent.

      `minItems: 0`, `maxItems: 2000`

      - `text: string`

        The reasoning summary text.

        `minLength: 0`

      - `type: "summary_text"`

        The content type. Always `summary_text`.

        - `"summary_text"`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "reasoning"`

      The item type. Always `reasoning`.

      - `"reasoning"`

  - `AgentFunctionCallItem`

    A function call produced by the agent.

    - `id: string`

      The ID of the function call item.

      `minLength: 0`

    - `arguments: unknown`

      The arguments to pass to the function.

    - `call_id: string`

      The ID used to submit the function result.

      `minLength: 0`

    - `name: string`

      The name of the function to call.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the function call.

      - `"in_progress"`

        The call is in progress.

      - `"completed"`

        The call completed successfully.

      - `"failed"`

        The call failed.

      - `"incomplete"`

        The call stopped before completing.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "function_call"`

      The item type. Always `function_call`.

      - `"function_call"`

  - `FunctionCallOutputItemResource`

    The result supplied for a function call.

    - `id: string`

      The ID of the function call output item.

      `minLength: 0`

    - `call_id: string`

      The ID of the function call that produced this output.

      `minLength: 0`

    - `error: string | null`

      The error message, if the call failed.

      `minLength: 0`

    - `output: AgentFunctionCallOutput | null`

      The function result, if the call succeeded.

      - `string`

      - `Array<InputContent>`

        - `InputContentResourceInputText`

          Text input recorded in a session item.

          - `text: string`

            The text supplied to the agent.

            `minLength: 0`

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputContentResourceInputImage`

          Image input recorded in a session item.

          - `image_url: string`

            The URL of the image supplied to the agent, which may be a base64-encoded data URL.

            `minLength: 0`

          - `type: "input_image"`

            The type of the object. Always `input_image`.

            - `"input_image"`

    - `status: AgentFunctionCallStatus`

      The status of the function call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "function_call_output"`

      The item type. Always `function_call_output`.

      - `"function_call_output"`

  - `AgentMessageItemResource`

    A message exchanged between agent threads.

    - `id: string`

      The ID of the message.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The content exchanged between the agents.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

          `minLength: 0`

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

          `minLength: 0`

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `recipient_agent_id: string`

      The ID or name of the receiving agent.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID or name of the sending agent.

      `minLength: 0`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "agent_message"`

      The item type. Always `agent_message`.

      - `"agent_message"`

  - `AgentMcpCallItem`

    A call to a tool on an MCP server.

    - `id: string`

      The ID of the MCP call item.

      `minLength: 0`

    - `arguments: unknown`

      The arguments passed to the MCP tool.

    - `error: unknown`

      The error returned by the MCP tool, if any.

    - `name: string`

      The name of the MCP tool.

      `minLength: 0`

    - `output: unknown`

      The output returned by the MCP tool, if any.

    - `server_label: string`

      The label of the MCP server.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the MCP tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "mcp_call"`

      The item type. Always `mcp_call`.

      - `"mcp_call"`

  - `ComputerUseCallItemResource`

    One execution of the platform-provided computer-use capability.

    - `id: string`

      The ID of the activity item.

      `minLength: 0`

    - `output: Output | null`

      The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot.

      - `image_url: string`

        The complete JPEG image as a base64 data URL.

        `minLength: 0`

      - `type: "computer_screenshot"`

        The content type. Always `computer_screenshot`.

        - `"computer_screenshot"`

    - `status: AgentFunctionCallStatus`

      The execution status of the activity.

    - `title: string | null`

      A model-generated description of the activity, when available.

      `minLength: 0`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "computer_use_call"`

      The item type. Always `computer_use_call`.

      - `"computer_use_call"`

  - `BrowserAuthenticationRequestItemResource`

    A credential-free history record of the emitted login request.

    - `id: string`

      The stable history item ID.

      `minLength: 0`

    - `request: Request`

      A registered form awaiting the application's response.

      - `credential_origin: string | null`

        The registered form or frame origin where values will be entered.

        `minLength: 0`

      - `fields: Array<Field>`

        Controls to render. All submitted values are sensitive.

        `minItems: 0`, `maxItems: 2000`

        - `id: string`

          The field ID to submit as field_id in a fields entry.

          `minLength: 0`

        - `label: string`

          The label to display beside the control.

          `minLength: 0`

        - `required: boolean`

          Whether this control requires a nonempty value.

        - `type: string`

          The rendering type, such as email, password, or text.

          `minLength: 0`

      - `options: Array<Option>`

        Sign-in methods. Empty for a plain form.

        `minItems: 0`, `maxItems: 2000`

        - `id: string`

          The option ID to submit as selected_option.

          `minLength: 0`

        - `field_ids: Array<string>`

          IDs from the registered fields that this method accepts.

          `minItems: 0`, `maxItems: 2000`

        - `label: string`

          The method label to display.

          `minLength: 0`

      - `reason: string | null`

        Why the agent needs the user to sign in.

        `minLength: 0`

      - `type: "browser_authentication"`

        The type of the object. Always `browser_authentication`.

        - `"browser_authentication"`

    - `request_id: string`

      `minLength: 0`

    - `turn_id: string`

      `minLength: 0`

    - `type: "computer_use_approval_request"`

      The item type. Always computer_use_approval_request.

      - `"computer_use_approval_request"`

  - `ComputerUseApprovalRequestResultItemResource`

    A credential-free record of an admitted response, not proof of completion.

    - `id: string`

      The stable history item ID.

      `minLength: 0`

    - `request_id: string`

      The registered request answered by this item.

      `minLength: 0`

    - `response: ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource | ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

      The admitted response, without submitted credential values.

      - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource`

        - `action: "submit"`

          - `"submit"`

        - `selected_option: string | null`

          The chosen sign-in method, or null when no options were offered.

          `minLength: 0`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

      - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

        - `action: "cancel"`

          - `"cancel"`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "computer_use_approval_request_result"`

      - `"computer_use_approval_request_result"`

  - `AgentWebSearchCallItem`

    A web search call produced by the agent.

    - `id: string`

      The ID of the web search call.

      `minLength: 0`

    - `action: WebSearchAction | null`

      The action performed by the web search tool.

      - `WebSearchActionResourceSearch`

        A search query or group of search queries.

        - `queries: Array<string> | null`

          The search queries, when multiple queries were used.

          `minItems: 0`, `maxItems: 2000`

        - `query: string | null`

          The search query, when a single query was used.

          `minLength: 0`

        - `type: "search"`

          The type of the object. Always `search`.

          - `"search"`

      - `WebSearchActionResourceOpenPage`

        Opens a web page.

        - `type: "open_page"`

          The type of the object. Always `open_page`.

          - `"open_page"`

        - `url: string | null`

          The URL of the page that was opened.

          `minLength: 0`

      - `WebSearchActionResourceFindInPage`

        Finds text within a web page.

        - `pattern: string | null`

          The text pattern that was searched for.

          `minLength: 0`

        - `type: "find_in_page"`

          The type of the object. Always `find_in_page`.

          - `"find_in_page"`

        - `url: string | null`

          The URL of the page that was searched.

          `minLength: 0`

      - `WebSearchActionResourceOther`

        Another web search action.

        - `type: "other"`

          The type of the object. Always `other`.

          - `"other"`

    - `status: AgentOutputItemStatus`

      The status of the web search call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "web_search_call"`

      The item type. Always `web_search_call`.

      - `"web_search_call"`

  - `AgentCommandExecutionItem`

    A command execution produced by the agent.

    - `id: string`

      The ID of the command execution item.

      `minLength: 0`

    - `command: string`

      The command that was executed.

      `minLength: 0`

    - `cwd: string | null`

      The working directory used to execute the command.

      `minLength: 0`

    - `duration_ms: number | null`

      The command duration in milliseconds.

      `format: int64`

    - `exit_code: number | null`

      The process exit code, if the command completed.

      `format: int64`

    - `output: string | null`

      The command output, if available.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the command execution.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "command_execution"`

      The item type. Always `command_execution`.

      - `"command_execution"`

  - `AgentCreateSubagentCallItem`

    A request to spawn a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `agent_id: string`

      The ID of the agent that requested the subagent.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The task given to the spawned agent.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

    - `model: string | null`

      The model requested for the spawned agent.

      `minLength: 0`

    - `reasoning_effort: string | null`

      The reasoning effort requested for the spawned agent.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "create_subagent_call"`

      The item type. Always `create_subagent_call`.

      - `"create_subagent_call"`

  - `AgentSendSubagentInputCallItem`

    A request to send input to another agent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The input sent to the receiving agent.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

    - `recipient_agent_id: string`

      The ID of the agent receiving the input.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent sending the input.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "send_subagent_input_call"`

      The item type. Always `send_subagent_input_call`.

      - `"send_subagent_input_call"`

  - `AgentResumeSubagentCallItem`

    A request to resume a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to resume.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the resume.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "resume_subagent_call"`

      The item type. Always `resume_subagent_call`.

      - `"resume_subagent_call"`

  - `AgentWaitForSubagentsCallItem`

    A request to wait for one or more subagents.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_ids: Array<string>`

      The IDs of the agents to wait for.

      `minItems: 0`, `maxItems: 2000`

    - `sender_agent_id: string`

      The ID of the agent waiting for results.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "wait_for_subagents_call"`

      The item type. Always `wait_for_subagents_call`.

      - `"wait_for_subagents_call"`

  - `AgentInterruptSubagentCallItem`

    A request to interrupt a subagent's current turn. The subagent remains available.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to interrupt.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the interrupt.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "interrupt_subagent_call"`

      The item type. Always `interrupt_subagent_call`.

      - `"interrupt_subagent_call"`

  - `AgentCloseSubagentCallItem`

    A request to close a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to close.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the close.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "close_subagent_call"`

      The item type. Always `close_subagent_call`.

      - `"close_subagent_call"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const agentSessionItem of client.beta.agents.sessions.subagents.items.list(
  'subagent_id',
  { session_id: 'session_id' },
)) {
  console.log(agentSessionItem);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "content": [
        {
          "text": "text",
          "type": "input_text"
        }
      ],
      "phase": "commentary",
      "role": "user",
      "status": "in_progress",
      "turn_id": "turn_id",
      "type": "message"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

# Turns

## List subagent turns

`client.beta.agents.sessions.subagents.turns.list(stringsubagentID, TurnListParamsparams, RequestOptionsoptions?): CursorPage<Turn>`

**get** `/agents/sessions/{session_id}/subagents/{subagent_id}/turns`

Lists all turns of this subagent, including turns after a resume. See [subagent workflows](/api/docs/guides/agents-api/multi-agent).

### Parameters

- `subagentID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: TurnListParams`

  - `session_id: string`

    Path param: The ID of the session.

    `minLength: 0`, `maxLength: 1048576`

  - `after?: string`

    Query param: Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    Query param: The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    Query param: The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

### Returns

- `Turn`

  The canonical public representation of a session turn.

  - `id: string`

    The ID of the turn.

    `minLength: 0`

  - `agent_id: string`

    The ID of the agent that ran the turn.

    `minLength: 0`

  - `completed_at: number | null`

    The Unix timestamp, in seconds, when the turn reached a terminal state.

    `format: int64`

  - `created_at: number`

    The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

    `format: int64`

  - `error: SessionTurnError | null`

    A customer-safe error. Non-null only for a failed turn.

    - `code: "context_length_exceeded" | "max_output_tokens" | "session_budget_exceeded" | 21 more`

      A stable, machine-readable failure category.

      - `"context_length_exceeded"`

        The request exceeds the model's context window.

      - `"max_output_tokens"`

        The model reached its output token limit before finishing the response.

      - `"session_budget_exceeded"`

        The session has reached its usage budget.

      - `"usage_limit_exceeded"`

        The organization has reached a usage, plan, or billing limit.

      - `"project_spend_limit_exceeded"`

        The project has reached its enforced spend limit.

      - `"organization_spend_limit_exceeded"`

        The organization has reached its enforced spend limit.

      - `"organization_usage_limit_exceeded"`

        The organization has reached its OpenAI-assigned usage limit.

      - `"billing_not_active"`

        Billing is not active for the account.

      - `"credit_balance_exhausted"`

        The organization has no API credits remaining.

      - `"rate_limit_exceeded"`

        The request exceeds the available rate limit.

      - `"flex_unavailable"`

        Flex processing is temporarily unavailable.

      - `"server_overloaded"`

        The model service is temporarily overloaded.

      - `"cyber_policy"`

        The request was rejected by a safety policy.

      - `"misalignment_policy_violation"`

        The request was blocked by the safety systems.

      - `"connection_failed"`

        The request could not connect to the model service.

      - `"server_error"`

        The model service encountered an unexpected error.

      - `"authentication_error"`

        The API credentials are invalid or lack the required access.

      - `"invalid_request"`

        The request contains invalid input or configuration.

      - `"resource_not_found"`

        The requested model or resource is unavailable.

      - `"sandbox_error"`

        The request could not complete in its execution environment.

      - `"executor_version_incompatible"`

        The executor must be upgraded before it can run this turn.

      - `"active_turn_not_steerable"`

        The session cannot accept additional input while a request is running.

      - `"request_timeout"`

        The request timed out before the model service responded.

      - `"internal_error"`

        An unexpected internal error prevented the session request from completing.

    - `message: string`

      A customer-safe explanation of the failure.

      `minLength: 0`

  - `object: "agent.session.turn"`

    The object type. Always `agent.session.turn`.

    - `"agent.session.turn"`

  - `session_id: string`

    The ID of the session that owns the turn.

    `minLength: 0`

  - `started_at: number | null`

    The Unix timestamp, in seconds, when the turn started.

    `format: int64`

  - `status: "queued" | "in_progress" | "waiting" | 3 more`

    The current status of the turn.

    - `"queued"`

      The turn is waiting to start.

    - `"in_progress"`

      The turn is in progress.

    - `"waiting"`

      The turn is waiting for external input.

    - `"completed"`

      The turn completed successfully.

    - `"failed"`

      The turn failed.

    - `"cancelled"`

      The turn was cancelled.

  - `subagent_id: string | null`

    The ID of the subagent that ran the turn, if applicable.

    `minLength: 0`

  - `usage: TokenUsage | null`

    Best-effort token usage for the turn, or null if unknown. Recorded usage may change.

    - `input_tokens: number`

      The number of input tokens used by the agent.

      `format: int64`

    - `input_tokens_details: InputTokensDetails`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

        `format: int64`

    - `output_tokens: number`

      The number of output tokens generated by the agent.

      `format: int64`

    - `output_tokens_details: OutputTokensDetails`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

        `format: int64`

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

      `format: int64`

  - `prompt_cache_options?: PromptCacheOptions | null`

    Prompt cache lifetime selected when this turn started, including an inherited session TTL. Null when the turn used the model default or no TTL was recorded.

    - `ttl: "30m" | "12h"`

      - `"30m"`

      - `"12h"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const turn of client.beta.agents.sessions.subagents.turns.list('subagent_id', {
  session_id: 'session_id',
})) {
  console.log(turn.id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "agent_id": "agent_id",
      "completed_at": 0,
      "created_at": 0,
      "error": {
        "code": "context_length_exceeded",
        "message": "message"
      },
      "object": "agent.session.turn",
      "session_id": "session_id",
      "started_at": 0,
      "status": "queued",
      "subagent_id": "subagent_id",
      "usage": {
        "input_tokens": 0,
        "input_tokens_details": {
          "cached_tokens": 0
        },
        "output_tokens": 0,
        "output_tokens_details": {
          "reasoning_tokens": 0
        },
        "total_tokens": 0
      },
      "prompt_cache_options": {
        "ttl": "30m"
      }
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve a subagent turn

`client.beta.agents.sessions.subagents.turns.retrieve(stringturnID, TurnRetrieveParamsparams, RequestOptionsoptions?): Turn`

**get** `/agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}`

Retrieves a turn belonging to this subagent. See [subagent workflows](/api/docs/guides/agents-api/multi-agent).

### Parameters

- `turnID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: TurnRetrieveParams`

  - `session_id: string`

    The ID of the session.

    `minLength: 0`, `maxLength: 1048576`

  - `subagent_id: string`

    The ID of the subagent in this session.

    `minLength: 0`, `maxLength: 1048576`

### Returns

- `Turn`

  The canonical public representation of a session turn.

  - `id: string`

    The ID of the turn.

    `minLength: 0`

  - `agent_id: string`

    The ID of the agent that ran the turn.

    `minLength: 0`

  - `completed_at: number | null`

    The Unix timestamp, in seconds, when the turn reached a terminal state.

    `format: int64`

  - `created_at: number`

    The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

    `format: int64`

  - `error: SessionTurnError | null`

    A customer-safe error. Non-null only for a failed turn.

    - `code: "context_length_exceeded" | "max_output_tokens" | "session_budget_exceeded" | 21 more`

      A stable, machine-readable failure category.

      - `"context_length_exceeded"`

        The request exceeds the model's context window.

      - `"max_output_tokens"`

        The model reached its output token limit before finishing the response.

      - `"session_budget_exceeded"`

        The session has reached its usage budget.

      - `"usage_limit_exceeded"`

        The organization has reached a usage, plan, or billing limit.

      - `"project_spend_limit_exceeded"`

        The project has reached its enforced spend limit.

      - `"organization_spend_limit_exceeded"`

        The organization has reached its enforced spend limit.

      - `"organization_usage_limit_exceeded"`

        The organization has reached its OpenAI-assigned usage limit.

      - `"billing_not_active"`

        Billing is not active for the account.

      - `"credit_balance_exhausted"`

        The organization has no API credits remaining.

      - `"rate_limit_exceeded"`

        The request exceeds the available rate limit.

      - `"flex_unavailable"`

        Flex processing is temporarily unavailable.

      - `"server_overloaded"`

        The model service is temporarily overloaded.

      - `"cyber_policy"`

        The request was rejected by a safety policy.

      - `"misalignment_policy_violation"`

        The request was blocked by the safety systems.

      - `"connection_failed"`

        The request could not connect to the model service.

      - `"server_error"`

        The model service encountered an unexpected error.

      - `"authentication_error"`

        The API credentials are invalid or lack the required access.

      - `"invalid_request"`

        The request contains invalid input or configuration.

      - `"resource_not_found"`

        The requested model or resource is unavailable.

      - `"sandbox_error"`

        The request could not complete in its execution environment.

      - `"executor_version_incompatible"`

        The executor must be upgraded before it can run this turn.

      - `"active_turn_not_steerable"`

        The session cannot accept additional input while a request is running.

      - `"request_timeout"`

        The request timed out before the model service responded.

      - `"internal_error"`

        An unexpected internal error prevented the session request from completing.

    - `message: string`

      A customer-safe explanation of the failure.

      `minLength: 0`

  - `object: "agent.session.turn"`

    The object type. Always `agent.session.turn`.

    - `"agent.session.turn"`

  - `session_id: string`

    The ID of the session that owns the turn.

    `minLength: 0`

  - `started_at: number | null`

    The Unix timestamp, in seconds, when the turn started.

    `format: int64`

  - `status: "queued" | "in_progress" | "waiting" | 3 more`

    The current status of the turn.

    - `"queued"`

      The turn is waiting to start.

    - `"in_progress"`

      The turn is in progress.

    - `"waiting"`

      The turn is waiting for external input.

    - `"completed"`

      The turn completed successfully.

    - `"failed"`

      The turn failed.

    - `"cancelled"`

      The turn was cancelled.

  - `subagent_id: string | null`

    The ID of the subagent that ran the turn, if applicable.

    `minLength: 0`

  - `usage: TokenUsage | null`

    Best-effort token usage for the turn, or null if unknown. Recorded usage may change.

    - `input_tokens: number`

      The number of input tokens used by the agent.

      `format: int64`

    - `input_tokens_details: InputTokensDetails`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

        `format: int64`

    - `output_tokens: number`

      The number of output tokens generated by the agent.

      `format: int64`

    - `output_tokens_details: OutputTokensDetails`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

        `format: int64`

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

      `format: int64`

  - `prompt_cache_options?: PromptCacheOptions | null`

    Prompt cache lifetime selected when this turn started, including an inherited session TTL. Null when the turn used the model default or no TTL was recorded.

    - `ttl: "30m" | "12h"`

      - `"30m"`

      - `"12h"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const turn = await client.beta.agents.sessions.subagents.turns.retrieve('turn_id', {
  session_id: 'session_id',
  subagent_id: 'subagent_id',
});

console.log(turn.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "agent_id": "agent_id",
  "completed_at": 0,
  "created_at": 0,
  "error": {
    "code": "context_length_exceeded",
    "message": "message"
  },
  "object": "agent.session.turn",
  "session_id": "session_id",
  "started_at": 0,
  "status": "queued",
  "subagent_id": "subagent_id",
  "usage": {
    "input_tokens": 0,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 0,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 0
  },
  "prompt_cache_options": {
    "ttl": "30m"
  }
}
```

# Items

## List subagent turn items

`client.beta.agents.sessions.subagents.turns.items.list(stringturnID, ItemListParamsparams, RequestOptionsoptions?): CursorPage<AgentSessionItem>`

**get** `/agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}/items`

Lists items belonging to one turn of this subagent. See [subagent workflows](/api/docs/guides/agents-api/multi-agent).

### Parameters

- `turnID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: ItemListParams`

  - `session_id: string`

    Path param: The ID of the session.

    `minLength: 0`, `maxLength: 1048576`

  - `subagent_id: string`

    Path param: The ID of the subagent in this session.

    `minLength: 0`, `maxLength: 1048576`

  - `after?: string`

    Query param: Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    Query param: The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    Query param: The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

### Returns

- `AgentSessionItem = AgentSessionMessage | AgentReasoningItem | AgentFunctionCallItem | 14 more`

  An item associated with a session turn.

  - `AgentSessionMessage`

    A user or assistant message recorded in a session.

    - `id: string | null`

      The ID of this item, or null for legacy user messages whose ID was not recorded.

      `minLength: 0`

    - `content: Array<AgentSessionMessageContent>`

      The content of the message. User messages contain input text or images; assistant messages contain output text.

      `minItems: 0`, `maxItems: 2000`

      - `MessageContentResourceInputText`

        Text supplied by the user.

        - `text: string`

          The text supplied by the user.

          `minLength: 0`

        - `type: "input_text"`

          The type of the object. Always `input_text`.

          - `"input_text"`

      - `MessageContentResourceInputImage`

        An image supplied by the user.

        - `image_url: string`

          The URL of the image supplied by the user, which may be a base64-encoded data URL.

          `minLength: 0`

        - `type: "input_image"`

          The type of the object. Always `input_image`.

          - `"input_image"`

      - `MessageContentResourceOutputText`

        Text produced by the assistant.

        - `text: string`

          The text produced by the assistant.

          `minLength: 0`

        - `type: "output_text"`

          The type of the object. Always `output_text`.

          - `"output_text"`

    - `phase: "commentary" | "final_answer" | null`

      The phase of an assistant message. Null for user messages.

      - `"commentary"`

        Commentary produced while the agent works.

      - `"final_answer"`

        The agent's final answer.

    - `role: "user" | "assistant"`

      The role of the message author.

      - `"user"`

      - `"assistant"`

    - `status: AgentOutputItemStatus`

      The status of the message. User messages are always `completed`.

      - `"in_progress"`

        The item is in progress.

      - `"completed"`

        The item is complete.

      - `"incomplete"`

        The item stopped before completing.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "message"`

      The item type. Always `message`.

      - `"message"`

  - `AgentReasoningItem`

    A reasoning item produced by the agent.

    - `id: string`

      The ID of the reasoning item.

      `minLength: 0`

    - `status: AgentOutputItemStatus | null`

      The status of the reasoning item.

    - `summary: Array<SummaryText>`

      The reasoning summaries produced by the agent.

      `minItems: 0`, `maxItems: 2000`

      - `text: string`

        The reasoning summary text.

        `minLength: 0`

      - `type: "summary_text"`

        The content type. Always `summary_text`.

        - `"summary_text"`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "reasoning"`

      The item type. Always `reasoning`.

      - `"reasoning"`

  - `AgentFunctionCallItem`

    A function call produced by the agent.

    - `id: string`

      The ID of the function call item.

      `minLength: 0`

    - `arguments: unknown`

      The arguments to pass to the function.

    - `call_id: string`

      The ID used to submit the function result.

      `minLength: 0`

    - `name: string`

      The name of the function to call.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the function call.

      - `"in_progress"`

        The call is in progress.

      - `"completed"`

        The call completed successfully.

      - `"failed"`

        The call failed.

      - `"incomplete"`

        The call stopped before completing.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "function_call"`

      The item type. Always `function_call`.

      - `"function_call"`

  - `FunctionCallOutputItemResource`

    The result supplied for a function call.

    - `id: string`

      The ID of the function call output item.

      `minLength: 0`

    - `call_id: string`

      The ID of the function call that produced this output.

      `minLength: 0`

    - `error: string | null`

      The error message, if the call failed.

      `minLength: 0`

    - `output: AgentFunctionCallOutput | null`

      The function result, if the call succeeded.

      - `string`

      - `Array<InputContent>`

        - `InputContentResourceInputText`

          Text input recorded in a session item.

          - `text: string`

            The text supplied to the agent.

            `minLength: 0`

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputContentResourceInputImage`

          Image input recorded in a session item.

          - `image_url: string`

            The URL of the image supplied to the agent, which may be a base64-encoded data URL.

            `minLength: 0`

          - `type: "input_image"`

            The type of the object. Always `input_image`.

            - `"input_image"`

    - `status: AgentFunctionCallStatus`

      The status of the function call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "function_call_output"`

      The item type. Always `function_call_output`.

      - `"function_call_output"`

  - `AgentMessageItemResource`

    A message exchanged between agent threads.

    - `id: string`

      The ID of the message.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The content exchanged between the agents.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

          `minLength: 0`

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

          `minLength: 0`

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `recipient_agent_id: string`

      The ID or name of the receiving agent.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID or name of the sending agent.

      `minLength: 0`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "agent_message"`

      The item type. Always `agent_message`.

      - `"agent_message"`

  - `AgentMcpCallItem`

    A call to a tool on an MCP server.

    - `id: string`

      The ID of the MCP call item.

      `minLength: 0`

    - `arguments: unknown`

      The arguments passed to the MCP tool.

    - `error: unknown`

      The error returned by the MCP tool, if any.

    - `name: string`

      The name of the MCP tool.

      `minLength: 0`

    - `output: unknown`

      The output returned by the MCP tool, if any.

    - `server_label: string`

      The label of the MCP server.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the MCP tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "mcp_call"`

      The item type. Always `mcp_call`.

      - `"mcp_call"`

  - `ComputerUseCallItemResource`

    One execution of the platform-provided computer-use capability.

    - `id: string`

      The ID of the activity item.

      `minLength: 0`

    - `output: Output | null`

      The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot.

      - `image_url: string`

        The complete JPEG image as a base64 data URL.

        `minLength: 0`

      - `type: "computer_screenshot"`

        The content type. Always `computer_screenshot`.

        - `"computer_screenshot"`

    - `status: AgentFunctionCallStatus`

      The execution status of the activity.

    - `title: string | null`

      A model-generated description of the activity, when available.

      `minLength: 0`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "computer_use_call"`

      The item type. Always `computer_use_call`.

      - `"computer_use_call"`

  - `BrowserAuthenticationRequestItemResource`

    A credential-free history record of the emitted login request.

    - `id: string`

      The stable history item ID.

      `minLength: 0`

    - `request: Request`

      A registered form awaiting the application's response.

      - `credential_origin: string | null`

        The registered form or frame origin where values will be entered.

        `minLength: 0`

      - `fields: Array<Field>`

        Controls to render. All submitted values are sensitive.

        `minItems: 0`, `maxItems: 2000`

        - `id: string`

          The field ID to submit as field_id in a fields entry.

          `minLength: 0`

        - `label: string`

          The label to display beside the control.

          `minLength: 0`

        - `required: boolean`

          Whether this control requires a nonempty value.

        - `type: string`

          The rendering type, such as email, password, or text.

          `minLength: 0`

      - `options: Array<Option>`

        Sign-in methods. Empty for a plain form.

        `minItems: 0`, `maxItems: 2000`

        - `id: string`

          The option ID to submit as selected_option.

          `minLength: 0`

        - `field_ids: Array<string>`

          IDs from the registered fields that this method accepts.

          `minItems: 0`, `maxItems: 2000`

        - `label: string`

          The method label to display.

          `minLength: 0`

      - `reason: string | null`

        Why the agent needs the user to sign in.

        `minLength: 0`

      - `type: "browser_authentication"`

        The type of the object. Always `browser_authentication`.

        - `"browser_authentication"`

    - `request_id: string`

      `minLength: 0`

    - `turn_id: string`

      `minLength: 0`

    - `type: "computer_use_approval_request"`

      The item type. Always computer_use_approval_request.

      - `"computer_use_approval_request"`

  - `ComputerUseApprovalRequestResultItemResource`

    A credential-free record of an admitted response, not proof of completion.

    - `id: string`

      The stable history item ID.

      `minLength: 0`

    - `request_id: string`

      The registered request answered by this item.

      `minLength: 0`

    - `response: ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource | ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

      The admitted response, without submitted credential values.

      - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource`

        - `action: "submit"`

          - `"submit"`

        - `selected_option: string | null`

          The chosen sign-in method, or null when no options were offered.

          `minLength: 0`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

      - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

        - `action: "cancel"`

          - `"cancel"`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "computer_use_approval_request_result"`

      - `"computer_use_approval_request_result"`

  - `AgentWebSearchCallItem`

    A web search call produced by the agent.

    - `id: string`

      The ID of the web search call.

      `minLength: 0`

    - `action: WebSearchAction | null`

      The action performed by the web search tool.

      - `WebSearchActionResourceSearch`

        A search query or group of search queries.

        - `queries: Array<string> | null`

          The search queries, when multiple queries were used.

          `minItems: 0`, `maxItems: 2000`

        - `query: string | null`

          The search query, when a single query was used.

          `minLength: 0`

        - `type: "search"`

          The type of the object. Always `search`.

          - `"search"`

      - `WebSearchActionResourceOpenPage`

        Opens a web page.

        - `type: "open_page"`

          The type of the object. Always `open_page`.

          - `"open_page"`

        - `url: string | null`

          The URL of the page that was opened.

          `minLength: 0`

      - `WebSearchActionResourceFindInPage`

        Finds text within a web page.

        - `pattern: string | null`

          The text pattern that was searched for.

          `minLength: 0`

        - `type: "find_in_page"`

          The type of the object. Always `find_in_page`.

          - `"find_in_page"`

        - `url: string | null`

          The URL of the page that was searched.

          `minLength: 0`

      - `WebSearchActionResourceOther`

        Another web search action.

        - `type: "other"`

          The type of the object. Always `other`.

          - `"other"`

    - `status: AgentOutputItemStatus`

      The status of the web search call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "web_search_call"`

      The item type. Always `web_search_call`.

      - `"web_search_call"`

  - `AgentCommandExecutionItem`

    A command execution produced by the agent.

    - `id: string`

      The ID of the command execution item.

      `minLength: 0`

    - `command: string`

      The command that was executed.

      `minLength: 0`

    - `cwd: string | null`

      The working directory used to execute the command.

      `minLength: 0`

    - `duration_ms: number | null`

      The command duration in milliseconds.

      `format: int64`

    - `exit_code: number | null`

      The process exit code, if the command completed.

      `format: int64`

    - `output: string | null`

      The command output, if available.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the command execution.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "command_execution"`

      The item type. Always `command_execution`.

      - `"command_execution"`

  - `AgentCreateSubagentCallItem`

    A request to spawn a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `agent_id: string`

      The ID of the agent that requested the subagent.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The task given to the spawned agent.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

    - `model: string | null`

      The model requested for the spawned agent.

      `minLength: 0`

    - `reasoning_effort: string | null`

      The reasoning effort requested for the spawned agent.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "create_subagent_call"`

      The item type. Always `create_subagent_call`.

      - `"create_subagent_call"`

  - `AgentSendSubagentInputCallItem`

    A request to send input to another agent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The input sent to the receiving agent.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

    - `recipient_agent_id: string`

      The ID of the agent receiving the input.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent sending the input.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "send_subagent_input_call"`

      The item type. Always `send_subagent_input_call`.

      - `"send_subagent_input_call"`

  - `AgentResumeSubagentCallItem`

    A request to resume a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to resume.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the resume.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "resume_subagent_call"`

      The item type. Always `resume_subagent_call`.

      - `"resume_subagent_call"`

  - `AgentWaitForSubagentsCallItem`

    A request to wait for one or more subagents.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_ids: Array<string>`

      The IDs of the agents to wait for.

      `minItems: 0`, `maxItems: 2000`

    - `sender_agent_id: string`

      The ID of the agent waiting for results.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "wait_for_subagents_call"`

      The item type. Always `wait_for_subagents_call`.

      - `"wait_for_subagents_call"`

  - `AgentInterruptSubagentCallItem`

    A request to interrupt a subagent's current turn. The subagent remains available.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to interrupt.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the interrupt.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "interrupt_subagent_call"`

      The item type. Always `interrupt_subagent_call`.

      - `"interrupt_subagent_call"`

  - `AgentCloseSubagentCallItem`

    A request to close a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to close.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the close.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "close_subagent_call"`

      The item type. Always `close_subagent_call`.

      - `"close_subagent_call"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const agentSessionItem of client.beta.agents.sessions.subagents.turns.items.list(
  'turn_id',
  { session_id: 'session_id', subagent_id: 'subagent_id' },
)) {
  console.log(agentSessionItem);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "content": [
        {
          "text": "text",
          "type": "input_text"
        }
      ],
      "phase": "commentary",
      "role": "user",
      "status": "in_progress",
      "turn_id": "turn_id",
      "type": "message"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

# Traces

## List agent session traces

`client.beta.agents.sessions.traces.list(stringsessionID, TraceListParamsquery?, RequestOptionsoptions?): CursorPage<SessionTrace>`

**get** `/agents/sessions/{session_id}/traces`

Lists published root-turn traces as OTLP JSON, ordered by turn creation time and ID. Unpublished traces are skipped. Each page returns data available when read; it does not wait for late traces. Trace reads and the JSON response are limited to 16 MiB per request. If the limit is exceeded, request fewer traces.

### Parameters

- `sessionID: string`

  `minLength: 0`, `maxLength: 1048576`

- `query: TraceListParams`

  - `after?: string`

    Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

### Returns

- `SessionTrace`

  - `id: string`

    The root turn ID. Use this ID as the pagination anchor.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp in seconds when the root turn was created.

    `format: int64`

  - `object: "agent.session.trace"`

    The object type, which is always `agent.session.trace`.

    - `"agent.session.trace"`

  - `otlp: Record<string, unknown>`

    An OTLP JSON ExportTraceServiceRequest containing resourceSpans. Only currently published data is returned; later trace updates are not awaited.

  - `session_id: string`

    The session that owns this trace.

    `minLength: 0`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const sessionTrace of client.beta.agents.sessions.traces.list('session_id')) {
  console.log(sessionTrace.id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "object": "agent.session.trace",
      "otlp": {
        "foo": "bar"
      },
      "session_id": "session_id"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Domain Types

### Session Trace

- `SessionTrace`

  - `id: string`

    The root turn ID. Use this ID as the pagination anchor.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp in seconds when the root turn was created.

    `format: int64`

  - `object: "agent.session.trace"`

    The object type, which is always `agent.session.trace`.

    - `"agent.session.trace"`

  - `otlp: Record<string, unknown>`

    An OTLP JSON ExportTraceServiceRequest containing resourceSpans. Only currently published data is returned; later trace updates are not awaited.

  - `session_id: string`

    The session that owns this trace.

    `minLength: 0`

# Turns

## List agent session turns

`client.beta.agents.sessions.turns.list(stringsessionID, TurnListParamsquery?, RequestOptionsoptions?): CursorPage<Turn>`

**get** `/agents/sessions/{session_id}/turns`

Lists turns by creation time and turn ID. The after cursor is exclusive in the selected order. See [session turns](/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).

### Parameters

- `sessionID: string`

  `minLength: 0`, `maxLength: 1048576`

- `query: TurnListParams`

  - `after?: string`

    Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

### Returns

- `Turn`

  The canonical public representation of a session turn.

  - `id: string`

    The ID of the turn.

    `minLength: 0`

  - `agent_id: string`

    The ID of the agent that ran the turn.

    `minLength: 0`

  - `completed_at: number | null`

    The Unix timestamp, in seconds, when the turn reached a terminal state.

    `format: int64`

  - `created_at: number`

    The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

    `format: int64`

  - `error: SessionTurnError | null`

    A customer-safe error. Non-null only for a failed turn.

    - `code: "context_length_exceeded" | "max_output_tokens" | "session_budget_exceeded" | 21 more`

      A stable, machine-readable failure category.

      - `"context_length_exceeded"`

        The request exceeds the model's context window.

      - `"max_output_tokens"`

        The model reached its output token limit before finishing the response.

      - `"session_budget_exceeded"`

        The session has reached its usage budget.

      - `"usage_limit_exceeded"`

        The organization has reached a usage, plan, or billing limit.

      - `"project_spend_limit_exceeded"`

        The project has reached its enforced spend limit.

      - `"organization_spend_limit_exceeded"`

        The organization has reached its enforced spend limit.

      - `"organization_usage_limit_exceeded"`

        The organization has reached its OpenAI-assigned usage limit.

      - `"billing_not_active"`

        Billing is not active for the account.

      - `"credit_balance_exhausted"`

        The organization has no API credits remaining.

      - `"rate_limit_exceeded"`

        The request exceeds the available rate limit.

      - `"flex_unavailable"`

        Flex processing is temporarily unavailable.

      - `"server_overloaded"`

        The model service is temporarily overloaded.

      - `"cyber_policy"`

        The request was rejected by a safety policy.

      - `"misalignment_policy_violation"`

        The request was blocked by the safety systems.

      - `"connection_failed"`

        The request could not connect to the model service.

      - `"server_error"`

        The model service encountered an unexpected error.

      - `"authentication_error"`

        The API credentials are invalid or lack the required access.

      - `"invalid_request"`

        The request contains invalid input or configuration.

      - `"resource_not_found"`

        The requested model or resource is unavailable.

      - `"sandbox_error"`

        The request could not complete in its execution environment.

      - `"executor_version_incompatible"`

        The executor must be upgraded before it can run this turn.

      - `"active_turn_not_steerable"`

        The session cannot accept additional input while a request is running.

      - `"request_timeout"`

        The request timed out before the model service responded.

      - `"internal_error"`

        An unexpected internal error prevented the session request from completing.

    - `message: string`

      A customer-safe explanation of the failure.

      `minLength: 0`

  - `object: "agent.session.turn"`

    The object type. Always `agent.session.turn`.

    - `"agent.session.turn"`

  - `session_id: string`

    The ID of the session that owns the turn.

    `minLength: 0`

  - `started_at: number | null`

    The Unix timestamp, in seconds, when the turn started.

    `format: int64`

  - `status: "queued" | "in_progress" | "waiting" | 3 more`

    The current status of the turn.

    - `"queued"`

      The turn is waiting to start.

    - `"in_progress"`

      The turn is in progress.

    - `"waiting"`

      The turn is waiting for external input.

    - `"completed"`

      The turn completed successfully.

    - `"failed"`

      The turn failed.

    - `"cancelled"`

      The turn was cancelled.

  - `subagent_id: string | null`

    The ID of the subagent that ran the turn, if applicable.

    `minLength: 0`

  - `usage: TokenUsage | null`

    Best-effort token usage for the turn, or null if unknown. Recorded usage may change.

    - `input_tokens: number`

      The number of input tokens used by the agent.

      `format: int64`

    - `input_tokens_details: InputTokensDetails`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

        `format: int64`

    - `output_tokens: number`

      The number of output tokens generated by the agent.

      `format: int64`

    - `output_tokens_details: OutputTokensDetails`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

        `format: int64`

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

      `format: int64`

  - `prompt_cache_options?: PromptCacheOptions | null`

    Prompt cache lifetime selected when this turn started, including an inherited session TTL. Null when the turn used the model default or no TTL was recorded.

    - `ttl: "30m" | "12h"`

      - `"30m"`

      - `"12h"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const turn of client.beta.agents.sessions.turns.list('session_id')) {
  console.log(turn.id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "agent_id": "agent_id",
      "completed_at": 0,
      "created_at": 0,
      "error": {
        "code": "context_length_exceeded",
        "message": "message"
      },
      "object": "agent.session.turn",
      "session_id": "session_id",
      "started_at": 0,
      "status": "queued",
      "subagent_id": "subagent_id",
      "usage": {
        "input_tokens": 0,
        "input_tokens_details": {
          "cached_tokens": 0
        },
        "output_tokens": 0,
        "output_tokens_details": {
          "reasoning_tokens": 0
        },
        "total_tokens": 0
      },
      "prompt_cache_options": {
        "ttl": "30m"
      }
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve an agent session turn

`client.beta.agents.sessions.turns.retrieve(stringturnID, TurnRetrieveParamsparams, RequestOptionsoptions?): Turn`

**get** `/agents/sessions/{session_id}/turns/{turn_id}`

Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if the turn does not belong to the session. See [session turns](/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).

### Parameters

- `turnID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: TurnRetrieveParams`

  - `session_id: string`

    The ID of the session that owns the turn.

    `minLength: 0`, `maxLength: 1048576`

### Returns

- `Turn`

  The canonical public representation of a session turn.

  - `id: string`

    The ID of the turn.

    `minLength: 0`

  - `agent_id: string`

    The ID of the agent that ran the turn.

    `minLength: 0`

  - `completed_at: number | null`

    The Unix timestamp, in seconds, when the turn reached a terminal state.

    `format: int64`

  - `created_at: number`

    The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

    `format: int64`

  - `error: SessionTurnError | null`

    A customer-safe error. Non-null only for a failed turn.

    - `code: "context_length_exceeded" | "max_output_tokens" | "session_budget_exceeded" | 21 more`

      A stable, machine-readable failure category.

      - `"context_length_exceeded"`

        The request exceeds the model's context window.

      - `"max_output_tokens"`

        The model reached its output token limit before finishing the response.

      - `"session_budget_exceeded"`

        The session has reached its usage budget.

      - `"usage_limit_exceeded"`

        The organization has reached a usage, plan, or billing limit.

      - `"project_spend_limit_exceeded"`

        The project has reached its enforced spend limit.

      - `"organization_spend_limit_exceeded"`

        The organization has reached its enforced spend limit.

      - `"organization_usage_limit_exceeded"`

        The organization has reached its OpenAI-assigned usage limit.

      - `"billing_not_active"`

        Billing is not active for the account.

      - `"credit_balance_exhausted"`

        The organization has no API credits remaining.

      - `"rate_limit_exceeded"`

        The request exceeds the available rate limit.

      - `"flex_unavailable"`

        Flex processing is temporarily unavailable.

      - `"server_overloaded"`

        The model service is temporarily overloaded.

      - `"cyber_policy"`

        The request was rejected by a safety policy.

      - `"misalignment_policy_violation"`

        The request was blocked by the safety systems.

      - `"connection_failed"`

        The request could not connect to the model service.

      - `"server_error"`

        The model service encountered an unexpected error.

      - `"authentication_error"`

        The API credentials are invalid or lack the required access.

      - `"invalid_request"`

        The request contains invalid input or configuration.

      - `"resource_not_found"`

        The requested model or resource is unavailable.

      - `"sandbox_error"`

        The request could not complete in its execution environment.

      - `"executor_version_incompatible"`

        The executor must be upgraded before it can run this turn.

      - `"active_turn_not_steerable"`

        The session cannot accept additional input while a request is running.

      - `"request_timeout"`

        The request timed out before the model service responded.

      - `"internal_error"`

        An unexpected internal error prevented the session request from completing.

    - `message: string`

      A customer-safe explanation of the failure.

      `minLength: 0`

  - `object: "agent.session.turn"`

    The object type. Always `agent.session.turn`.

    - `"agent.session.turn"`

  - `session_id: string`

    The ID of the session that owns the turn.

    `minLength: 0`

  - `started_at: number | null`

    The Unix timestamp, in seconds, when the turn started.

    `format: int64`

  - `status: "queued" | "in_progress" | "waiting" | 3 more`

    The current status of the turn.

    - `"queued"`

      The turn is waiting to start.

    - `"in_progress"`

      The turn is in progress.

    - `"waiting"`

      The turn is waiting for external input.

    - `"completed"`

      The turn completed successfully.

    - `"failed"`

      The turn failed.

    - `"cancelled"`

      The turn was cancelled.

  - `subagent_id: string | null`

    The ID of the subagent that ran the turn, if applicable.

    `minLength: 0`

  - `usage: TokenUsage | null`

    Best-effort token usage for the turn, or null if unknown. Recorded usage may change.

    - `input_tokens: number`

      The number of input tokens used by the agent.

      `format: int64`

    - `input_tokens_details: InputTokensDetails`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

        `format: int64`

    - `output_tokens: number`

      The number of output tokens generated by the agent.

      `format: int64`

    - `output_tokens_details: OutputTokensDetails`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

        `format: int64`

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

      `format: int64`

  - `prompt_cache_options?: PromptCacheOptions | null`

    Prompt cache lifetime selected when this turn started, including an inherited session TTL. Null when the turn used the model default or no TTL was recorded.

    - `ttl: "30m" | "12h"`

      - `"30m"`

      - `"12h"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const turn = await client.beta.agents.sessions.turns.retrieve('turn_id', {
  session_id: 'session_id',
});

console.log(turn.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "agent_id": "agent_id",
  "completed_at": 0,
  "created_at": 0,
  "error": {
    "code": "context_length_exceeded",
    "message": "message"
  },
  "object": "agent.session.turn",
  "session_id": "session_id",
  "started_at": 0,
  "status": "queued",
  "subagent_id": "subagent_id",
  "usage": {
    "input_tokens": 0,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 0,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 0
  },
  "prompt_cache_options": {
    "ttl": "30m"
  }
}
```

## Domain Types

### Turn

- `Turn`

  The canonical public representation of a session turn.

  - `id: string`

    The ID of the turn.

    `minLength: 0`

  - `agent_id: string`

    The ID of the agent that ran the turn.

    `minLength: 0`

  - `completed_at: number | null`

    The Unix timestamp, in seconds, when the turn reached a terminal state.

    `format: int64`

  - `created_at: number`

    The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

    `format: int64`

  - `error: SessionTurnError | null`

    A customer-safe error. Non-null only for a failed turn.

    - `code: "context_length_exceeded" | "max_output_tokens" | "session_budget_exceeded" | 21 more`

      A stable, machine-readable failure category.

      - `"context_length_exceeded"`

        The request exceeds the model's context window.

      - `"max_output_tokens"`

        The model reached its output token limit before finishing the response.

      - `"session_budget_exceeded"`

        The session has reached its usage budget.

      - `"usage_limit_exceeded"`

        The organization has reached a usage, plan, or billing limit.

      - `"project_spend_limit_exceeded"`

        The project has reached its enforced spend limit.

      - `"organization_spend_limit_exceeded"`

        The organization has reached its enforced spend limit.

      - `"organization_usage_limit_exceeded"`

        The organization has reached its OpenAI-assigned usage limit.

      - `"billing_not_active"`

        Billing is not active for the account.

      - `"credit_balance_exhausted"`

        The organization has no API credits remaining.

      - `"rate_limit_exceeded"`

        The request exceeds the available rate limit.

      - `"flex_unavailable"`

        Flex processing is temporarily unavailable.

      - `"server_overloaded"`

        The model service is temporarily overloaded.

      - `"cyber_policy"`

        The request was rejected by a safety policy.

      - `"misalignment_policy_violation"`

        The request was blocked by the safety systems.

      - `"connection_failed"`

        The request could not connect to the model service.

      - `"server_error"`

        The model service encountered an unexpected error.

      - `"authentication_error"`

        The API credentials are invalid or lack the required access.

      - `"invalid_request"`

        The request contains invalid input or configuration.

      - `"resource_not_found"`

        The requested model or resource is unavailable.

      - `"sandbox_error"`

        The request could not complete in its execution environment.

      - `"executor_version_incompatible"`

        The executor must be upgraded before it can run this turn.

      - `"active_turn_not_steerable"`

        The session cannot accept additional input while a request is running.

      - `"request_timeout"`

        The request timed out before the model service responded.

      - `"internal_error"`

        An unexpected internal error prevented the session request from completing.

    - `message: string`

      A customer-safe explanation of the failure.

      `minLength: 0`

  - `object: "agent.session.turn"`

    The object type. Always `agent.session.turn`.

    - `"agent.session.turn"`

  - `session_id: string`

    The ID of the session that owns the turn.

    `minLength: 0`

  - `started_at: number | null`

    The Unix timestamp, in seconds, when the turn started.

    `format: int64`

  - `status: "queued" | "in_progress" | "waiting" | 3 more`

    The current status of the turn.

    - `"queued"`

      The turn is waiting to start.

    - `"in_progress"`

      The turn is in progress.

    - `"waiting"`

      The turn is waiting for external input.

    - `"completed"`

      The turn completed successfully.

    - `"failed"`

      The turn failed.

    - `"cancelled"`

      The turn was cancelled.

  - `subagent_id: string | null`

    The ID of the subagent that ran the turn, if applicable.

    `minLength: 0`

  - `usage: TokenUsage | null`

    Best-effort token usage for the turn, or null if unknown. Recorded usage may change.

    - `input_tokens: number`

      The number of input tokens used by the agent.

      `format: int64`

    - `input_tokens_details: InputTokensDetails`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

        `format: int64`

    - `output_tokens: number`

      The number of output tokens generated by the agent.

      `format: int64`

    - `output_tokens_details: OutputTokensDetails`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

        `format: int64`

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

      `format: int64`

  - `prompt_cache_options?: PromptCacheOptions | null`

    Prompt cache lifetime selected when this turn started, including an inherited session TTL. Null when the turn used the model default or no TTL was recorded.

    - `ttl: "30m" | "12h"`

      - `"30m"`

      - `"12h"`

# Items

## List agent session turn items

`client.beta.agents.sessions.turns.items.list(stringturnID, ItemListParamsparams, RequestOptionsoptions?): ConversationCursorPage<AgentSessionItem>`

**get** `/agents/sessions/{session_id}/turns/{turn_id}/items`

Lists items belonging to one root-agent turn, including its interactions with subagents. See [inspecting agent output](/api/docs/guides/agents-api/observability).

### Parameters

- `turnID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: ItemListParams`

  - `session_id: string`

    Path param: The ID of the session that owns the turn.

    `minLength: 0`, `maxLength: 1048576`

  - `after?: string`

    Query param: Return items after this cursor in the selected order. Pass the previous response's last_id, which can differ from the last item's ID.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    Query param: The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `order?: "asc" | "desc"`

    Query param: The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

### Returns

- `AgentSessionItem = AgentSessionMessage | AgentReasoningItem | AgentFunctionCallItem | 14 more`

  An item associated with a session turn.

  - `AgentSessionMessage`

    A user or assistant message recorded in a session.

    - `id: string | null`

      The ID of this item, or null for legacy user messages whose ID was not recorded.

      `minLength: 0`

    - `content: Array<AgentSessionMessageContent>`

      The content of the message. User messages contain input text or images; assistant messages contain output text.

      `minItems: 0`, `maxItems: 2000`

      - `MessageContentResourceInputText`

        Text supplied by the user.

        - `text: string`

          The text supplied by the user.

          `minLength: 0`

        - `type: "input_text"`

          The type of the object. Always `input_text`.

          - `"input_text"`

      - `MessageContentResourceInputImage`

        An image supplied by the user.

        - `image_url: string`

          The URL of the image supplied by the user, which may be a base64-encoded data URL.

          `minLength: 0`

        - `type: "input_image"`

          The type of the object. Always `input_image`.

          - `"input_image"`

      - `MessageContentResourceOutputText`

        Text produced by the assistant.

        - `text: string`

          The text produced by the assistant.

          `minLength: 0`

        - `type: "output_text"`

          The type of the object. Always `output_text`.

          - `"output_text"`

    - `phase: "commentary" | "final_answer" | null`

      The phase of an assistant message. Null for user messages.

      - `"commentary"`

        Commentary produced while the agent works.

      - `"final_answer"`

        The agent's final answer.

    - `role: "user" | "assistant"`

      The role of the message author.

      - `"user"`

      - `"assistant"`

    - `status: AgentOutputItemStatus`

      The status of the message. User messages are always `completed`.

      - `"in_progress"`

        The item is in progress.

      - `"completed"`

        The item is complete.

      - `"incomplete"`

        The item stopped before completing.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "message"`

      The item type. Always `message`.

      - `"message"`

  - `AgentReasoningItem`

    A reasoning item produced by the agent.

    - `id: string`

      The ID of the reasoning item.

      `minLength: 0`

    - `status: AgentOutputItemStatus | null`

      The status of the reasoning item.

    - `summary: Array<SummaryText>`

      The reasoning summaries produced by the agent.

      `minItems: 0`, `maxItems: 2000`

      - `text: string`

        The reasoning summary text.

        `minLength: 0`

      - `type: "summary_text"`

        The content type. Always `summary_text`.

        - `"summary_text"`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "reasoning"`

      The item type. Always `reasoning`.

      - `"reasoning"`

  - `AgentFunctionCallItem`

    A function call produced by the agent.

    - `id: string`

      The ID of the function call item.

      `minLength: 0`

    - `arguments: unknown`

      The arguments to pass to the function.

    - `call_id: string`

      The ID used to submit the function result.

      `minLength: 0`

    - `name: string`

      The name of the function to call.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the function call.

      - `"in_progress"`

        The call is in progress.

      - `"completed"`

        The call completed successfully.

      - `"failed"`

        The call failed.

      - `"incomplete"`

        The call stopped before completing.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "function_call"`

      The item type. Always `function_call`.

      - `"function_call"`

  - `FunctionCallOutputItemResource`

    The result supplied for a function call.

    - `id: string`

      The ID of the function call output item.

      `minLength: 0`

    - `call_id: string`

      The ID of the function call that produced this output.

      `minLength: 0`

    - `error: string | null`

      The error message, if the call failed.

      `minLength: 0`

    - `output: AgentFunctionCallOutput | null`

      The function result, if the call succeeded.

      - `string`

      - `Array<InputContent>`

        - `InputContentResourceInputText`

          Text input recorded in a session item.

          - `text: string`

            The text supplied to the agent.

            `minLength: 0`

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputContentResourceInputImage`

          Image input recorded in a session item.

          - `image_url: string`

            The URL of the image supplied to the agent, which may be a base64-encoded data URL.

            `minLength: 0`

          - `type: "input_image"`

            The type of the object. Always `input_image`.

            - `"input_image"`

    - `status: AgentFunctionCallStatus`

      The status of the function call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "function_call_output"`

      The item type. Always `function_call_output`.

      - `"function_call_output"`

  - `AgentMessageItemResource`

    A message exchanged between agent threads.

    - `id: string`

      The ID of the message.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The content exchanged between the agents.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

          `minLength: 0`

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

          `minLength: 0`

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `recipient_agent_id: string`

      The ID or name of the receiving agent.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID or name of the sending agent.

      `minLength: 0`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "agent_message"`

      The item type. Always `agent_message`.

      - `"agent_message"`

  - `AgentMcpCallItem`

    A call to a tool on an MCP server.

    - `id: string`

      The ID of the MCP call item.

      `minLength: 0`

    - `arguments: unknown`

      The arguments passed to the MCP tool.

    - `error: unknown`

      The error returned by the MCP tool, if any.

    - `name: string`

      The name of the MCP tool.

      `minLength: 0`

    - `output: unknown`

      The output returned by the MCP tool, if any.

    - `server_label: string`

      The label of the MCP server.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the MCP tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "mcp_call"`

      The item type. Always `mcp_call`.

      - `"mcp_call"`

  - `ComputerUseCallItemResource`

    One execution of the platform-provided computer-use capability.

    - `id: string`

      The ID of the activity item.

      `minLength: 0`

    - `output: Output | null`

      The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot.

      - `image_url: string`

        The complete JPEG image as a base64 data URL.

        `minLength: 0`

      - `type: "computer_screenshot"`

        The content type. Always `computer_screenshot`.

        - `"computer_screenshot"`

    - `status: AgentFunctionCallStatus`

      The execution status of the activity.

    - `title: string | null`

      A model-generated description of the activity, when available.

      `minLength: 0`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "computer_use_call"`

      The item type. Always `computer_use_call`.

      - `"computer_use_call"`

  - `BrowserAuthenticationRequestItemResource`

    A credential-free history record of the emitted login request.

    - `id: string`

      The stable history item ID.

      `minLength: 0`

    - `request: Request`

      A registered form awaiting the application's response.

      - `credential_origin: string | null`

        The registered form or frame origin where values will be entered.

        `minLength: 0`

      - `fields: Array<Field>`

        Controls to render. All submitted values are sensitive.

        `minItems: 0`, `maxItems: 2000`

        - `id: string`

          The field ID to submit as field_id in a fields entry.

          `minLength: 0`

        - `label: string`

          The label to display beside the control.

          `minLength: 0`

        - `required: boolean`

          Whether this control requires a nonempty value.

        - `type: string`

          The rendering type, such as email, password, or text.

          `minLength: 0`

      - `options: Array<Option>`

        Sign-in methods. Empty for a plain form.

        `minItems: 0`, `maxItems: 2000`

        - `id: string`

          The option ID to submit as selected_option.

          `minLength: 0`

        - `field_ids: Array<string>`

          IDs from the registered fields that this method accepts.

          `minItems: 0`, `maxItems: 2000`

        - `label: string`

          The method label to display.

          `minLength: 0`

      - `reason: string | null`

        Why the agent needs the user to sign in.

        `minLength: 0`

      - `type: "browser_authentication"`

        The type of the object. Always `browser_authentication`.

        - `"browser_authentication"`

    - `request_id: string`

      `minLength: 0`

    - `turn_id: string`

      `minLength: 0`

    - `type: "computer_use_approval_request"`

      The item type. Always computer_use_approval_request.

      - `"computer_use_approval_request"`

  - `ComputerUseApprovalRequestResultItemResource`

    A credential-free record of an admitted response, not proof of completion.

    - `id: string`

      The stable history item ID.

      `minLength: 0`

    - `request_id: string`

      The registered request answered by this item.

      `minLength: 0`

    - `response: ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource | ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

      The admitted response, without submitted credential values.

      - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource`

        - `action: "submit"`

          - `"submit"`

        - `selected_option: string | null`

          The chosen sign-in method, or null when no options were offered.

          `minLength: 0`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

      - `ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource`

        - `action: "cancel"`

          - `"cancel"`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "computer_use_approval_request_result"`

      - `"computer_use_approval_request_result"`

  - `AgentWebSearchCallItem`

    A web search call produced by the agent.

    - `id: string`

      The ID of the web search call.

      `minLength: 0`

    - `action: WebSearchAction | null`

      The action performed by the web search tool.

      - `WebSearchActionResourceSearch`

        A search query or group of search queries.

        - `queries: Array<string> | null`

          The search queries, when multiple queries were used.

          `minItems: 0`, `maxItems: 2000`

        - `query: string | null`

          The search query, when a single query was used.

          `minLength: 0`

        - `type: "search"`

          The type of the object. Always `search`.

          - `"search"`

      - `WebSearchActionResourceOpenPage`

        Opens a web page.

        - `type: "open_page"`

          The type of the object. Always `open_page`.

          - `"open_page"`

        - `url: string | null`

          The URL of the page that was opened.

          `minLength: 0`

      - `WebSearchActionResourceFindInPage`

        Finds text within a web page.

        - `pattern: string | null`

          The text pattern that was searched for.

          `minLength: 0`

        - `type: "find_in_page"`

          The type of the object. Always `find_in_page`.

          - `"find_in_page"`

        - `url: string | null`

          The URL of the page that was searched.

          `minLength: 0`

      - `WebSearchActionResourceOther`

        Another web search action.

        - `type: "other"`

          The type of the object. Always `other`.

          - `"other"`

    - `status: AgentOutputItemStatus`

      The status of the web search call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "web_search_call"`

      The item type. Always `web_search_call`.

      - `"web_search_call"`

  - `AgentCommandExecutionItem`

    A command execution produced by the agent.

    - `id: string`

      The ID of the command execution item.

      `minLength: 0`

    - `command: string`

      The command that was executed.

      `minLength: 0`

    - `cwd: string | null`

      The working directory used to execute the command.

      `minLength: 0`

    - `duration_ms: number | null`

      The command duration in milliseconds.

      `format: int64`

    - `exit_code: number | null`

      The process exit code, if the command completed.

      `format: int64`

    - `output: string | null`

      The command output, if available.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the command execution.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "command_execution"`

      The item type. Always `command_execution`.

      - `"command_execution"`

  - `AgentCreateSubagentCallItem`

    A request to spawn a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `agent_id: string`

      The ID of the agent that requested the subagent.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The task given to the spawned agent.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

    - `model: string | null`

      The model requested for the spawned agent.

      `minLength: 0`

    - `reasoning_effort: string | null`

      The reasoning effort requested for the spawned agent.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "create_subagent_call"`

      The item type. Always `create_subagent_call`.

      - `"create_subagent_call"`

  - `AgentSendSubagentInputCallItem`

    A request to send input to another agent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `content: Array<AgentContent>`

      The input sent to the receiving agent.

      `minItems: 0`, `maxItems: 2000`

      - `OutputText`

        A text content part produced by the agent.

      - `EncryptedContentResource`

        Encrypted content exchanged between agents.

    - `recipient_agent_id: string`

      The ID of the agent receiving the input.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent sending the input.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "send_subagent_input_call"`

      The item type. Always `send_subagent_input_call`.

      - `"send_subagent_input_call"`

  - `AgentResumeSubagentCallItem`

    A request to resume a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to resume.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the resume.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "resume_subagent_call"`

      The item type. Always `resume_subagent_call`.

      - `"resume_subagent_call"`

  - `AgentWaitForSubagentsCallItem`

    A request to wait for one or more subagents.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_ids: Array<string>`

      The IDs of the agents to wait for.

      `minItems: 0`, `maxItems: 2000`

    - `sender_agent_id: string`

      The ID of the agent waiting for results.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "wait_for_subagents_call"`

      The item type. Always `wait_for_subagents_call`.

      - `"wait_for_subagents_call"`

  - `AgentInterruptSubagentCallItem`

    A request to interrupt a subagent's current turn. The subagent remains available.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to interrupt.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the interrupt.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "interrupt_subagent_call"`

      The item type. Always `interrupt_subagent_call`.

      - `"interrupt_subagent_call"`

  - `AgentCloseSubagentCallItem`

    A request to close a subagent.

    - `id: string`

      The ID of the tool call item.

      `minLength: 0`

    - `recipient_agent_id: string`

      The ID of the agent to close.

      `minLength: 0`

    - `sender_agent_id: string`

      The ID of the agent requesting the close.

      `minLength: 0`

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

      `minLength: 0`

    - `type: "close_subagent_call"`

      The item type. Always `close_subagent_call`.

      - `"close_subagent_call"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const agentSessionItem of client.beta.agents.sessions.turns.items.list('turn_id', {
  session_id: 'session_id',
})) {
  console.log(agentSessionItem);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "content": [
        {
          "text": "text",
          "type": "input_text"
        }
      ],
      "phase": "commentary",
      "role": "user",
      "status": "in_progress",
      "turn_id": "turn_id",
      "type": "message"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

# Vaults

## Create a vault

`client.beta.agents.vaults.create(VaultCreateParamsbody?, RequestOptionsoptions?): Vault`

**post** `/vaults`

Creates a vault for the current project. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Parameters

- `body: VaultCreateParams`

  - `metadata?: Record<string, string> | null`

    Key-value pairs to associate with the vault, such as an application or team identifier.

  - `name?: string`

    The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming.

    `minLength: 1`, `maxLength: 1048576`

### Returns

- `Vault`

  A collection of credentials for MCP servers and OpenAI-hosted environments.

  - `id: string`

    The ID of the vault.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp, in seconds, when the vault was created.

    `format: int64`

  - `metadata: Record<string, string>`

    Key-value pairs associated with the vault, such as an application or team identifier.

  - `name: string | null`

    The human-readable name of the vault, if set.

    `minLength: 0`

  - `object: "vault"`

    The object type. Always `vault`.

    - `"vault"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const vault = await client.beta.agents.vaults.create();

console.log(vault.id);
```

#### 201 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "vault"
}
```

## Delete a vault

`client.beta.agents.vaults.delete(stringvaultID, RequestOptionsoptions?): VaultDeleted`

**delete** `/vaults/{vault_id}`

Deletes a vault and all its credentials. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Parameters

- `vaultID: string`

  `minLength: 0`, `maxLength: 1048576`

### Returns

- `VaultDeleted`

  Confirmation that a vault was deleted.

  - `id: string`

    The ID of the deleted vault.

    `minLength: 0`

  - `deleted: boolean`

    Whether the resource was deleted. Always `true`.

  - `object: "vault.deleted"`

    The object type. Always `vault.deleted`.

    - `"vault.deleted"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const vaultDeleted = await client.beta.agents.vaults.delete('vault_id');

console.log(vaultDeleted.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "deleted": true,
  "object": "vault.deleted"
}
```

## List vaults

`client.beta.agents.vaults.list(VaultListParamsquery?, RequestOptionsoptions?): CursorPage<Vault>`

**get** `/vaults`

Lists vaults using ID-based pagination. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Parameters

- `query: VaultListParams`

  - `after?: string`

    Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `metadata?: Record<string, string>`

    Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. Filtering is eventually consistent; metadata changes may take time to appear.

  - `order?: "asc" | "desc"`

    The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

  - `status?: VaultStatusFilter`

    Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default.

    - `VaultStatus = "active" | "archived"`

      Whether a vault or credential is active or archived.

      - `"active"`

      - `"archived"`

    - `Array<VaultStatus>`

      - `"active"`

      - `"archived"`

### Returns

- `Vault`

  A collection of credentials for MCP servers and OpenAI-hosted environments.

  - `id: string`

    The ID of the vault.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp, in seconds, when the vault was created.

    `format: int64`

  - `metadata: Record<string, string>`

    Key-value pairs associated with the vault, such as an application or team identifier.

  - `name: string | null`

    The human-readable name of the vault, if set.

    `minLength: 0`

  - `object: "vault"`

    The object type. Always `vault`.

    - `"vault"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const vault of client.beta.agents.vaults.list()) {
  console.log(vault.id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "metadata": {
        "foo": "string"
      },
      "name": "name",
      "object": "vault"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve a vault

`client.beta.agents.vaults.retrieve(stringvaultID, RequestOptionsoptions?): Vault`

**get** `/vaults/{vault_id}`

Retrieves a vault by its ID. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Parameters

- `vaultID: string`

  `minLength: 0`, `maxLength: 1048576`

### Returns

- `Vault`

  A collection of credentials for MCP servers and OpenAI-hosted environments.

  - `id: string`

    The ID of the vault.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp, in seconds, when the vault was created.

    `format: int64`

  - `metadata: Record<string, string>`

    Key-value pairs associated with the vault, such as an application or team identifier.

  - `name: string | null`

    The human-readable name of the vault, if set.

    `minLength: 0`

  - `object: "vault"`

    The object type. Always `vault`.

    - `"vault"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const vault = await client.beta.agents.vaults.retrieve('vault_id');

console.log(vault.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "vault"
}
```

## Update a vault

`client.beta.agents.vaults.update(stringvaultID, VaultUpdateParamsbody, RequestOptionsoptions?): Vault`

**post** `/vaults/{vault_id}`

Updates the name or metadata of an active vault. Omitted fields remain unchanged. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Parameters

- `vaultID: string`

  `minLength: 0`, `maxLength: 1048576`

- `body: VaultUpdateParams`

  - `metadata?: Record<string, string>`

    Replaces all metadata. Omit to leave unchanged, or pass {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters.

  - `name?: string | null`

    A replacement name. Omit to leave unchanged, or pass null to clear it. The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming.

    `minLength: 1`, `maxLength: 1048576`

### Returns

- `Vault`

  A collection of credentials for MCP servers and OpenAI-hosted environments.

  - `id: string`

    The ID of the vault.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp, in seconds, when the vault was created.

    `format: int64`

  - `metadata: Record<string, string>`

    Key-value pairs associated with the vault, such as an application or team identifier.

  - `name: string | null`

    The human-readable name of the vault, if set.

    `minLength: 0`

  - `object: "vault"`

    The object type. Always `vault`.

    - `"vault"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const vault = await client.beta.agents.vaults.update('vault_id', { name: 'Research vault' });

console.log(vault.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "vault"
}
```

## Domain Types

### Vault

- `Vault`

  A collection of credentials for MCP servers and OpenAI-hosted environments.

  - `id: string`

    The ID of the vault.

    `minLength: 0`

  - `created_at: number`

    The Unix timestamp, in seconds, when the vault was created.

    `format: int64`

  - `metadata: Record<string, string>`

    Key-value pairs associated with the vault, such as an application or team identifier.

  - `name: string | null`

    The human-readable name of the vault, if set.

    `minLength: 0`

  - `object: "vault"`

    The object type. Always `vault`.

    - `"vault"`

### Vault Deleted

- `VaultDeleted`

  Confirmation that a vault was deleted.

  - `id: string`

    The ID of the deleted vault.

    `minLength: 0`

  - `deleted: boolean`

    Whether the resource was deleted. Always `true`.

  - `object: "vault.deleted"`

    The object type. Always `vault.deleted`.

    - `"vault.deleted"`

### Vault Status

- `VaultStatus = "active" | "archived"`

  Whether a vault or credential is active or archived.

  - `"active"`

  - `"archived"`

### Vault Status Filter

- `VaultStatusFilter = VaultStatus | Array<VaultStatus>`

  One or more lifecycle statuses to include when listing vaults or credentials.

  - `VaultStatus = "active" | "archived"`

    Whether a vault or credential is active or archived.

    - `"active"`

    - `"archived"`

  - `Array<VaultStatus>`

    - `"active"`

    - `"archived"`

# Credentials

## Create a vault credential

`client.beta.agents.vaults.credentials.create(stringvaultID, CredentialCreateParamsbody, RequestOptionsoptions?): Credential`

**post** `/vaults/{vault_id}/credentials`

Creates a vault credential. Secret values are write-only and are never returned. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Parameters

- `vaultID: string`

  `minLength: 0`, `maxLength: 1048576`

- `body: CredentialCreateParams`

  - `auth: CredentialAuthCreateParam`

    The authentication method and write-only secret values to store.

    - `CreateVaultCredentialAuthParamMcpOauth`

      An OAuth credential for an HTTPS MCP destination.

      - `access_token: string`

        A write-only OAuth access token; never returned by credential resources.

        `minLength: 0`, `maxLength: 1048576`

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

        `minLength: 0`, `maxLength: 1048576`

      - `type: "mcp_oauth"`

        The type of the object. Always `mcp_oauth`.

        - `"mcp_oauth"`

      - `expires_at?: string | null`

        When the OAuth access token expires, as an RFC 3339 timestamp, if known.

        `minLength: 0`, `maxLength: 1048576`

      - `refresh?: Refresh | null`

        Optional refresh configuration for an HTTPS OAuth token endpoint.

        - `client_id: string`

          The OAuth client ID used when requesting a new access token.

          `minLength: 0`, `maxLength: 1048576`

        - `refresh_token: string`

          The refresh token to store. This secret is never returned in credential resources.

          `minLength: 0`, `maxLength: 1048576`

        - `token_endpoint: string`

          The HTTPS OAuth token endpoint used to exchange the refresh token for a new access token.

          `minLength: 0`, `maxLength: 1048576`

        - `token_endpoint_auth: McpOauthTokenEndpointAuthCreateParam`

          How the OAuth client authenticates to the token endpoint.

          - `CreateMcpOauthTokenEndpointAuthParamNone`

            Sends the client ID without a client secret.

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `CreateMcpOauthTokenEndpointAuthParamClientSecretBasic`

            Sends the client ID and secret using HTTP Basic authentication.

            - `client_secret: string`

              The OAuth client secret to store. Never returned in credential resources.

              `minLength: 0`, `maxLength: 1048576`

            - `type: "client_secret_basic"`

              The type of the object. Always `client_secret_basic`.

              - `"client_secret_basic"`

          - `CreateMcpOauthTokenEndpointAuthParamClientSecretPost`

            Sends the client ID and secret in the token request body.

            - `client_secret: string`

              The OAuth client secret to store. Never returned in credential resources.

              `minLength: 0`, `maxLength: 1048576`

            - `type: "client_secret_post"`

              The type of the object. Always `client_secret_post`.

              - `"client_secret_post"`

        - `resource?: string | null`

          The resource URI to send to the OAuth token endpoint during refresh, if required.

          `minLength: 0`, `maxLength: 1048576`

        - `scope?: string | null`

          Space-separated OAuth scopes to request during refresh, if required.

          `minLength: 0`, `maxLength: 1048576`

    - `CreateVaultCredentialAuthParamStaticBearer`

      A bearer token for an MCP server, without automatic OAuth refresh.

      - `token: string`

        The bearer token to store. This secret is never returned in credential resources.

        `minLength: 0`, `maxLength: 1048576`

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

        `minLength: 0`, `maxLength: 1048576`

      - `type: "static_bearer"`

        The type of the object. Always `static_bearer`.

        - `"static_bearer"`

    - `CreateVaultCredentialAuthParamEnvironmentVariable`

      An HTTP credential for OpenAI-hosted environments only. The sandbox receives an environment variable containing a placeholder, not the secret. Use the placeholder unchanged in outgoing requests. The egress proxy replaces the placeholder with the secret for allowed HTTPS destinations on ports 443 and 8443. Sandbox code cannot read the real secret or use it for local computation, such as signing a request.

      - `networking: CredentialNetworkingParam`

        The destinations where the proxy can substitute this secret. The environment network policy must also allow them.

        - `VaultCredentialNetworkingParamUnrestricted`

          Allows substitution for destinations permitted by the environment network policy. Requires `environment.network.access` to be `restricted`, with explicit `allowed_domains`.

          - `type: "unrestricted"`

            The type of the object. Always `unrestricted`.

            - `"unrestricted"`

        - `VaultCredentialNetworkingParamLimited`

          Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

          - `allowed_hosts: Array<string>`

            The 1 to 16 distinct allowed hostnames or IPv4 addresses, normalized to lowercase. Entries contain no scheme, path, port, or wildcard. IPv6 addresses are not supported.

            `minItems: 1`, `maxItems: 16`

          - `type: "limited"`

            The type of the object. Always `limited`.

            - `"limited"`

      - `secret_name: string`

        The environment variable name that receives the placeholder, such as `SERVICE_API_KEY`. Use ASCII letters, digits, and underscores, starting with a letter or underscore. Names starting with `CODEX_` and managed proxy or certificate variable names are reserved.

        `minLength: 1`, `maxLength: 1048576`

      - `secret_value: string`

        The write-only secret to store. Never returned in credential resources or supplied directly to sandbox code. Must be nonempty and must not contain carriage returns, newlines, or NUL bytes.

        `minLength: 1`, `maxLength: 1048576`

      - `type: "environment_variable"`

        The type of the object. Always `environment_variable`.

        - `"environment_variable"`

  - `name: string`

    The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming.

    `minLength: 1`, `maxLength: 1048576`

  - `metadata?: Record<string, string>`

    Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Defaults to an empty map.

### Returns

- `Credential`

  Metadata for a stored credential. Secret values are never returned.

  - `id: string`

    The ID of the credential.

    `minLength: 0`

  - `auth: CredentialAuth`

    The authentication method and non-secret configuration of the credential.

    - `VaultCredentialAuthResourceMcpOauth`

      Public metadata for an OAuth credential; tokens and client secrets are never returned.

      - `expires_at: string | null`

        When the OAuth access token expires, as an RFC 3339 timestamp, if known.

        `minLength: 0`

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

        `minLength: 0`

      - `refresh: Refresh | null`

        Public refresh metadata without refresh tokens or OAuth client secrets.

        - `client_id: string`

          The OAuth client ID used when requesting a new access token.

          `minLength: 0`

        - `resource: string | null`

          The resource URI sent to the OAuth token endpoint during refresh, if configured.

          `minLength: 0`

        - `scope: string | null`

          Space-separated OAuth scopes requested during refresh, if configured.

          `minLength: 0`

        - `token_endpoint: string`

          The HTTPS OAuth token endpoint used for refresh.

          `minLength: 0`

        - `token_endpoint_auth: McpOauthTokenEndpointAuth`

          How the OAuth client authenticates to the token endpoint, excluding its client secret.

          - `McpOauthTokenEndpointAuthResourceNone`

            Sends the client ID without a client secret.

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `McpOauthTokenEndpointAuthResourceClientSecretBasic`

            Sends the client ID and secret using HTTP Basic authentication.

            - `type: "client_secret_basic"`

              The type of the object. Always `client_secret_basic`.

              - `"client_secret_basic"`

          - `McpOauthTokenEndpointAuthResourceClientSecretPost`

            Sends the client ID and secret in the token request body.

            - `type: "client_secret_post"`

              The type of the object. Always `client_secret_post`.

              - `"client_secret_post"`

      - `type: "mcp_oauth"`

        The type of the object. Always `mcp_oauth`.

        - `"mcp_oauth"`

    - `VaultCredentialAuthResourceStaticBearer`

      Metadata for a bearer-token credential, without automatic OAuth refresh.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

        `minLength: 0`

      - `type: "static_bearer"`

        The type of the object. Always `static_bearer`.

        - `"static_bearer"`

    - `VaultCredentialAuthResourceEnvironmentVariable`

      Metadata for an HTTP credential used only in OpenAI-hosted environments. Sandbox code receives a placeholder. The proxy substitutes the secret for allowed HTTPS destinations on ports 443 and 8443. The real secret is not available to sandbox code for local computation and is never returned in this resource.

      - `networking: CredentialNetworking`

        The destinations where the proxy can substitute the secret, subject to the environment network policy.

        - `VaultCredentialNetworkingResourceUnrestricted`

          Allows substitution for destinations permitted by the environment network policy. Requires `environment.network.access` to be `restricted`, with explicit `allowed_domains`.

          - `type: "unrestricted"`

            The type of the object. Always `unrestricted`.

            - `"unrestricted"`

        - `VaultCredentialNetworkingResourceLimited`

          Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

          - `allowed_hosts: Array<string>`

            The 1 to 16 distinct allowed hostnames or IPv4 addresses, normalized to lowercase. Entries contain no scheme, path, port, or wildcard. IPv6 addresses are not supported.

            `minItems: 1`, `maxItems: 16`

          - `type: "limited"`

            The type of the object. Always `limited`.

            - `"limited"`

      - `secret_name: string`

        The environment variable name that receives the placeholder in the sandbox.

        `minLength: 0`

      - `type: "environment_variable"`

        The type of the object. Always `environment_variable`.

        - `"environment_variable"`

  - `created_at: number`

    The Unix timestamp, in seconds, when the credential was created.

    `format: int64`

  - `metadata: Record<string, string>`

    Application-defined key-value pairs associated with this credential.

  - `name: string`

    The human-readable name of the credential.

    `minLength: 0`

  - `object: "vault.credential"`

    The object type. Always `vault.credential`.

    - `"vault.credential"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the credential was last updated.

    `format: int64`

  - `vault_id: string`

    The ID of the vault containing this credential.

    `minLength: 0`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const credential = await client.beta.agents.vaults.credentials.create('vault_id', {
  auth: {
    access_token: 'access_token',
    mcp_server_url: 'mcp_server_url',
    type: 'mcp_oauth',
  },
  name: 'x',
});

console.log(credential.id);
```

#### 201 — Example

```json
{
  "id": "id",
  "auth": {
    "expires_at": "expires_at",
    "mcp_server_url": "mcp_server_url",
    "refresh": {
      "client_id": "client_id",
      "resource": "resource",
      "scope": "scope",
      "token_endpoint": "token_endpoint",
      "token_endpoint_auth": {
        "type": "none"
      }
    },
    "type": "mcp_oauth"
  },
  "created_at": 0,
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "vault.credential",
  "updated_at": 0,
  "vault_id": "vault_id"
}
```

## Delete a vault credential

`client.beta.agents.vaults.credentials.delete(stringcredentialID, CredentialDeleteParamsparams, RequestOptionsoptions?): CredentialDeleted`

**delete** `/vaults/{vault_id}/credentials/{credential_id}`

Deletes a vault credential. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Parameters

- `credentialID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: CredentialDeleteParams`

  - `vault_id: string`

    The ID of the vault.

    `minLength: 0`, `maxLength: 1048576`

### Returns

- `CredentialDeleted`

  Confirmation that a vault credential was deleted.

  - `id: string`

    The ID of the deleted credential.

    `minLength: 0`

  - `deleted: boolean`

    Whether the resource was deleted. Always `true`.

  - `object: "vault.credential.deleted"`

    The object type. Always `vault.credential.deleted`.

    - `"vault.credential.deleted"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const credentialDeleted = await client.beta.agents.vaults.credentials.delete('credential_id', {
  vault_id: 'vault_id',
});

console.log(credentialDeleted.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "deleted": true,
  "object": "vault.credential.deleted"
}
```

## List vault credentials

`client.beta.agents.vaults.credentials.list(stringvaultID, CredentialListParamsquery?, RequestOptionsoptions?): CursorPage<Credential>`

**get** `/vaults/{vault_id}/credentials`

Lists a vault's credentials using ID-based pagination without returning secret values. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Parameters

- `vaultID: string`

  `minLength: 0`, `maxLength: 1048576`

- `query: CredentialListParams`

  - `after?: string`

    Return resources after this resource ID in the selected order.

    `minLength: 0`, `maxLength: 1048576`

  - `limit?: number`

    The maximum number of resources to return, between 1 and 100. Defaults to 20.

    `format: int64`, `minimum: 1`, `maximum: 100`

  - `metadata?: Record<string, string>`

    Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. Filtering is eventually consistent; metadata changes may take time to appear.

  - `order?: "asc" | "desc"`

    The order in which resources are returned. Defaults to `desc`.

    - `"asc"`

      Returns resources in ascending order.

    - `"desc"`

      Returns resources in descending order.

  - `status?: VaultStatusFilter`

    Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default.

    - `VaultStatus = "active" | "archived"`

      Whether a vault or credential is active or archived.

      - `"active"`

      - `"archived"`

    - `Array<VaultStatus>`

      - `"active"`

      - `"archived"`

### Returns

- `Credential`

  Metadata for a stored credential. Secret values are never returned.

  - `id: string`

    The ID of the credential.

    `minLength: 0`

  - `auth: CredentialAuth`

    The authentication method and non-secret configuration of the credential.

    - `VaultCredentialAuthResourceMcpOauth`

      Public metadata for an OAuth credential; tokens and client secrets are never returned.

      - `expires_at: string | null`

        When the OAuth access token expires, as an RFC 3339 timestamp, if known.

        `minLength: 0`

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

        `minLength: 0`

      - `refresh: Refresh | null`

        Public refresh metadata without refresh tokens or OAuth client secrets.

        - `client_id: string`

          The OAuth client ID used when requesting a new access token.

          `minLength: 0`

        - `resource: string | null`

          The resource URI sent to the OAuth token endpoint during refresh, if configured.

          `minLength: 0`

        - `scope: string | null`

          Space-separated OAuth scopes requested during refresh, if configured.

          `minLength: 0`

        - `token_endpoint: string`

          The HTTPS OAuth token endpoint used for refresh.

          `minLength: 0`

        - `token_endpoint_auth: McpOauthTokenEndpointAuth`

          How the OAuth client authenticates to the token endpoint, excluding its client secret.

          - `McpOauthTokenEndpointAuthResourceNone`

            Sends the client ID without a client secret.

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `McpOauthTokenEndpointAuthResourceClientSecretBasic`

            Sends the client ID and secret using HTTP Basic authentication.

            - `type: "client_secret_basic"`

              The type of the object. Always `client_secret_basic`.

              - `"client_secret_basic"`

          - `McpOauthTokenEndpointAuthResourceClientSecretPost`

            Sends the client ID and secret in the token request body.

            - `type: "client_secret_post"`

              The type of the object. Always `client_secret_post`.

              - `"client_secret_post"`

      - `type: "mcp_oauth"`

        The type of the object. Always `mcp_oauth`.

        - `"mcp_oauth"`

    - `VaultCredentialAuthResourceStaticBearer`

      Metadata for a bearer-token credential, without automatic OAuth refresh.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

        `minLength: 0`

      - `type: "static_bearer"`

        The type of the object. Always `static_bearer`.

        - `"static_bearer"`

    - `VaultCredentialAuthResourceEnvironmentVariable`

      Metadata for an HTTP credential used only in OpenAI-hosted environments. Sandbox code receives a placeholder. The proxy substitutes the secret for allowed HTTPS destinations on ports 443 and 8443. The real secret is not available to sandbox code for local computation and is never returned in this resource.

      - `networking: CredentialNetworking`

        The destinations where the proxy can substitute the secret, subject to the environment network policy.

        - `VaultCredentialNetworkingResourceUnrestricted`

          Allows substitution for destinations permitted by the environment network policy. Requires `environment.network.access` to be `restricted`, with explicit `allowed_domains`.

          - `type: "unrestricted"`

            The type of the object. Always `unrestricted`.

            - `"unrestricted"`

        - `VaultCredentialNetworkingResourceLimited`

          Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

          - `allowed_hosts: Array<string>`

            The 1 to 16 distinct allowed hostnames or IPv4 addresses, normalized to lowercase. Entries contain no scheme, path, port, or wildcard. IPv6 addresses are not supported.

            `minItems: 1`, `maxItems: 16`

          - `type: "limited"`

            The type of the object. Always `limited`.

            - `"limited"`

      - `secret_name: string`

        The environment variable name that receives the placeholder in the sandbox.

        `minLength: 0`

      - `type: "environment_variable"`

        The type of the object. Always `environment_variable`.

        - `"environment_variable"`

  - `created_at: number`

    The Unix timestamp, in seconds, when the credential was created.

    `format: int64`

  - `metadata: Record<string, string>`

    Application-defined key-value pairs associated with this credential.

  - `name: string`

    The human-readable name of the credential.

    `minLength: 0`

  - `object: "vault.credential"`

    The object type. Always `vault.credential`.

    - `"vault.credential"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the credential was last updated.

    `format: int64`

  - `vault_id: string`

    The ID of the vault containing this credential.

    `minLength: 0`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const credential of client.beta.agents.vaults.credentials.list('vault_id')) {
  console.log(credential.id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "auth": {
        "expires_at": "expires_at",
        "mcp_server_url": "mcp_server_url",
        "refresh": {
          "client_id": "client_id",
          "resource": "resource",
          "scope": "scope",
          "token_endpoint": "token_endpoint",
          "token_endpoint_auth": {
            "type": "none"
          }
        },
        "type": "mcp_oauth"
      },
      "created_at": 0,
      "metadata": {
        "foo": "string"
      },
      "name": "name",
      "object": "vault.credential",
      "updated_at": 0,
      "vault_id": "vault_id"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve a vault credential

`client.beta.agents.vaults.credentials.retrieve(stringcredentialID, CredentialRetrieveParamsparams, RequestOptionsoptions?): Credential`

**get** `/vaults/{vault_id}/credentials/{credential_id}`

Retrieves vault credential metadata without returning secret values. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Parameters

- `credentialID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: CredentialRetrieveParams`

  - `vault_id: string`

    The ID of the vault.

    `minLength: 0`, `maxLength: 1048576`

### Returns

- `Credential`

  Metadata for a stored credential. Secret values are never returned.

  - `id: string`

    The ID of the credential.

    `minLength: 0`

  - `auth: CredentialAuth`

    The authentication method and non-secret configuration of the credential.

    - `VaultCredentialAuthResourceMcpOauth`

      Public metadata for an OAuth credential; tokens and client secrets are never returned.

      - `expires_at: string | null`

        When the OAuth access token expires, as an RFC 3339 timestamp, if known.

        `minLength: 0`

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

        `minLength: 0`

      - `refresh: Refresh | null`

        Public refresh metadata without refresh tokens or OAuth client secrets.

        - `client_id: string`

          The OAuth client ID used when requesting a new access token.

          `minLength: 0`

        - `resource: string | null`

          The resource URI sent to the OAuth token endpoint during refresh, if configured.

          `minLength: 0`

        - `scope: string | null`

          Space-separated OAuth scopes requested during refresh, if configured.

          `minLength: 0`

        - `token_endpoint: string`

          The HTTPS OAuth token endpoint used for refresh.

          `minLength: 0`

        - `token_endpoint_auth: McpOauthTokenEndpointAuth`

          How the OAuth client authenticates to the token endpoint, excluding its client secret.

          - `McpOauthTokenEndpointAuthResourceNone`

            Sends the client ID without a client secret.

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `McpOauthTokenEndpointAuthResourceClientSecretBasic`

            Sends the client ID and secret using HTTP Basic authentication.

            - `type: "client_secret_basic"`

              The type of the object. Always `client_secret_basic`.

              - `"client_secret_basic"`

          - `McpOauthTokenEndpointAuthResourceClientSecretPost`

            Sends the client ID and secret in the token request body.

            - `type: "client_secret_post"`

              The type of the object. Always `client_secret_post`.

              - `"client_secret_post"`

      - `type: "mcp_oauth"`

        The type of the object. Always `mcp_oauth`.

        - `"mcp_oauth"`

    - `VaultCredentialAuthResourceStaticBearer`

      Metadata for a bearer-token credential, without automatic OAuth refresh.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

        `minLength: 0`

      - `type: "static_bearer"`

        The type of the object. Always `static_bearer`.

        - `"static_bearer"`

    - `VaultCredentialAuthResourceEnvironmentVariable`

      Metadata for an HTTP credential used only in OpenAI-hosted environments. Sandbox code receives a placeholder. The proxy substitutes the secret for allowed HTTPS destinations on ports 443 and 8443. The real secret is not available to sandbox code for local computation and is never returned in this resource.

      - `networking: CredentialNetworking`

        The destinations where the proxy can substitute the secret, subject to the environment network policy.

        - `VaultCredentialNetworkingResourceUnrestricted`

          Allows substitution for destinations permitted by the environment network policy. Requires `environment.network.access` to be `restricted`, with explicit `allowed_domains`.

          - `type: "unrestricted"`

            The type of the object. Always `unrestricted`.

            - `"unrestricted"`

        - `VaultCredentialNetworkingResourceLimited`

          Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

          - `allowed_hosts: Array<string>`

            The 1 to 16 distinct allowed hostnames or IPv4 addresses, normalized to lowercase. Entries contain no scheme, path, port, or wildcard. IPv6 addresses are not supported.

            `minItems: 1`, `maxItems: 16`

          - `type: "limited"`

            The type of the object. Always `limited`.

            - `"limited"`

      - `secret_name: string`

        The environment variable name that receives the placeholder in the sandbox.

        `minLength: 0`

      - `type: "environment_variable"`

        The type of the object. Always `environment_variable`.

        - `"environment_variable"`

  - `created_at: number`

    The Unix timestamp, in seconds, when the credential was created.

    `format: int64`

  - `metadata: Record<string, string>`

    Application-defined key-value pairs associated with this credential.

  - `name: string`

    The human-readable name of the credential.

    `minLength: 0`

  - `object: "vault.credential"`

    The object type. Always `vault.credential`.

    - `"vault.credential"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the credential was last updated.

    `format: int64`

  - `vault_id: string`

    The ID of the vault containing this credential.

    `minLength: 0`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const credential = await client.beta.agents.vaults.credentials.retrieve('credential_id', {
  vault_id: 'vault_id',
});

console.log(credential.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "auth": {
    "expires_at": "expires_at",
    "mcp_server_url": "mcp_server_url",
    "refresh": {
      "client_id": "client_id",
      "resource": "resource",
      "scope": "scope",
      "token_endpoint": "token_endpoint",
      "token_endpoint_auth": {
        "type": "none"
      }
    },
    "type": "mcp_oauth"
  },
  "created_at": 0,
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "vault.credential",
  "updated_at": 0,
  "vault_id": "vault_id"
}
```

## Update a vault credential

`client.beta.agents.vaults.credentials.update(stringcredentialID, CredentialUpdateParamsparams, RequestOptionsoptions?): Credential`

**post** `/vaults/{vault_id}/credentials/{credential_id}`

Updates credential metadata or rotates its write-only secret. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Parameters

- `credentialID: string`

  `minLength: 0`, `maxLength: 1048576`

- `params: CredentialUpdateParams`

  - `vault_id: string`

    Path param: The ID of the vault.

    `minLength: 0`, `maxLength: 1048576`

  - `auth?: CredentialAuthRotateParam`

    Body param: Replacement values for the credential's existing authentication method.

    - `RotateVaultCredentialAuthParamMcpOauth`

      Rotate an OAuth credential for an HTTPS MCP destination.

      - `type: "mcp_oauth"`

        The type of the object. Always `mcp_oauth`.

        - `"mcp_oauth"`

      - `access_token?: string | null`

        A write-only replacement OAuth access token.

        `minLength: 0`, `maxLength: 1048576`

      - `expires_at?: string | null`

        The replacement expiry as an RFC 3339 timestamp, or `null` to clear it. Omitting this field preserves the expiry unless a new access token is supplied, in which case the expiry is cleared.

        `minLength: 0`, `maxLength: 1048576`

      - `refresh?: Refresh | null`

        Optional write-only refresh-token and client-secret updates.

        - `refresh_token?: string | null`

          The replacement refresh token. Omit or pass `null` to keep the stored token. This secret is never returned in resources.

          `minLength: 0`, `maxLength: 1048576`

        - `scope?: string | null`

          Replacement space-separated OAuth scopes for refresh requests. Omit to keep the scopes, or pass `null` to stop sending a scope parameter.

          `minLength: 0`, `maxLength: 1048576`

        - `token_endpoint_auth?: McpOauthTokenEndpointAuthRotateParam | null`

          Client-secret updates for the existing token endpoint authentication method.

          - `RotateMcpOauthTokenEndpointAuthParamClientSecretBasic`

            Updates credentials sent using HTTP Basic authentication.

            - `type: "client_secret_basic"`

              The type of the object. Always `client_secret_basic`.

              - `"client_secret_basic"`

            - `client_secret?: string | null`

              The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources.

              `minLength: 0`, `maxLength: 1048576`

          - `RotateMcpOauthTokenEndpointAuthParamClientSecretPost`

            Updates credentials sent in the token request body.

            - `type: "client_secret_post"`

              The type of the object. Always `client_secret_post`.

              - `"client_secret_post"`

            - `client_secret?: string | null`

              The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources.

              `minLength: 0`, `maxLength: 1048576`

    - `RotateVaultCredentialAuthParamStaticBearer`

      Replace the bearer token for the credential's MCP server.

      - `token: string`

        The replacement bearer token. This secret is never returned in credential resources.

        `minLength: 0`, `maxLength: 1048576`

      - `type: "static_bearer"`

        The type of the object. Always `static_bearer`.

        - `"static_bearer"`

    - `RotateVaultCredentialAuthParamEnvironmentVariable`

      Replace the secret for an OpenAI-hosted environment credential. The environment variable name and networking configuration remain unchanged.

      - `secret_value: string`

        The write-only replacement secret. Never returned in credential resources or supplied directly to sandbox code. Must be nonempty and must not contain carriage returns, newlines, or NUL bytes.

        `minLength: 1`, `maxLength: 1048576`

      - `type: "environment_variable"`

        The type of the object. Always `environment_variable`.

        - `"environment_variable"`

  - `metadata?: Record<string, string>`

    Body param: Replaces all metadata. Omit to preserve it, or pass {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters.

### Returns

- `Credential`

  Metadata for a stored credential. Secret values are never returned.

  - `id: string`

    The ID of the credential.

    `minLength: 0`

  - `auth: CredentialAuth`

    The authentication method and non-secret configuration of the credential.

    - `VaultCredentialAuthResourceMcpOauth`

      Public metadata for an OAuth credential; tokens and client secrets are never returned.

      - `expires_at: string | null`

        When the OAuth access token expires, as an RFC 3339 timestamp, if known.

        `minLength: 0`

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

        `minLength: 0`

      - `refresh: Refresh | null`

        Public refresh metadata without refresh tokens or OAuth client secrets.

        - `client_id: string`

          The OAuth client ID used when requesting a new access token.

          `minLength: 0`

        - `resource: string | null`

          The resource URI sent to the OAuth token endpoint during refresh, if configured.

          `minLength: 0`

        - `scope: string | null`

          Space-separated OAuth scopes requested during refresh, if configured.

          `minLength: 0`

        - `token_endpoint: string`

          The HTTPS OAuth token endpoint used for refresh.

          `minLength: 0`

        - `token_endpoint_auth: McpOauthTokenEndpointAuth`

          How the OAuth client authenticates to the token endpoint, excluding its client secret.

          - `McpOauthTokenEndpointAuthResourceNone`

            Sends the client ID without a client secret.

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `McpOauthTokenEndpointAuthResourceClientSecretBasic`

            Sends the client ID and secret using HTTP Basic authentication.

            - `type: "client_secret_basic"`

              The type of the object. Always `client_secret_basic`.

              - `"client_secret_basic"`

          - `McpOauthTokenEndpointAuthResourceClientSecretPost`

            Sends the client ID and secret in the token request body.

            - `type: "client_secret_post"`

              The type of the object. Always `client_secret_post`.

              - `"client_secret_post"`

      - `type: "mcp_oauth"`

        The type of the object. Always `mcp_oauth`.

        - `"mcp_oauth"`

    - `VaultCredentialAuthResourceStaticBearer`

      Metadata for a bearer-token credential, without automatic OAuth refresh.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

        `minLength: 0`

      - `type: "static_bearer"`

        The type of the object. Always `static_bearer`.

        - `"static_bearer"`

    - `VaultCredentialAuthResourceEnvironmentVariable`

      Metadata for an HTTP credential used only in OpenAI-hosted environments. Sandbox code receives a placeholder. The proxy substitutes the secret for allowed HTTPS destinations on ports 443 and 8443. The real secret is not available to sandbox code for local computation and is never returned in this resource.

      - `networking: CredentialNetworking`

        The destinations where the proxy can substitute the secret, subject to the environment network policy.

        - `VaultCredentialNetworkingResourceUnrestricted`

          Allows substitution for destinations permitted by the environment network policy. Requires `environment.network.access` to be `restricted`, with explicit `allowed_domains`.

          - `type: "unrestricted"`

            The type of the object. Always `unrestricted`.

            - `"unrestricted"`

        - `VaultCredentialNetworkingResourceLimited`

          Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

          - `allowed_hosts: Array<string>`

            The 1 to 16 distinct allowed hostnames or IPv4 addresses, normalized to lowercase. Entries contain no scheme, path, port, or wildcard. IPv6 addresses are not supported.

            `minItems: 1`, `maxItems: 16`

          - `type: "limited"`

            The type of the object. Always `limited`.

            - `"limited"`

      - `secret_name: string`

        The environment variable name that receives the placeholder in the sandbox.

        `minLength: 0`

      - `type: "environment_variable"`

        The type of the object. Always `environment_variable`.

        - `"environment_variable"`

  - `created_at: number`

    The Unix timestamp, in seconds, when the credential was created.

    `format: int64`

  - `metadata: Record<string, string>`

    Application-defined key-value pairs associated with this credential.

  - `name: string`

    The human-readable name of the credential.

    `minLength: 0`

  - `object: "vault.credential"`

    The object type. Always `vault.credential`.

    - `"vault.credential"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the credential was last updated.

    `format: int64`

  - `vault_id: string`

    The ID of the vault containing this credential.

    `minLength: 0`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const credential = await client.beta.agents.vaults.credentials.update('credential_id', {
  vault_id: 'vault_id',
  metadata: {},
});

console.log(credential.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "auth": {
    "expires_at": "expires_at",
    "mcp_server_url": "mcp_server_url",
    "refresh": {
      "client_id": "client_id",
      "resource": "resource",
      "scope": "scope",
      "token_endpoint": "token_endpoint",
      "token_endpoint_auth": {
        "type": "none"
      }
    },
    "type": "mcp_oauth"
  },
  "created_at": 0,
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "vault.credential",
  "updated_at": 0,
  "vault_id": "vault_id"
}
```

## Domain Types

### Credential

- `Credential`

  Metadata for a stored credential. Secret values are never returned.

  - `id: string`

    The ID of the credential.

    `minLength: 0`

  - `auth: CredentialAuth`

    The authentication method and non-secret configuration of the credential.

    - `VaultCredentialAuthResourceMcpOauth`

      Public metadata for an OAuth credential; tokens and client secrets are never returned.

      - `expires_at: string | null`

        When the OAuth access token expires, as an RFC 3339 timestamp, if known.

        `minLength: 0`

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

        `minLength: 0`

      - `refresh: Refresh | null`

        Public refresh metadata without refresh tokens or OAuth client secrets.

        - `client_id: string`

          The OAuth client ID used when requesting a new access token.

          `minLength: 0`

        - `resource: string | null`

          The resource URI sent to the OAuth token endpoint during refresh, if configured.

          `minLength: 0`

        - `scope: string | null`

          Space-separated OAuth scopes requested during refresh, if configured.

          `minLength: 0`

        - `token_endpoint: string`

          The HTTPS OAuth token endpoint used for refresh.

          `minLength: 0`

        - `token_endpoint_auth: McpOauthTokenEndpointAuth`

          How the OAuth client authenticates to the token endpoint, excluding its client secret.

          - `McpOauthTokenEndpointAuthResourceNone`

            Sends the client ID without a client secret.

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `McpOauthTokenEndpointAuthResourceClientSecretBasic`

            Sends the client ID and secret using HTTP Basic authentication.

            - `type: "client_secret_basic"`

              The type of the object. Always `client_secret_basic`.

              - `"client_secret_basic"`

          - `McpOauthTokenEndpointAuthResourceClientSecretPost`

            Sends the client ID and secret in the token request body.

            - `type: "client_secret_post"`

              The type of the object. Always `client_secret_post`.

              - `"client_secret_post"`

      - `type: "mcp_oauth"`

        The type of the object. Always `mcp_oauth`.

        - `"mcp_oauth"`

    - `VaultCredentialAuthResourceStaticBearer`

      Metadata for a bearer-token credential, without automatic OAuth refresh.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

        `minLength: 0`

      - `type: "static_bearer"`

        The type of the object. Always `static_bearer`.

        - `"static_bearer"`

    - `VaultCredentialAuthResourceEnvironmentVariable`

      Metadata for an HTTP credential used only in OpenAI-hosted environments. Sandbox code receives a placeholder. The proxy substitutes the secret for allowed HTTPS destinations on ports 443 and 8443. The real secret is not available to sandbox code for local computation and is never returned in this resource.

      - `networking: CredentialNetworking`

        The destinations where the proxy can substitute the secret, subject to the environment network policy.

        - `VaultCredentialNetworkingResourceUnrestricted`

          Allows substitution for destinations permitted by the environment network policy. Requires `environment.network.access` to be `restricted`, with explicit `allowed_domains`.

          - `type: "unrestricted"`

            The type of the object. Always `unrestricted`.

            - `"unrestricted"`

        - `VaultCredentialNetworkingResourceLimited`

          Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

          - `allowed_hosts: Array<string>`

            The 1 to 16 distinct allowed hostnames or IPv4 addresses, normalized to lowercase. Entries contain no scheme, path, port, or wildcard. IPv6 addresses are not supported.

            `minItems: 1`, `maxItems: 16`

          - `type: "limited"`

            The type of the object. Always `limited`.

            - `"limited"`

      - `secret_name: string`

        The environment variable name that receives the placeholder in the sandbox.

        `minLength: 0`

      - `type: "environment_variable"`

        The type of the object. Always `environment_variable`.

        - `"environment_variable"`

  - `created_at: number`

    The Unix timestamp, in seconds, when the credential was created.

    `format: int64`

  - `metadata: Record<string, string>`

    Application-defined key-value pairs associated with this credential.

  - `name: string`

    The human-readable name of the credential.

    `minLength: 0`

  - `object: "vault.credential"`

    The object type. Always `vault.credential`.

    - `"vault.credential"`

  - `updated_at: number`

    The Unix timestamp, in seconds, when the credential was last updated.

    `format: int64`

  - `vault_id: string`

    The ID of the vault containing this credential.

    `minLength: 0`

### Credential Auth

- `CredentialAuth = VaultCredentialAuthResourceMcpOauth | VaultCredentialAuthResourceStaticBearer | VaultCredentialAuthResourceEnvironmentVariable`

  The authentication configuration of a vault credential, excluding secrets.

  - `VaultCredentialAuthResourceMcpOauth`

    Public metadata for an OAuth credential; tokens and client secrets are never returned.

    - `expires_at: string | null`

      When the OAuth access token expires, as an RFC 3339 timestamp, if known.

      `minLength: 0`

    - `mcp_server_url: string`

      The HTTPS MCP server URL authorized by this credential.

      `minLength: 0`

    - `refresh: Refresh | null`

      Public refresh metadata without refresh tokens or OAuth client secrets.

      - `client_id: string`

        The OAuth client ID used when requesting a new access token.

        `minLength: 0`

      - `resource: string | null`

        The resource URI sent to the OAuth token endpoint during refresh, if configured.

        `minLength: 0`

      - `scope: string | null`

        Space-separated OAuth scopes requested during refresh, if configured.

        `minLength: 0`

      - `token_endpoint: string`

        The HTTPS OAuth token endpoint used for refresh.

        `minLength: 0`

      - `token_endpoint_auth: McpOauthTokenEndpointAuth`

        How the OAuth client authenticates to the token endpoint, excluding its client secret.

        - `McpOauthTokenEndpointAuthResourceNone`

          Sends the client ID without a client secret.

          - `type: "none"`

            The type of the object. Always `none`.

            - `"none"`

        - `McpOauthTokenEndpointAuthResourceClientSecretBasic`

          Sends the client ID and secret using HTTP Basic authentication.

          - `type: "client_secret_basic"`

            The type of the object. Always `client_secret_basic`.

            - `"client_secret_basic"`

        - `McpOauthTokenEndpointAuthResourceClientSecretPost`

          Sends the client ID and secret in the token request body.

          - `type: "client_secret_post"`

            The type of the object. Always `client_secret_post`.

            - `"client_secret_post"`

    - `type: "mcp_oauth"`

      The type of the object. Always `mcp_oauth`.

      - `"mcp_oauth"`

  - `VaultCredentialAuthResourceStaticBearer`

    Metadata for a bearer-token credential, without automatic OAuth refresh.

    - `mcp_server_url: string`

      The HTTPS MCP server URL authorized by this credential.

      `minLength: 0`

    - `type: "static_bearer"`

      The type of the object. Always `static_bearer`.

      - `"static_bearer"`

  - `VaultCredentialAuthResourceEnvironmentVariable`

    Metadata for an HTTP credential used only in OpenAI-hosted environments. Sandbox code receives a placeholder. The proxy substitutes the secret for allowed HTTPS destinations on ports 443 and 8443. The real secret is not available to sandbox code for local computation and is never returned in this resource.

    - `networking: CredentialNetworking`

      The destinations where the proxy can substitute the secret, subject to the environment network policy.

      - `VaultCredentialNetworkingResourceUnrestricted`

        Allows substitution for destinations permitted by the environment network policy. Requires `environment.network.access` to be `restricted`, with explicit `allowed_domains`.

        - `type: "unrestricted"`

          The type of the object. Always `unrestricted`.

          - `"unrestricted"`

      - `VaultCredentialNetworkingResourceLimited`

        Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

        - `allowed_hosts: Array<string>`

          The 1 to 16 distinct allowed hostnames or IPv4 addresses, normalized to lowercase. Entries contain no scheme, path, port, or wildcard. IPv6 addresses are not supported.

          `minItems: 1`, `maxItems: 16`

        - `type: "limited"`

          The type of the object. Always `limited`.

          - `"limited"`

    - `secret_name: string`

      The environment variable name that receives the placeholder in the sandbox.

      `minLength: 0`

    - `type: "environment_variable"`

      The type of the object. Always `environment_variable`.

      - `"environment_variable"`

### Credential Auth Create Param

- `CredentialAuthCreateParam = CreateVaultCredentialAuthParamMcpOauth | CreateVaultCredentialAuthParamStaticBearer | CreateVaultCredentialAuthParamEnvironmentVariable`

  Authentication credentials for an MCP server or an OpenAI-hosted environment.

  - `CreateVaultCredentialAuthParamMcpOauth`

    An OAuth credential for an HTTPS MCP destination.

    - `access_token: string`

      A write-only OAuth access token; never returned by credential resources.

      `minLength: 0`, `maxLength: 1048576`

    - `mcp_server_url: string`

      The HTTPS MCP server URL authorized by this credential.

      `minLength: 0`, `maxLength: 1048576`

    - `type: "mcp_oauth"`

      The type of the object. Always `mcp_oauth`.

      - `"mcp_oauth"`

    - `expires_at?: string | null`

      When the OAuth access token expires, as an RFC 3339 timestamp, if known.

      `minLength: 0`, `maxLength: 1048576`

    - `refresh?: Refresh | null`

      Optional refresh configuration for an HTTPS OAuth token endpoint.

      - `client_id: string`

        The OAuth client ID used when requesting a new access token.

        `minLength: 0`, `maxLength: 1048576`

      - `refresh_token: string`

        The refresh token to store. This secret is never returned in credential resources.

        `minLength: 0`, `maxLength: 1048576`

      - `token_endpoint: string`

        The HTTPS OAuth token endpoint used to exchange the refresh token for a new access token.

        `minLength: 0`, `maxLength: 1048576`

      - `token_endpoint_auth: McpOauthTokenEndpointAuthCreateParam`

        How the OAuth client authenticates to the token endpoint.

        - `CreateMcpOauthTokenEndpointAuthParamNone`

          Sends the client ID without a client secret.

          - `type: "none"`

            The type of the object. Always `none`.

            - `"none"`

        - `CreateMcpOauthTokenEndpointAuthParamClientSecretBasic`

          Sends the client ID and secret using HTTP Basic authentication.

          - `client_secret: string`

            The OAuth client secret to store. Never returned in credential resources.

            `minLength: 0`, `maxLength: 1048576`

          - `type: "client_secret_basic"`

            The type of the object. Always `client_secret_basic`.

            - `"client_secret_basic"`

        - `CreateMcpOauthTokenEndpointAuthParamClientSecretPost`

          Sends the client ID and secret in the token request body.

          - `client_secret: string`

            The OAuth client secret to store. Never returned in credential resources.

            `minLength: 0`, `maxLength: 1048576`

          - `type: "client_secret_post"`

            The type of the object. Always `client_secret_post`.

            - `"client_secret_post"`

      - `resource?: string | null`

        The resource URI to send to the OAuth token endpoint during refresh, if required.

        `minLength: 0`, `maxLength: 1048576`

      - `scope?: string | null`

        Space-separated OAuth scopes to request during refresh, if required.

        `minLength: 0`, `maxLength: 1048576`

  - `CreateVaultCredentialAuthParamStaticBearer`

    A bearer token for an MCP server, without automatic OAuth refresh.

    - `token: string`

      The bearer token to store. This secret is never returned in credential resources.

      `minLength: 0`, `maxLength: 1048576`

    - `mcp_server_url: string`

      The HTTPS MCP server URL authorized by this credential.

      `minLength: 0`, `maxLength: 1048576`

    - `type: "static_bearer"`

      The type of the object. Always `static_bearer`.

      - `"static_bearer"`

  - `CreateVaultCredentialAuthParamEnvironmentVariable`

    An HTTP credential for OpenAI-hosted environments only. The sandbox receives an environment variable containing a placeholder, not the secret. Use the placeholder unchanged in outgoing requests. The egress proxy replaces the placeholder with the secret for allowed HTTPS destinations on ports 443 and 8443. Sandbox code cannot read the real secret or use it for local computation, such as signing a request.

    - `networking: CredentialNetworkingParam`

      The destinations where the proxy can substitute this secret. The environment network policy must also allow them.

      - `VaultCredentialNetworkingParamUnrestricted`

        Allows substitution for destinations permitted by the environment network policy. Requires `environment.network.access` to be `restricted`, with explicit `allowed_domains`.

        - `type: "unrestricted"`

          The type of the object. Always `unrestricted`.

          - `"unrestricted"`

      - `VaultCredentialNetworkingParamLimited`

        Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

        - `allowed_hosts: Array<string>`

          The 1 to 16 distinct allowed hostnames or IPv4 addresses, normalized to lowercase. Entries contain no scheme, path, port, or wildcard. IPv6 addresses are not supported.

          `minItems: 1`, `maxItems: 16`

        - `type: "limited"`

          The type of the object. Always `limited`.

          - `"limited"`

    - `secret_name: string`

      The environment variable name that receives the placeholder, such as `SERVICE_API_KEY`. Use ASCII letters, digits, and underscores, starting with a letter or underscore. Names starting with `CODEX_` and managed proxy or certificate variable names are reserved.

      `minLength: 1`, `maxLength: 1048576`

    - `secret_value: string`

      The write-only secret to store. Never returned in credential resources or supplied directly to sandbox code. Must be nonempty and must not contain carriage returns, newlines, or NUL bytes.

      `minLength: 1`, `maxLength: 1048576`

    - `type: "environment_variable"`

      The type of the object. Always `environment_variable`.

      - `"environment_variable"`

### Credential Auth Rotate Param

- `CredentialAuthRotateParam = RotateVaultCredentialAuthParamMcpOauth | RotateVaultCredentialAuthParamStaticBearer | RotateVaultCredentialAuthParamEnvironmentVariable`

  Updates to a vault credential without changing its authentication method or destination configuration.

  - `RotateVaultCredentialAuthParamMcpOauth`

    Rotate an OAuth credential for an HTTPS MCP destination.

    - `type: "mcp_oauth"`

      The type of the object. Always `mcp_oauth`.

      - `"mcp_oauth"`

    - `access_token?: string | null`

      A write-only replacement OAuth access token.

      `minLength: 0`, `maxLength: 1048576`

    - `expires_at?: string | null`

      The replacement expiry as an RFC 3339 timestamp, or `null` to clear it. Omitting this field preserves the expiry unless a new access token is supplied, in which case the expiry is cleared.

      `minLength: 0`, `maxLength: 1048576`

    - `refresh?: Refresh | null`

      Optional write-only refresh-token and client-secret updates.

      - `refresh_token?: string | null`

        The replacement refresh token. Omit or pass `null` to keep the stored token. This secret is never returned in resources.

        `minLength: 0`, `maxLength: 1048576`

      - `scope?: string | null`

        Replacement space-separated OAuth scopes for refresh requests. Omit to keep the scopes, or pass `null` to stop sending a scope parameter.

        `minLength: 0`, `maxLength: 1048576`

      - `token_endpoint_auth?: McpOauthTokenEndpointAuthRotateParam | null`

        Client-secret updates for the existing token endpoint authentication method.

        - `RotateMcpOauthTokenEndpointAuthParamClientSecretBasic`

          Updates credentials sent using HTTP Basic authentication.

          - `type: "client_secret_basic"`

            The type of the object. Always `client_secret_basic`.

            - `"client_secret_basic"`

          - `client_secret?: string | null`

            The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources.

            `minLength: 0`, `maxLength: 1048576`

        - `RotateMcpOauthTokenEndpointAuthParamClientSecretPost`

          Updates credentials sent in the token request body.

          - `type: "client_secret_post"`

            The type of the object. Always `client_secret_post`.

            - `"client_secret_post"`

          - `client_secret?: string | null`

            The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources.

            `minLength: 0`, `maxLength: 1048576`

  - `RotateVaultCredentialAuthParamStaticBearer`

    Replace the bearer token for the credential's MCP server.

    - `token: string`

      The replacement bearer token. This secret is never returned in credential resources.

      `minLength: 0`, `maxLength: 1048576`

    - `type: "static_bearer"`

      The type of the object. Always `static_bearer`.

      - `"static_bearer"`

  - `RotateVaultCredentialAuthParamEnvironmentVariable`

    Replace the secret for an OpenAI-hosted environment credential. The environment variable name and networking configuration remain unchanged.

    - `secret_value: string`

      The write-only replacement secret. Never returned in credential resources or supplied directly to sandbox code. Must be nonempty and must not contain carriage returns, newlines, or NUL bytes.

      `minLength: 1`, `maxLength: 1048576`

    - `type: "environment_variable"`

      The type of the object. Always `environment_variable`.

      - `"environment_variable"`

### Credential Deleted

- `CredentialDeleted`

  Confirmation that a vault credential was deleted.

  - `id: string`

    The ID of the deleted credential.

    `minLength: 0`

  - `deleted: boolean`

    Whether the resource was deleted. Always `true`.

  - `object: "vault.credential.deleted"`

    The object type. Always `vault.credential.deleted`.

    - `"vault.credential.deleted"`

### Credential Networking

- `CredentialNetworking = VaultCredentialNetworkingResourceUnrestricted | VaultCredentialNetworkingResourceLimited`

  Destination permissions for an environment-variable credential. These do not grant network access to the environment.

  - `VaultCredentialNetworkingResourceUnrestricted`

    Allows substitution for destinations permitted by the environment network policy. Requires `environment.network.access` to be `restricted`, with explicit `allowed_domains`.

    - `type: "unrestricted"`

      The type of the object. Always `unrestricted`.

      - `"unrestricted"`

  - `VaultCredentialNetworkingResourceLimited`

    Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

    - `allowed_hosts: Array<string>`

      The 1 to 16 distinct allowed hostnames or IPv4 addresses, normalized to lowercase. Entries contain no scheme, path, port, or wildcard. IPv6 addresses are not supported.

      `minItems: 1`, `maxItems: 16`

    - `type: "limited"`

      The type of the object. Always `limited`.

      - `"limited"`

### Credential Networking Param

- `CredentialNetworkingParam = VaultCredentialNetworkingParamUnrestricted | VaultCredentialNetworkingParamLimited`

  Destination permissions for an environment-variable credential. These do not grant network access to the environment.

  - `VaultCredentialNetworkingParamUnrestricted`

    Allows substitution for destinations permitted by the environment network policy. Requires `environment.network.access` to be `restricted`, with explicit `allowed_domains`.

    - `type: "unrestricted"`

      The type of the object. Always `unrestricted`.

      - `"unrestricted"`

  - `VaultCredentialNetworkingParamLimited`

    Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

    - `allowed_hosts: Array<string>`

      The 1 to 16 distinct allowed hostnames or IPv4 addresses, normalized to lowercase. Entries contain no scheme, path, port, or wildcard. IPv6 addresses are not supported.

      `minItems: 1`, `maxItems: 16`

    - `type: "limited"`

      The type of the object. Always `limited`.

      - `"limited"`

### Mcp OAuth Token Endpoint Auth

- `McpOauthTokenEndpointAuth = McpOauthTokenEndpointAuthResourceNone | McpOauthTokenEndpointAuthResourceClientSecretBasic | McpOauthTokenEndpointAuthResourceClientSecretPost`

  The client authentication method used for OAuth token refresh.

  - `McpOauthTokenEndpointAuthResourceNone`

    Sends the client ID without a client secret.

    - `type: "none"`

      The type of the object. Always `none`.

      - `"none"`

  - `McpOauthTokenEndpointAuthResourceClientSecretBasic`

    Sends the client ID and secret using HTTP Basic authentication.

    - `type: "client_secret_basic"`

      The type of the object. Always `client_secret_basic`.

      - `"client_secret_basic"`

  - `McpOauthTokenEndpointAuthResourceClientSecretPost`

    Sends the client ID and secret in the token request body.

    - `type: "client_secret_post"`

      The type of the object. Always `client_secret_post`.

      - `"client_secret_post"`

### Mcp OAuth Token Endpoint Auth Create Param

- `McpOauthTokenEndpointAuthCreateParam = CreateMcpOauthTokenEndpointAuthParamNone | CreateMcpOauthTokenEndpointAuthParamClientSecretBasic | CreateMcpOauthTokenEndpointAuthParamClientSecretPost`

  Client authentication credentials for OAuth token refresh.

  - `CreateMcpOauthTokenEndpointAuthParamNone`

    Sends the client ID without a client secret.

    - `type: "none"`

      The type of the object. Always `none`.

      - `"none"`

  - `CreateMcpOauthTokenEndpointAuthParamClientSecretBasic`

    Sends the client ID and secret using HTTP Basic authentication.

    - `client_secret: string`

      The OAuth client secret to store. Never returned in credential resources.

      `minLength: 0`, `maxLength: 1048576`

    - `type: "client_secret_basic"`

      The type of the object. Always `client_secret_basic`.

      - `"client_secret_basic"`

  - `CreateMcpOauthTokenEndpointAuthParamClientSecretPost`

    Sends the client ID and secret in the token request body.

    - `client_secret: string`

      The OAuth client secret to store. Never returned in credential resources.

      `minLength: 0`, `maxLength: 1048576`

    - `type: "client_secret_post"`

      The type of the object. Always `client_secret_post`.

      - `"client_secret_post"`

### Mcp OAuth Token Endpoint Auth Rotate Param

- `McpOauthTokenEndpointAuthRotateParam = RotateMcpOauthTokenEndpointAuthParamClientSecretBasic | RotateMcpOauthTokenEndpointAuthParamClientSecretPost`

  Client-secret updates that preserve the credential's OAuth authentication method.

  - `RotateMcpOauthTokenEndpointAuthParamClientSecretBasic`

    Updates credentials sent using HTTP Basic authentication.

    - `type: "client_secret_basic"`

      The type of the object. Always `client_secret_basic`.

      - `"client_secret_basic"`

    - `client_secret?: string | null`

      The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources.

      `minLength: 0`, `maxLength: 1048576`

  - `RotateMcpOauthTokenEndpointAuthParamClientSecretPost`

    Updates credentials sent in the token request body.

    - `type: "client_secret_post"`

      The type of the object. Always `client_secret_post`.

      - `"client_secret_post"`

    - `client_secret?: string | null`

      The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources.

      `minLength: 0`, `maxLength: 1048576`

# Assistants

## Create assistant

`client.beta.assistants.create(AssistantCreateParamsbody, RequestOptionsoptions?): Assistant`

**post** `/assistants`

Create an assistant with a model and instructions.

### Parameters

- `body: AssistantCreateParams`

  - `model: (string & {}) | ChatModel`

    ID of the model to use. You can use the [List models](/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](/api/docs/models) for descriptions of them.

    - `(string & {})`

    - `ChatModel = "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 87 more`

      - `"gpt-6-astra"`

      - `"gpt-6.1-sol"`

      - `"gpt-6.1-terra"`

      - `"gpt-6-sol"`

      - `"gpt-6-luna"`

      - `"gpt-5.6-sol"`

      - `"gpt-5.6-terra"`

      - `"gpt-5.6-luna"`

      - `"gpt-5.5"`

      - `"gpt-5.5-2026-04-23"`

      - `"gpt-5.4"`

      - `"gpt-5.4-mini"`

      - `"gpt-5.4-nano"`

      - `"gpt-5.4-mini-2026-03-17"`

      - `"gpt-5.4-nano-2026-03-17"`

      - `"gpt-5.3-chat-latest"`

      - `"gpt-5.2"`

      - `"gpt-5.2-2025-12-11"`

      - `"gpt-5.2-chat-latest"`

      - `"gpt-5.2-pro"`

      - `"gpt-5.2-pro-2025-12-11"`

      - `"gpt-5.1"`

      - `"gpt-5.1-2025-11-13"`

      - `"gpt-5.1-codex"`

      - `"gpt-5.1-mini"`

      - `"gpt-5.1-chat-latest"`

      - `"gpt-5"`

      - `"gpt-5-mini"`

      - `"gpt-5-nano"`

      - `"gpt-5-2025-08-07"`

      - `"gpt-5-mini-2025-08-07"`

      - `"gpt-5-nano-2025-08-07"`

      - `"gpt-5-chat-latest"`

      - `"gpt-4.1"`

      - `"gpt-4.1-mini"`

      - `"gpt-4.1-nano"`

      - `"gpt-4.1-2025-04-14"`

      - `"gpt-4.1-mini-2025-04-14"`

      - `"gpt-4.1-nano-2025-04-14"`

      - `"o4-mini"`

      - `"o4-mini-2025-04-16"`

      - `"o3"`

      - `"o3-2025-04-16"`

      - `"o3-mini"`

      - `"o3-mini-2025-01-31"`

      - `"o1"`

      - `"o1-2024-12-17"`

      - `"o1-preview"`

      - `"o1-preview-2024-09-12"`

      - `"o1-mini"`

      - `"o1-mini-2024-09-12"`

      - `"gpt-4o"`

      - `"gpt-4o-2024-11-20"`

      - `"gpt-4o-2024-08-06"`

      - `"gpt-4o-2024-05-13"`

      - `"gpt-audio-mini"`

      - `"gpt-audio-mini-2025-12-15"`

      - `"gpt-4o-audio-preview"`

      - `"gpt-4o-audio-preview-2024-10-01"`

      - `"gpt-4o-audio-preview-2024-12-17"`

      - `"gpt-4o-audio-preview-2025-06-03"`

      - `"gpt-4o-mini-audio-preview"`

      - `"gpt-4o-mini-audio-preview-2024-12-17"`

      - `"gpt-4o-search-preview"`

      - `"gpt-4o-mini-search-preview"`

      - `"gpt-4o-search-preview-2025-03-11"`

      - `"gpt-4o-mini-search-preview-2025-03-11"`

      - `"chatgpt-4o-latest"`

      - `"codex-mini-latest"`

      - `"gpt-4o-mini"`

      - `"gpt-4o-mini-2024-07-18"`

      - `"gpt-4-turbo"`

      - `"gpt-4-turbo-2024-04-09"`

      - `"gpt-4-0125-preview"`

      - `"gpt-4-turbo-preview"`

      - `"gpt-4-1106-preview"`

      - `"gpt-4-vision-preview"`

      - `"gpt-4"`

      - `"gpt-4-0314"`

      - `"gpt-4-0613"`

      - `"gpt-4-32k"`

      - `"gpt-4-32k-0314"`

      - `"gpt-4-32k-0613"`

      - `"gpt-3.5-turbo"`

      - `"gpt-3.5-turbo-16k"`

      - `"gpt-3.5-turbo-0301"`

      - `"gpt-3.5-turbo-0613"`

      - `"gpt-3.5-turbo-1106"`

      - `"gpt-3.5-turbo-0125"`

      - `"gpt-3.5-turbo-16k-0613"`

  - `description?: string | null`

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

    `maxLength: 512`

  - `instructions?: string | null`

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

    `maxLength: 256000`

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

  - `name?: string | null`

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

    `maxLength: 256`

  - `reasoning_effort?: ReasoningEffort | null`

    Constrains effort on reasoning for reasoning models. Currently supported
    values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
    Reducing reasoning effort can result in faster responses and fewer tokens
    used on reasoning in a response. Not all reasoning models support every
    value. See the
    [reasoning guide](/api/docs/guides/reasoning)
    for model-specific support.

    - `"none"`

    - `"minimal"`

    - `"low"`

    - `"medium"`

    - `"high"`

    - `"xhigh"`

    - `"max"`

  - `response_format?: AssistantResponseFormatOption | null`

    Specifies the format that the model must output. Compatible with [GPT-4o](/api/docs/models/gpt-4o), [GPT-4 Turbo](/api/docs/models/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](/api/docs/guides/structured-outputs).

    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.

    - `"auto"`

      - `"auto"`

    - `ResponseFormatText`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject`

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

        - `"json_object"`

    - `ResponseFormatJSONSchema`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: JSONSchema`

        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](https://json-schema.org/).

        - `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](/api/docs/guides/structured-outputs).

      - `type: "json_schema"`

        The type of response format being defined. Always `json_schema`.

        - `"json_schema"`

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

    `minimum: 0`, `maximum: 2`

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

        A list of [file](/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.

        `maxItems: 20`

    - `file_search?: FileSearch`

      - `vector_store_ids?: Array<string>`

        The [vector store](/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.

        `maxItems: 1`

      - `vector_stores?: Array<VectorStore>`

        A helper to create a [vector store](/api/reference/resources/vector_stores) with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant.

        `maxItems: 1`

        - `chunking_strategy?: Auto | Static`

          The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.

          - `Auto`

            The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

          - `Static`

            - `static: Static`

              - `chunk_overlap_tokens: number`

                The number of tokens that overlap between chunks. The default value is `400`.

                Note that the overlap must not exceed half of `max_chunk_size_tokens`.

              - `max_chunk_size_tokens: number`

                The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.

                `minimum: 100`, `maximum: 4096`

            - `type: "static"`

              Always `static`.

              - `"static"`

        - `file_ids?: Array<string>`

          A list of [file](/api/reference/resources/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files.

          `maxItems: 100000000`

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

  - `tools?: Array<AssistantTool>`

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

    `maxItems: 128`

    - `CodeInterpreterTool`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search?: FileSearch`

        Overrides for the file search tool.

        - `max_num_results?: number`

          The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.

          Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

          `minimum: 1`, `maximum: 50`

        - `ranking_options?: RankingOptions`

          The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.

          See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

          - `score_threshold: number`

            The score threshold for the file search. All values must be a floating point number between 0 and 1.

            `minimum: 0`, `maximum: 1`

          - `ranker?: "auto" | "default_2024_08_21"`

            The ranker to use for the file search. If not specified will use the `auto` ranker.

            - `"auto"`

            - `"default_2024_08_21"`

    - `FunctionTool`

      - `function: FunctionDefinition`

        - `name: string`

          The name of the function to be called. 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 function does, used by the model to choose when and how to call the function.

        - `parameters?: FunctionParameters`

          The parameters the functions accepts, described as a JSON Schema object. See the [guide](/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.

          Omitting `parameters` defines a function with an empty parameter list.

        - `strict?: boolean | null`

          Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](/api/docs/guides/function-calling).

      - `type: "function"`

        The type of tool being defined: `function`

        - `"function"`

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

    `minimum: 0`, `maximum: 1`

### Returns

- `Assistant`

  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.

    `format: unixtime`

  - `description: string | null`

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

    `maxLength: 512`

  - `instructions: string | null`

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

    `maxLength: 256000`

  - `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/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](/api/docs/models) for descriptions of them.

  - `name: string | null`

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

    `maxLength: 256`

  - `object: "assistant"`

    The object type, which is always `assistant`.

    - `"assistant"`

  - `tools: Array<AssistantTool>`

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

    `maxItems: 128`

    - `CodeInterpreterTool`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search?: FileSearch`

        Overrides for the file search tool.

        - `max_num_results?: number`

          The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.

          Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

          `minimum: 1`, `maximum: 50`

        - `ranking_options?: RankingOptions`

          The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.

          See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

          - `score_threshold: number`

            The score threshold for the file search. All values must be a floating point number between 0 and 1.

            `minimum: 0`, `maximum: 1`

          - `ranker?: "auto" | "default_2024_08_21"`

            The ranker to use for the file search. If not specified will use the `auto` ranker.

            - `"auto"`

            - `"default_2024_08_21"`

    - `FunctionTool`

      - `function: FunctionDefinition`

        - `name: string`

          The name of the function to be called. 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 function does, used by the model to choose when and how to call the function.

        - `parameters?: FunctionParameters`

          The parameters the functions accepts, described as a JSON Schema object. See the [guide](/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.

          Omitting `parameters` defines a function with an empty parameter list.

        - `strict?: boolean | null`

          Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](/api/docs/guides/function-calling).

      - `type: "function"`

        The type of tool being defined: `function`

        - `"function"`

  - `response_format?: AssistantResponseFormatOption | null`

    Specifies the format that the model must output. Compatible with [GPT-4o](/api/docs/models/gpt-4o), [GPT-4 Turbo](/api/docs/models/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](/api/docs/guides/structured-outputs).

    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.

    - `"auto"`

      - `"auto"`

    - `ResponseFormatText`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject`

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

        - `"json_object"`

    - `ResponseFormatJSONSchema`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: JSONSchema`

        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](https://json-schema.org/).

        - `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](/api/docs/guides/structured-outputs).

      - `type: "json_schema"`

        The type of response format being defined. Always `json_schema`.

        - `"json_schema"`

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

    `minimum: 0`, `maximum: 2`

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

        A list of [file](/api/reference/resources/files) IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool.

        `maxItems: 20`

    - `file_search?: FileSearch`

      - `vector_store_ids?: Array<string>`

        The ID of the [vector store](/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.

        `maxItems: 1`

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

    `minimum: 0`, `maximum: 1`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const assistant = await client.beta.assistants.create({ model: 'gpt-4.1' });

console.log(assistant.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "description": "description",
  "instructions": "instructions",
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "name": "name",
  "object": "assistant",
  "tools": [
    {
      "type": "code_interpreter"
    }
  ],
  "response_format": "auto",
  "temperature": 1,
  "tool_resources": {
    "code_interpreter": {
      "file_ids": [
        "string"
      ]
    },
    "file_search": {
      "vector_store_ids": [
        "string"
      ]
    }
  },
  "top_p": 1
}
```

### Code Interpreter

```typescript
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const myAssistant = await openai.beta.assistants.create({
    instructions:
      "You are a personal math tutor. When asked a question, write and run Python code to answer the question.",
    name: "Math Tutor",
    tools: [{ type: "code_interpreter" }],
    model: "gpt-4.1",
  });

  console.log(myAssistant);
}

main();
```

#### Response example

```json
{
  "id": "asst_abc123",
  "object": "assistant",
  "created_at": 1698984975,
  "name": "Math Tutor",
  "description": null,
  "model": "gpt-4.1",
  "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.",
  "tools": [
    {
      "type": "code_interpreter"
    }
  ],
  "metadata": {},
  "top_p": 1.0,
  "temperature": 1.0,
  "response_format": "auto"
}
```

### Files

```typescript
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const myAssistant = await openai.beta.assistants.create({
    instructions:
      "You are an HR bot, and you have access to files to answer employee questions about company policies.",
    name: "HR Helper",
    tools: [{ type: "file_search" }],
    tool_resources: {
      file_search: {
        vector_store_ids: ["vs_123"]
      }
    },
    model: "gpt-4.1"
  });

  console.log(myAssistant);
}

main();
```

#### Response example

```json
{
  "id": "asst_abc123",
  "object": "assistant",
  "created_at": 1699009403,
  "name": "HR Helper",
  "description": null,
  "model": "gpt-4.1",
  "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.",
  "tools": [
    {
      "type": "file_search"
    }
  ],
  "tool_resources": {
    "file_search": {
      "vector_store_ids": ["vs_123"]
    }
  },
  "metadata": {},
  "top_p": 1.0,
  "temperature": 1.0,
  "response_format": "auto"
}
```

## Delete assistant

`client.beta.assistants.delete(stringassistantID, RequestOptionsoptions?): AssistantDeleted`

**delete** `/assistants/{assistant_id}`

Delete an assistant.

### Parameters

- `assistantID: string`

### Returns

- `AssistantDeleted`

  - `id: string`

  - `deleted: boolean`

  - `object: "assistant.deleted"`

    - `"assistant.deleted"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const assistantDeleted = await client.beta.assistants.delete('assistant_id');

console.log(assistantDeleted.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "deleted": true,
  "object": "assistant.deleted"
}
```

### Example

```typescript
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const response = await openai.beta.assistants.delete("asst_abc123");

  console.log(response);
}
main();
```

#### Response example

```json
{
  "id": "asst_abc123",
  "object": "assistant.deleted",
  "deleted": true
}
```

## List assistants

`client.beta.assistants.list(AssistantListParamsquery?, RequestOptionsoptions?): CursorPage<Assistant>`

**get** `/assistants`

Returns a list of assistants.

### Parameters

- `query: AssistantListParams`

  - `after?: string`

    A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

  - `before?: string`

    A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

  - `limit?: number`

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

  - `order?: "asc" | "desc"`

    Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

    - `"asc"`

    - `"desc"`

### Returns

- `Assistant`

  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.

    `format: unixtime`

  - `description: string | null`

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

    `maxLength: 512`

  - `instructions: string | null`

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

    `maxLength: 256000`

  - `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/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](/api/docs/models) for descriptions of them.

  - `name: string | null`

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

    `maxLength: 256`

  - `object: "assistant"`

    The object type, which is always `assistant`.

    - `"assistant"`

  - `tools: Array<AssistantTool>`

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

    `maxItems: 128`

    - `CodeInterpreterTool`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search?: FileSearch`

        Overrides for the file search tool.

        - `max_num_results?: number`

          The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.

          Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

          `minimum: 1`, `maximum: 50`

        - `ranking_options?: RankingOptions`

          The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.

          See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

          - `score_threshold: number`

            The score threshold for the file search. All values must be a floating point number between 0 and 1.

            `minimum: 0`, `maximum: 1`

          - `ranker?: "auto" | "default_2024_08_21"`

            The ranker to use for the file search. If not specified will use the `auto` ranker.

            - `"auto"`

            - `"default_2024_08_21"`

    - `FunctionTool`

      - `function: FunctionDefinition`

        - `name: string`

          The name of the function to be called. 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 function does, used by the model to choose when and how to call the function.

        - `parameters?: FunctionParameters`

          The parameters the functions accepts, described as a JSON Schema object. See the [guide](/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.

          Omitting `parameters` defines a function with an empty parameter list.

        - `strict?: boolean | null`

          Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](/api/docs/guides/function-calling).

      - `type: "function"`

        The type of tool being defined: `function`

        - `"function"`

  - `response_format?: AssistantResponseFormatOption | null`

    Specifies the format that the model must output. Compatible with [GPT-4o](/api/docs/models/gpt-4o), [GPT-4 Turbo](/api/docs/models/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](/api/docs/guides/structured-outputs).

    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.

    - `"auto"`

      - `"auto"`

    - `ResponseFormatText`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject`

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

        - `"json_object"`

    - `ResponseFormatJSONSchema`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: JSONSchema`

        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](https://json-schema.org/).

        - `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](/api/docs/guides/structured-outputs).

      - `type: "json_schema"`

        The type of response format being defined. Always `json_schema`.

        - `"json_schema"`

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

    `minimum: 0`, `maximum: 2`

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

        A list of [file](/api/reference/resources/files) IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool.

        `maxItems: 20`

    - `file_search?: FileSearch`

      - `vector_store_ids?: Array<string>`

        The ID of the [vector store](/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.

        `maxItems: 1`

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

    `minimum: 0`, `maximum: 1`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const assistant of client.beta.assistants.list()) {
  console.log(assistant.id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "description": "description",
      "instructions": "instructions",
      "metadata": {
        "foo": "string"
      },
      "model": "model",
      "name": "name",
      "object": "assistant",
      "tools": [
        {
          "type": "code_interpreter"
        }
      ],
      "response_format": "auto",
      "temperature": 1,
      "tool_resources": {
        "code_interpreter": {
          "file_ids": [
            "string"
          ]
        },
        "file_search": {
          "vector_store_ids": [
            "string"
          ]
        }
      },
      "top_p": 1
    }
  ],
  "first_id": "asst_abc123",
  "has_more": false,
  "last_id": "asst_abc456",
  "object": "list"
}
```

### Example

```typescript
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const myAssistants = await openai.beta.assistants.list({
    order: "desc",
    limit: "20",
  });

  console.log(myAssistants.data);
}

main();
```

#### Response example

```json
{
  "object": "list",
  "data": [
    {
      "id": "asst_abc123",
      "object": "assistant",
      "created_at": 1698982736,
      "name": "Coding Tutor",
      "description": null,
      "model": "gpt-4.1",
      "instructions": "You are a helpful assistant designed to make me better at coding!",
      "tools": [],
      "tool_resources": {},
      "metadata": {},
      "top_p": 1.0,
      "temperature": 1.0,
      "response_format": "auto"
    },
    {
      "id": "asst_abc456",
      "object": "assistant",
      "created_at": 1698982718,
      "name": "My Assistant",
      "description": null,
      "model": "gpt-4.1",
      "instructions": "You are a helpful assistant designed to make me better at coding!",
      "tools": [],
      "tool_resources": {},
      "metadata": {},
      "top_p": 1.0,
      "temperature": 1.0,
      "response_format": "auto"
    },
    {
      "id": "asst_abc789",
      "object": "assistant",
      "created_at": 1698982643,
      "name": null,
      "description": null,
      "model": "gpt-4.1",
      "instructions": null,
      "tools": [],
      "tool_resources": {},
      "metadata": {},
      "top_p": 1.0,
      "temperature": 1.0,
      "response_format": "auto"
    }
  ],
  "first_id": "asst_abc123",
  "last_id": "asst_abc789",
  "has_more": false
}
```

## Retrieve assistant

`client.beta.assistants.retrieve(stringassistantID, RequestOptionsoptions?): Assistant`

**get** `/assistants/{assistant_id}`

Retrieves an assistant.

### Parameters

- `assistantID: string`

### Returns

- `Assistant`

  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.

    `format: unixtime`

  - `description: string | null`

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

    `maxLength: 512`

  - `instructions: string | null`

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

    `maxLength: 256000`

  - `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/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](/api/docs/models) for descriptions of them.

  - `name: string | null`

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

    `maxLength: 256`

  - `object: "assistant"`

    The object type, which is always `assistant`.

    - `"assistant"`

  - `tools: Array<AssistantTool>`

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

    `maxItems: 128`

    - `CodeInterpreterTool`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search?: FileSearch`

        Overrides for the file search tool.

        - `max_num_results?: number`

          The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.

          Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

          `minimum: 1`, `maximum: 50`

        - `ranking_options?: RankingOptions`

          The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.

          See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

          - `score_threshold: number`

            The score threshold for the file search. All values must be a floating point number between 0 and 1.

            `minimum: 0`, `maximum: 1`

          - `ranker?: "auto" | "default_2024_08_21"`

            The ranker to use for the file search. If not specified will use the `auto` ranker.

            - `"auto"`

            - `"default_2024_08_21"`

    - `FunctionTool`

      - `function: FunctionDefinition`

        - `name: string`

          The name of the function to be called. 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 function does, used by the model to choose when and how to call the function.

        - `parameters?: FunctionParameters`

          The parameters the functions accepts, described as a JSON Schema object. See the [guide](/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.

          Omitting `parameters` defines a function with an empty parameter list.

        - `strict?: boolean | null`

          Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](/api/docs/guides/function-calling).

      - `type: "function"`

        The type of tool being defined: `function`

        - `"function"`

  - `response_format?: AssistantResponseFormatOption | null`

    Specifies the format that the model must output. Compatible with [GPT-4o](/api/docs/models/gpt-4o), [GPT-4 Turbo](/api/docs/models/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](/api/docs/guides/structured-outputs).

    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.

    - `"auto"`

      - `"auto"`

    - `ResponseFormatText`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject`

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

        - `"json_object"`

    - `ResponseFormatJSONSchema`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: JSONSchema`

        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](https://json-schema.org/).

        - `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](/api/docs/guides/structured-outputs).

      - `type: "json_schema"`

        The type of response format being defined. Always `json_schema`.

        - `"json_schema"`

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

    `minimum: 0`, `maximum: 2`

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

        A list of [file](/api/reference/resources/files) IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool.

        `maxItems: 20`

    - `file_search?: FileSearch`

      - `vector_store_ids?: Array<string>`

        The ID of the [vector store](/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.

        `maxItems: 1`

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

    `minimum: 0`, `maximum: 1`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const assistant = await client.beta.assistants.retrieve('assistant_id');

console.log(assistant.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "description": "description",
  "instructions": "instructions",
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "name": "name",
  "object": "assistant",
  "tools": [
    {
      "type": "code_interpreter"
    }
  ],
  "response_format": "auto",
  "temperature": 1,
  "tool_resources": {
    "code_interpreter": {
      "file_ids": [
        "string"
      ]
    },
    "file_search": {
      "vector_store_ids": [
        "string"
      ]
    }
  },
  "top_p": 1
}
```

### Example

```typescript
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const myAssistant = await openai.beta.assistants.retrieve(
    "asst_abc123"
  );

  console.log(myAssistant);
}

main();
```

#### Response example

```json
{
  "id": "asst_abc123",
  "object": "assistant",
  "created_at": 1699009709,
  "name": "HR Helper",
  "description": null,
  "model": "gpt-4.1",
  "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.",
  "tools": [
    {
      "type": "file_search"
    }
  ],
  "metadata": {},
  "top_p": 1.0,
  "temperature": 1.0,
  "response_format": "auto"
}
```

## Modify assistant

`client.beta.assistants.update(stringassistantID, AssistantUpdateParamsbody, RequestOptionsoptions?): Assistant`

**post** `/assistants/{assistant_id}`

Modifies an assistant.

### Parameters

- `assistantID: string`

- `body: AssistantUpdateParams`

  - `description?: string | null`

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

    `maxLength: 512`

  - `instructions?: string | null`

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

    `maxLength: 256000`

  - `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 & {}) | "gpt-5" | "gpt-5-mini" | "gpt-5-nano" | 39 more`

    ID of the model to use. You can use the [List models](/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](/api/docs/models) for descriptions of them.

    - `(string & {})`

    - `"gpt-5" | "gpt-5-mini" | "gpt-5-nano" | 39 more`

      ID of the model to use. You can use the [List models](/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](/api/docs/models) for descriptions of them.

      - `"gpt-5"`

      - `"gpt-5-mini"`

      - `"gpt-5-nano"`

      - `"gpt-5-2025-08-07"`

      - `"gpt-5-mini-2025-08-07"`

      - `"gpt-5-nano-2025-08-07"`

      - `"gpt-4.1"`

      - `"gpt-4.1-mini"`

      - `"gpt-4.1-nano"`

      - `"gpt-4.1-2025-04-14"`

      - `"gpt-4.1-mini-2025-04-14"`

      - `"gpt-4.1-nano-2025-04-14"`

      - `"o3-mini"`

      - `"o3-mini-2025-01-31"`

      - `"o1"`

      - `"o1-2024-12-17"`

      - `"gpt-4o"`

      - `"gpt-4o-2024-11-20"`

      - `"gpt-4o-2024-08-06"`

      - `"gpt-4o-2024-05-13"`

      - `"gpt-4o-mini"`

      - `"gpt-4o-mini-2024-07-18"`

      - `"gpt-4.5-preview"`

      - `"gpt-4.5-preview-2025-02-27"`

      - `"gpt-4-turbo"`

      - `"gpt-4-turbo-2024-04-09"`

      - `"gpt-4-0125-preview"`

      - `"gpt-4-turbo-preview"`

      - `"gpt-4-1106-preview"`

      - `"gpt-4-vision-preview"`

      - `"gpt-4"`

      - `"gpt-4-0314"`

      - `"gpt-4-0613"`

      - `"gpt-4-32k"`

      - `"gpt-4-32k-0314"`

      - `"gpt-4-32k-0613"`

      - `"gpt-3.5-turbo"`

      - `"gpt-3.5-turbo-16k"`

      - `"gpt-3.5-turbo-0613"`

      - `"gpt-3.5-turbo-1106"`

      - `"gpt-3.5-turbo-0125"`

      - `"gpt-3.5-turbo-16k-0613"`

  - `name?: string | null`

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

    `maxLength: 256`

  - `reasoning_effort?: ReasoningEffort | null`

    Constrains effort on reasoning for reasoning models. Currently supported
    values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
    Reducing reasoning effort can result in faster responses and fewer tokens
    used on reasoning in a response. Not all reasoning models support every
    value. See the
    [reasoning guide](/api/docs/guides/reasoning)
    for model-specific support.

    - `"none"`

    - `"minimal"`

    - `"low"`

    - `"medium"`

    - `"high"`

    - `"xhigh"`

    - `"max"`

  - `response_format?: AssistantResponseFormatOption | null`

    Specifies the format that the model must output. Compatible with [GPT-4o](/api/docs/models/gpt-4o), [GPT-4 Turbo](/api/docs/models/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](/api/docs/guides/structured-outputs).

    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.

    - `"auto"`

      - `"auto"`

    - `ResponseFormatText`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject`

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

        - `"json_object"`

    - `ResponseFormatJSONSchema`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: JSONSchema`

        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](https://json-schema.org/).

        - `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](/api/docs/guides/structured-outputs).

      - `type: "json_schema"`

        The type of response format being defined. Always `json_schema`.

        - `"json_schema"`

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

    `minimum: 0`, `maximum: 2`

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

        Overrides the list of [file](/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.

        `maxItems: 20`

    - `file_search?: FileSearch`

      - `vector_store_ids?: Array<string>`

        Overrides the [vector store](/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.

        `maxItems: 1`

  - `tools?: Array<AssistantTool>`

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

    `maxItems: 128`

    - `CodeInterpreterTool`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search?: FileSearch`

        Overrides for the file search tool.

        - `max_num_results?: number`

          The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.

          Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

          `minimum: 1`, `maximum: 50`

        - `ranking_options?: RankingOptions`

          The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.

          See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

          - `score_threshold: number`

            The score threshold for the file search. All values must be a floating point number between 0 and 1.

            `minimum: 0`, `maximum: 1`

          - `ranker?: "auto" | "default_2024_08_21"`

            The ranker to use for the file search. If not specified will use the `auto` ranker.

            - `"auto"`

            - `"default_2024_08_21"`

    - `FunctionTool`

      - `function: FunctionDefinition`

        - `name: string`

          The name of the function to be called. 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 function does, used by the model to choose when and how to call the function.

        - `parameters?: FunctionParameters`

          The parameters the functions accepts, described as a JSON Schema object. See the [guide](/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.

          Omitting `parameters` defines a function with an empty parameter list.

        - `strict?: boolean | null`

          Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](/api/docs/guides/function-calling).

      - `type: "function"`

        The type of tool being defined: `function`

        - `"function"`

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

    `minimum: 0`, `maximum: 1`

### Returns

- `Assistant`

  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.

    `format: unixtime`

  - `description: string | null`

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

    `maxLength: 512`

  - `instructions: string | null`

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

    `maxLength: 256000`

  - `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/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](/api/docs/models) for descriptions of them.

  - `name: string | null`

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

    `maxLength: 256`

  - `object: "assistant"`

    The object type, which is always `assistant`.

    - `"assistant"`

  - `tools: Array<AssistantTool>`

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

    `maxItems: 128`

    - `CodeInterpreterTool`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search?: FileSearch`

        Overrides for the file search tool.

        - `max_num_results?: number`

          The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.

          Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

          `minimum: 1`, `maximum: 50`

        - `ranking_options?: RankingOptions`

          The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.

          See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

          - `score_threshold: number`

            The score threshold for the file search. All values must be a floating point number between 0 and 1.

            `minimum: 0`, `maximum: 1`

          - `ranker?: "auto" | "default_2024_08_21"`

            The ranker to use for the file search. If not specified will use the `auto` ranker.

            - `"auto"`

            - `"default_2024_08_21"`

    - `FunctionTool`

      - `function: FunctionDefinition`

        - `name: string`

          The name of the function to be called. 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 function does, used by the model to choose when and how to call the function.

        - `parameters?: FunctionParameters`

          The parameters the functions accepts, described as a JSON Schema object. See the [guide](/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.

          Omitting `parameters` defines a function with an empty parameter list.

        - `strict?: boolean | null`

          Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](/api/docs/guides/function-calling).

      - `type: "function"`

        The type of tool being defined: `function`

        - `"function"`

  - `response_format?: AssistantResponseFormatOption | null`

    Specifies the format that the model must output. Compatible with [GPT-4o](/api/docs/models/gpt-4o), [GPT-4 Turbo](/api/docs/models/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](/api/docs/guides/structured-outputs).

    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.

    - `"auto"`

      - `"auto"`

    - `ResponseFormatText`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject`

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

        - `"json_object"`

    - `ResponseFormatJSONSchema`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: JSONSchema`

        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](https://json-schema.org/).

        - `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](/api/docs/guides/structured-outputs).

      - `type: "json_schema"`

        The type of response format being defined. Always `json_schema`.

        - `"json_schema"`

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

    `minimum: 0`, `maximum: 2`

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

        A list of [file](/api/reference/resources/files) IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool.

        `maxItems: 20`

    - `file_search?: FileSearch`

      - `vector_store_ids?: Array<string>`

        The ID of the [vector store](/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.

        `maxItems: 1`

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

    `minimum: 0`, `maximum: 1`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const assistant = await client.beta.assistants.update('assistant_id');

console.log(assistant.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "description": "description",
  "instructions": "instructions",
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "name": "name",
  "object": "assistant",
  "tools": [
    {
      "type": "code_interpreter"
    }
  ],
  "response_format": "auto",
  "temperature": 1,
  "tool_resources": {
    "code_interpreter": {
      "file_ids": [
        "string"
      ]
    },
    "file_search": {
      "vector_store_ids": [
        "string"
      ]
    }
  },
  "top_p": 1
}
```

### Example

```typescript
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const myUpdatedAssistant = await openai.beta.assistants.update(
    "asst_abc123",
    {
      instructions:
        "You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.",
      name: "HR Helper",
      tools: [{ type: "file_search" }],
      model: "gpt-4.1"
    }
  );

  console.log(myUpdatedAssistant);
}

main();
```

#### Response example

```json
{
  "id": "asst_123",
  "object": "assistant",
  "created_at": 1699009709,
  "name": "HR Helper",
  "description": null,
  "model": "gpt-4.1",
  "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.",
  "tools": [
    {
      "type": "file_search"
    }
  ],
  "tool_resources": {
    "file_search": {
      "vector_store_ids": []
    }
  },
  "metadata": {},
  "top_p": 1.0,
  "temperature": 1.0,
  "response_format": "auto"
}
```

## Domain Types

### Assistant

- `Assistant`

  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.

    `format: unixtime`

  - `description: string | null`

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

    `maxLength: 512`

  - `instructions: string | null`

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

    `maxLength: 256000`

  - `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/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](/api/docs/models) for descriptions of them.

  - `name: string | null`

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

    `maxLength: 256`

  - `object: "assistant"`

    The object type, which is always `assistant`.

    - `"assistant"`

  - `tools: Array<AssistantTool>`

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

    `maxItems: 128`

    - `CodeInterpreterTool`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search?: FileSearch`

        Overrides for the file search tool.

        - `max_num_results?: number`

          The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.

          Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

          `minimum: 1`, `maximum: 50`

        - `ranking_options?: RankingOptions`

          The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.

          See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

          - `score_threshold: number`

            The score threshold for the file search. All values must be a floating point number between 0 and 1.

            `minimum: 0`, `maximum: 1`

          - `ranker?: "auto" | "default_2024_08_21"`

            The ranker to use for the file search. If not specified will use the `auto` ranker.

            - `"auto"`

            - `"default_2024_08_21"`

    - `FunctionTool`

      - `function: FunctionDefinition`

        - `name: string`

          The name of the function to be called. 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 function does, used by the model to choose when and how to call the function.

        - `parameters?: FunctionParameters`

          The parameters the functions accepts, described as a JSON Schema object. See the [guide](/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.

          Omitting `parameters` defines a function with an empty parameter list.

        - `strict?: boolean | null`

          Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](/api/docs/guides/function-calling).

      - `type: "function"`

        The type of tool being defined: `function`

        - `"function"`

  - `response_format?: AssistantResponseFormatOption | null`

    Specifies the format that the model must output. Compatible with [GPT-4o](/api/docs/models/gpt-4o), [GPT-4 Turbo](/api/docs/models/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](/api/docs/guides/structured-outputs).

    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.

    - `"auto"`

      - `"auto"`

    - `ResponseFormatText`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject`

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

        - `"json_object"`

    - `ResponseFormatJSONSchema`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: JSONSchema`

        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](https://json-schema.org/).

        - `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](/api/docs/guides/structured-outputs).

      - `type: "json_schema"`

        The type of response format being defined. Always `json_schema`.

        - `"json_schema"`

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

    `minimum: 0`, `maximum: 2`

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

        A list of [file](/api/reference/resources/files) IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool.

        `maxItems: 20`

    - `file_search?: FileSearch`

      - `vector_store_ids?: Array<string>`

        The ID of the [vector store](/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.

        `maxItems: 1`

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

    `minimum: 0`, `maximum: 1`

### Assistant Deleted

- `AssistantDeleted`

  - `id: string`

  - `deleted: boolean`

  - `object: "assistant.deleted"`

    - `"assistant.deleted"`

### Assistant Stream Event

- `AssistantStreamEvent = ThreadCreated | ThreadRunCreated | ThreadRunQueued | 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](/api/docs/assistants/migration) to learn how to
  integrate the Assistants API with streaming.

  - `ThreadCreated`

    Occurs when a new [thread](/api/docs/assistants/migration) is created.

    - `data: Thread`

      Represents a thread that contains [messages](/api/docs/assistants/migration).

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

        `format: unixtime`

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

        - `"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?: Array<string>`

            A list of [file](/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.

            `maxItems: 20`

        - `file_search?: FileSearch`

          - `vector_store_ids?: Array<string>`

            The [vector store](/api/reference/resources/vector_stores) attached to this thread. There can be a maximum of 1 vector store attached to the thread.

            `maxItems: 1`

    - `event: "thread.created"`

      - `"thread.created"`

    - `enabled?: boolean`

      Whether to enable input audio transcription.

  - `ThreadRunCreated`

    Occurs when a new [run](/api/docs/assistants/migration) is created.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

      - `id: string`

        The identifier, which can be referenced in API endpoints.

      - `assistant_id: string`

        The ID of the [assistant](/api/docs/assistants/migration) used for execution of this run.

      - `cancelled_at: number | null`

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

        `format: unixtime`

      - `completed_at: number | null`

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

        `format: unixtime`

      - `created_at: number`

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

        `format: unixtime`

      - `expires_at: number | null`

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

        `format: unixtime`

      - `failed_at: number | null`

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

        `format: unixtime`

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

          - `"max_completion_tokens"`

          - `"max_prompt_tokens"`

      - `instructions: string`

        The instructions that the [assistant](/api/docs/assistants/migration) 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`.

          - `"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.

        `minimum: 256`

      - `max_prompt_tokens: number | null`

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

        `minimum: 256`

      - `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](/api/docs/assistants/migration) used for this run.

      - `object: "thread.run"`

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

        - `"thread.run"`

      - `parallel_tool_calls: boolean`

        Whether to enable [parallel function calling](/api/docs/guides/function-calling#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`

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

          - `tool_calls: Array<RequiredActionFunctionToolCall>`

            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](/api/docs/assistants/migration) endpoint.

            - `function: Function`

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

              - `"function"`

        - `type: "submit_tool_outputs"`

          For now, this is always `submit_tool_outputs`.

          - `"submit_tool_outputs"`

      - `response_format: AssistantResponseFormatOption | null`

        Specifies the format that the model must output. Compatible with [GPT-4o](/api/docs/models/gpt-4o), [GPT-4 Turbo](/api/docs/models/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](/api/docs/guides/structured-outputs).

        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.

        - `"auto"`

          - `"auto"`

        - `ResponseFormatText`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `ResponseFormatJSONObject`

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

            - `"json_object"`

        - `ResponseFormatJSONSchema`

          JSON Schema response format. Used to generate structured JSON responses.
          Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

          - `json_schema: JSONSchema`

            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](https://json-schema.org/).

            - `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](/api/docs/guides/structured-outputs).

          - `type: "json_schema"`

            The type of response format being defined. Always `json_schema`.

            - `"json_schema"`

      - `started_at: number | null`

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

        `format: unixtime`

      - `status: RunStatus`

        The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`.

        - `"queued"`

        - `"in_progress"`

        - `"requires_action"`

        - `"cancelling"`

        - `"cancelled"`

        - `"failed"`

        - `"completed"`

        - `"incomplete"`

        - `"expired"`

      - `thread_id: string`

        The ID of the [thread](/api/docs/assistants/migration) 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.

        - `"none" | "auto" | "required"`

          - `"none"`

          - `"auto"`

          - `"required"`

        - `AssistantToolChoice`

          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

            - `"function"`

            - `"code_interpreter"`

            - `"file_search"`

          - `function?: AssistantToolChoiceFunction`

            - `name: string`

              The name of the function to call.

      - `tools: Array<AssistantTool>`

        The list of tools that the [assistant](/api/docs/assistants/migration) used for this run.

        `maxItems: 20`

        - `CodeInterpreterTool`

          - `type: "code_interpreter"`

            The type of tool being defined: `code_interpreter`

            - `"code_interpreter"`

        - `FileSearchTool`

          - `type: "file_search"`

            The type of tool being defined: `file_search`

            - `"file_search"`

          - `file_search?: FileSearch`

            Overrides for the file search tool.

            - `max_num_results?: number`

              The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.

              Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

              `minimum: 1`, `maximum: 50`

            - `ranking_options?: RankingOptions`

              The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.

              See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

              - `score_threshold: number`

                The score threshold for the file search. All values must be a floating point number between 0 and 1.

                `minimum: 0`, `maximum: 1`

              - `ranker?: "auto" | "default_2024_08_21"`

                The ranker to use for the file search. If not specified will use the `auto` ranker.

                - `"auto"`

                - `"default_2024_08_21"`

        - `FunctionTool`

          - `function: FunctionDefinition`

            - `name: string`

              The name of the function to be called. 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 function does, used by the model to choose when and how to call the function.

            - `parameters?: FunctionParameters`

              The parameters the functions accepts, described as a JSON Schema object. See the [guide](/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.

              Omitting `parameters` defines a function with an empty parameter list.

            - `strict?: boolean | null`

              Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](/api/docs/guides/function-calling).

          - `type: "function"`

            The type of tool being defined: `function`

            - `"function"`

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

          - `"auto"`

          - `"last_messages"`

        - `last_messages?: number | null`

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

          `minimum: 1`

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

    - `event: "thread.run.created"`

      - `"thread.run.created"`

  - `ThreadRunQueued`

    Occurs when a [run](/api/docs/assistants/migration) moves to a `queued` status.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.queued"`

      - `"thread.run.queued"`

  - `ThreadRunInProgress`

    Occurs when a [run](/api/docs/assistants/migration) moves to an `in_progress` status.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.in_progress"`

      - `"thread.run.in_progress"`

  - `ThreadRunRequiresAction`

    Occurs when a [run](/api/docs/assistants/migration) moves to a `requires_action` status.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.requires_action"`

      - `"thread.run.requires_action"`

  - `ThreadRunCompleted`

    Occurs when a [run](/api/docs/assistants/migration) is completed.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.completed"`

      - `"thread.run.completed"`

  - `ThreadRunIncomplete`

    Occurs when a [run](/api/docs/assistants/migration) ends with status `incomplete`.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.incomplete"`

      - `"thread.run.incomplete"`

  - `ThreadRunFailed`

    Occurs when a [run](/api/docs/assistants/migration) fails.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.failed"`

      - `"thread.run.failed"`

  - `ThreadRunCancelling`

    Occurs when a [run](/api/docs/assistants/migration) moves to a `cancelling` status.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.cancelling"`

      - `"thread.run.cancelling"`

  - `ThreadRunCancelled`

    Occurs when a [run](/api/docs/assistants/migration) is cancelled.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.cancelled"`

      - `"thread.run.cancelled"`

  - `ThreadRunExpired`

    Occurs when a [run](/api/docs/assistants/migration) expires.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.expired"`

      - `"thread.run.expired"`

  - `ThreadRunStepCreated`

    Occurs when a [run step](/api/docs/assistants/migration) is created.

    - `data: RunStep`

      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](/api/docs/assistants/migration) associated with the run step.

      - `cancelled_at: number | null`

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

        `format: unixtime`

      - `completed_at: number | null`

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

        `format: unixtime`

      - `created_at: number`

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

        `format: unixtime`

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

        `format: unixtime`

      - `failed_at: number | null`

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

        `format: unixtime`

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

          - `"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`.

        - `"thread.run.step"`

      - `run_id: string`

        The ID of the [run](/api/docs/assistants/migration) 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`.

        - `"in_progress"`

        - `"cancelled"`

        - `"failed"`

        - `"completed"`

        - `"expired"`

      - `step_details: MessageCreationStepDetails | ToolCallsStepDetails`

        The details of the run step.

        - `MessageCreationStepDetails`

          Details of the message creation by the run step.

          - `message_creation: MessageCreation`

            - `message_id: string`

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

          - `type: "message_creation"`

            Always `message_creation`.

            - `"message_creation"`

        - `ToolCallsStepDetails`

          Details of the tool call.

          - `tool_calls: Array<ToolCall>`

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

            - `CodeInterpreterToolCall`

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

              - `id: string`

                The ID of the tool call.

              - `code_interpreter: CodeInterpreter`

                The Code Interpreter tool call definition.

                - `input: string`

                  The input to the Code Interpreter tool call.

                - `outputs: Array<Logs | 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.

                  - `Logs`

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

                      - `"logs"`

                  - `Image`

                    - `image: Image`

                      - `file_id: string`

                        The [file](/api/reference/resources/files) ID of the image.

                    - `type: "image"`

                      Always `image`.

                      - `"image"`

              - `type: "code_interpreter"`

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

                - `"code_interpreter"`

            - `FileSearchToolCall`

              - `id: string`

                The ID of the tool call object.

              - `file_search: FileSearch`

                For now, this is always going to be an empty object.

                - `ranking_options?: RankingOptions`

                  The ranking options for the file search.

                  - `ranker: "auto" | "default_2024_08_21"`

                    The ranker to use for the file search. If not specified will use the `auto` ranker.

                    - `"auto"`

                    - `"default_2024_08_21"`

                  - `score_threshold: number`

                    The score threshold for the file search. All values must be a floating point number between 0 and 1.

                    `minimum: 0`, `maximum: 1`

                - `results?: Array<Result>`

                  The results of the file search.

                  - `file_id: string`

                    The ID of the file that result was found in.

                  - `file_name: string`

                    The name of the file that result was found in.

                  - `score: number`

                    The score of the result. All values must be a floating point number between 0 and 1.

                    `minimum: 0`, `maximum: 1`

                  - `content?: Array<Content>`

                    The content of the result that was found. The content is only included if requested via the include query parameter.

                    - `text?: string`

                      The text content of the file.

                    - `type?: "text"`

                      The type of the content.

                      - `"text"`

              - `type: "file_search"`

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

                - `"file_search"`

            - `FunctionToolCall`

              - `id: string`

                The ID of the tool call object.

              - `function: Function`

                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](/api/docs/assistants/migration) yet.

              - `type: "function"`

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

                - `"function"`

          - `type: "tool_calls"`

            Always `tool_calls`.

            - `"tool_calls"`

      - `thread_id: string`

        The ID of the [thread](/api/docs/assistants/migration) that was run.

      - `type: "message_creation" | "tool_calls"`

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

        - `"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).

    - `event: "thread.run.step.created"`

      - `"thread.run.step.created"`

  - `ThreadRunStepInProgress`

    Occurs when a [run step](/api/docs/assistants/migration) moves to an `in_progress` state.

    - `data: RunStep`

      Represents a step in execution of a run.

    - `event: "thread.run.step.in_progress"`

      - `"thread.run.step.in_progress"`

  - `ThreadRunStepDelta`

    Occurs when parts of a [run step](/api/docs/assistants/migration) are being streamed.

    - `data: RunStepDeltaEvent`

      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: RunStepDelta`

        The delta containing the fields that have changed on the run step.

        - `step_details?: RunStepDeltaMessageDelta | ToolCallDeltaObject`

          The details of the run step.

          - `RunStepDeltaMessageDelta`

            Details of the message creation by the run step.

            - `type: "message_creation"`

              Always `message_creation`.

              - `"message_creation"`

            - `message_creation?: MessageCreation`

              - `message_id?: string`

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

          - `ToolCallDeltaObject`

            Details of the tool call.

            - `type: "tool_calls"`

              Always `tool_calls`.

              - `"tool_calls"`

            - `tool_calls?: Array<ToolCallDelta>`

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

              - `CodeInterpreterToolCallDelta`

                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.

                  - `"code_interpreter"`

                - `id?: string`

                  The ID of the tool call.

                - `code_interpreter?: CodeInterpreter`

                  The Code Interpreter tool call definition.

                  - `input?: string`

                    The input to the Code Interpreter tool call.

                  - `outputs?: Array<CodeInterpreterLogs | CodeInterpreterOutputImage>`

                    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.

                    - `CodeInterpreterLogs`

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

                      - `logs?: string`

                        The text output from the Code Interpreter tool call.

                    - `CodeInterpreterOutputImage`

                      - `index: number`

                        The index of the output in the outputs array.

                      - `type: "image"`

                        Always `image`.

                        - `"image"`

                      - `image?: Image`

                        - `file_id?: string`

                          The [file](/api/reference/resources/files) ID of the image.

              - `FileSearchToolCallDelta`

                - `file_search: unknown`

                  For now, this is always going to be an empty object.

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

                  - `"file_search"`

                - `id?: string`

                  The ID of the tool call object.

              - `FunctionToolCallDelta`

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

                  - `"function"`

                - `id?: string`

                  The ID of the tool call object.

                - `function?: Function`

                  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](/api/docs/assistants/migration) yet.

      - `object: "thread.run.step.delta"`

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

        - `"thread.run.step.delta"`

    - `event: "thread.run.step.delta"`

      - `"thread.run.step.delta"`

  - `ThreadRunStepCompleted`

    Occurs when a [run step](/api/docs/assistants/migration) is completed.

    - `data: RunStep`

      Represents a step in execution of a run.

    - `event: "thread.run.step.completed"`

      - `"thread.run.step.completed"`

  - `ThreadRunStepFailed`

    Occurs when a [run step](/api/docs/assistants/migration) fails.

    - `data: RunStep`

      Represents a step in execution of a run.

    - `event: "thread.run.step.failed"`

      - `"thread.run.step.failed"`

  - `ThreadRunStepCancelled`

    Occurs when a [run step](/api/docs/assistants/migration) is cancelled.

    - `data: RunStep`

      Represents a step in execution of a run.

    - `event: "thread.run.step.cancelled"`

      - `"thread.run.step.cancelled"`

  - `ThreadRunStepExpired`

    Occurs when a [run step](/api/docs/assistants/migration) expires.

    - `data: RunStep`

      Represents a step in execution of a run.

    - `event: "thread.run.step.expired"`

      - `"thread.run.step.expired"`

  - `ThreadMessageCreated`

    Occurs when a [message](/api/docs/assistants/migration) is created.

    - `data: Message`

      Represents a message within a [thread](/api/docs/assistants/migration).

      - `id: string`

        The identifier, which can be referenced in API endpoints.

      - `assistant_id: string | null`

        If applicable, the ID of the [assistant](/api/docs/assistants/migration) 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 | AssistantToolsFileSearchTypeOnly>`

          The tools to add this file to.

          - `CodeInterpreterTool`

          - `AssistantToolsFileSearchTypeOnly`

            - `type: "file_search"`

              The type of tool being defined: `file_search`

              - `"file_search"`

      - `completed_at: number | null`

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

        `format: unixtime`

      - `content: Array<MessageContent>`

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

        - `ImageFileContentBlock`

          References an image [File](/api/reference/resources/files) in the content of a message.

          - `image_file: ImageFile`

            - `file_id: string`

              The [File](/api/reference/resources/files) 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`.

              - `"auto"`

              - `"low"`

              - `"high"`

          - `type: "image_file"`

            Always `image_file`.

            - `"image_file"`

        - `ImageURLContentBlock`

          References an image URL in the content of a message.

          - `image_url: ImageURL`

            - `url: string`

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

              `format: uri`

            - `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`

              - `"auto"`

              - `"low"`

              - `"high"`

          - `type: "image_url"`

            The type of the content part.

            - `"image_url"`

        - `TextContentBlock`

          The text content that is part of a message.

          - `text: Text`

            - `annotations: Array<Annotation>`

              - `FileCitationAnnotation`

                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`

                  `minimum: 0`

                - `file_citation: FileCitation`

                  - `file_id: string`

                    The ID of the specific File the citation is from.

                - `start_index: number`

                  `minimum: 0`

                - `text: string`

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

                - `type: "file_citation"`

                  Always `file_citation`.

                  - `"file_citation"`

              - `FilePathAnnotation`

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

                - `end_index: number`

                  `minimum: 0`

                - `file_path: FilePath`

                  - `file_id: string`

                    The ID of the file that was generated.

                - `start_index: number`

                  `minimum: 0`

                - `text: string`

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

                - `type: "file_path"`

                  Always `file_path`.

                  - `"file_path"`

            - `value: string`

              The data that makes up the text.

          - `type: "text"`

            Always `text`.

            - `"text"`

        - `RefusalContentBlock`

          The refusal content generated by the assistant.

          - `refusal: string`

          - `type: "refusal"`

            Always `refusal`.

            - `"refusal"`

      - `created_at: number`

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

        `format: unixtime`

      - `incomplete_at: number | null`

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

        `format: unixtime`

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

          - `"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`.

        - `"thread.message"`

      - `role: "user" | "assistant"`

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

        - `"user"`

        - `"assistant"`

      - `run_id: string | null`

        The ID of the [run](/api/docs/assistants/migration) 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`.

        - `"in_progress"`

        - `"incomplete"`

        - `"completed"`

      - `thread_id: string`

        The [thread](/api/docs/assistants/migration) ID that this message belongs to.

    - `event: "thread.message.created"`

      - `"thread.message.created"`

  - `ThreadMessageInProgress`

    Occurs when a [message](/api/docs/assistants/migration) moves to an `in_progress` state.

    - `data: Message`

      Represents a message within a [thread](/api/docs/assistants/migration).

    - `event: "thread.message.in_progress"`

      - `"thread.message.in_progress"`

  - `ThreadMessageDelta`

    Occurs when parts of a [Message](/api/docs/assistants/migration) are being streamed.

    - `data: MessageDeltaEvent`

      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`

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

        - `content?: Array<MessageContentDelta>`

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

          - `ImageFileDeltaBlock`

            References an image [File](/api/reference/resources/files) 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"`

            - `image_file?: ImageFileDelta`

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

                - `"auto"`

                - `"low"`

                - `"high"`

              - `file_id?: string`

                The [File](/api/reference/resources/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content.

          - `TextDeltaBlock`

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

            - `text?: TextDelta`

              - `annotations?: Array<AnnotationDelta>`

                - `FileCitationDeltaAnnotation`

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

                    - `"file_citation"`

                  - `end_index?: number`

                    `minimum: 0`

                  - `file_citation?: FileCitation`

                    - `file_id?: string`

                      The ID of the specific File the citation is from.

                    - `quote?: string`

                      The specific quote in the file.

                  - `start_index?: number`

                    `minimum: 0`

                  - `text?: string`

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

                - `FilePathDeltaAnnotation`

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

                    - `"file_path"`

                  - `end_index?: number`

                    `minimum: 0`

                  - `file_path?: FilePath`

                    - `file_id?: string`

                      The ID of the file that was generated.

                  - `start_index?: number`

                    `minimum: 0`

                  - `text?: string`

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

              - `value?: string`

                The data that makes up the text.

          - `RefusalDeltaBlock`

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

            - `refusal?: string`

          - `ImageURLDeltaBlock`

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

            - `image_url?: ImageURLDelta`

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

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

                - `"auto"`

                - `"low"`

                - `"high"`

              - `url?: string`

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

                `format: uri`

        - `role?: "user" | "assistant"`

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

          - `"user"`

          - `"assistant"`

      - `object: "thread.message.delta"`

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

        - `"thread.message.delta"`

    - `event: "thread.message.delta"`

      - `"thread.message.delta"`

  - `ThreadMessageCompleted`

    Occurs when a [message](/api/docs/assistants/migration) is completed.

    - `data: Message`

      Represents a message within a [thread](/api/docs/assistants/migration).

    - `event: "thread.message.completed"`

      - `"thread.message.completed"`

  - `ThreadMessageIncomplete`

    Occurs when a [message](/api/docs/assistants/migration) ends before it is completed.

    - `data: Message`

      Represents a message within a [thread](/api/docs/assistants/migration).

    - `event: "thread.message.incomplete"`

      - `"thread.message.incomplete"`

  - `ErrorEvent`

    Occurs when an [error](/api/docs/guides/error-codes#api-errors) occurs. This can happen due to an internal server error or a timeout.

    - `data: ErrorObject`

      - `code: string | null`

      - `message: string`

      - `param: string | null`

      - `type: string`

      - `misalignment?: Misalignment`

        - `detailed_explanation?: string`

          The public explanation for this block.

        - `error_type?: (string & {}) | "potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

          An optional classification; clients must accept additional values.

          - `(string & {})`

          - `"potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

            - `"potentially_unintended_data_transfer"`

            - `"potentially_unintended_data_access"`

            - `"potentially_unintended_destructive_activity"`

            - `"other"`

        - `review_target?: string | null`

          An opaque target for explicitly continuing this review, or null when unavailable.

          `minLength: 1`, `maxLength: 96`

        - `steer?: Steer`

          An optional public continuation instruction.

          - `message: string`

            The public continuation instruction.

    - `event: "error"`

      - `"error"`

### Assistant Tool

- `AssistantTool = CodeInterpreterTool | FileSearchTool | FunctionTool`

  - `CodeInterpreterTool`

    - `type: "code_interpreter"`

      The type of tool being defined: `code_interpreter`

      - `"code_interpreter"`

  - `FileSearchTool`

    - `type: "file_search"`

      The type of tool being defined: `file_search`

      - `"file_search"`

    - `file_search?: FileSearch`

      Overrides for the file search tool.

      - `max_num_results?: number`

        The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.

        Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

        `minimum: 1`, `maximum: 50`

      - `ranking_options?: RankingOptions`

        The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.

        See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

        - `score_threshold: number`

          The score threshold for the file search. All values must be a floating point number between 0 and 1.

          `minimum: 0`, `maximum: 1`

        - `ranker?: "auto" | "default_2024_08_21"`

          The ranker to use for the file search. If not specified will use the `auto` ranker.

          - `"auto"`

          - `"default_2024_08_21"`

  - `FunctionTool`

    - `function: FunctionDefinition`

      - `name: string`

        The name of the function to be called. 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 function does, used by the model to choose when and how to call the function.

      - `parameters?: FunctionParameters`

        The parameters the functions accepts, described as a JSON Schema object. See the [guide](/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.

        Omitting `parameters` defines a function with an empty parameter list.

      - `strict?: boolean | null`

        Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](/api/docs/guides/function-calling).

    - `type: "function"`

      The type of tool being defined: `function`

      - `"function"`

### Code Interpreter Tool

- `CodeInterpreterTool`

  - `type: "code_interpreter"`

    The type of tool being defined: `code_interpreter`

    - `"code_interpreter"`

### File Search Tool

- `FileSearchTool`

  - `type: "file_search"`

    The type of tool being defined: `file_search`

    - `"file_search"`

  - `file_search?: FileSearch`

    Overrides for the file search tool.

    - `max_num_results?: number`

      The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.

      Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

      `minimum: 1`, `maximum: 50`

    - `ranking_options?: RankingOptions`

      The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.

      See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

      - `score_threshold: number`

        The score threshold for the file search. All values must be a floating point number between 0 and 1.

        `minimum: 0`, `maximum: 1`

      - `ranker?: "auto" | "default_2024_08_21"`

        The ranker to use for the file search. If not specified will use the `auto` ranker.

        - `"auto"`

        - `"default_2024_08_21"`

### Function Tool

- `FunctionTool`

  - `function: FunctionDefinition`

    - `name: string`

      The name of the function to be called. 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 function does, used by the model to choose when and how to call the function.

    - `parameters?: FunctionParameters`

      The parameters the functions accepts, described as a JSON Schema object. See the [guide](/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.

      Omitting `parameters` defines a function with an empty parameter list.

    - `strict?: boolean | null`

      Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](/api/docs/guides/function-calling).

  - `type: "function"`

    The type of tool being defined: `function`

    - `"function"`

### Message Stream Event

- `MessageStreamEvent = ThreadMessageCreated | ThreadMessageInProgress | ThreadMessageDelta | 2 more`

  Occurs when a [message](/api/docs/assistants/migration) is created.

  - `ThreadMessageCreated`

    Occurs when a [message](/api/docs/assistants/migration) is created.

    - `data: Message`

      Represents a message within a [thread](/api/docs/assistants/migration).

      - `id: string`

        The identifier, which can be referenced in API endpoints.

      - `assistant_id: string | null`

        If applicable, the ID of the [assistant](/api/docs/assistants/migration) 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 | AssistantToolsFileSearchTypeOnly>`

          The tools to add this file to.

          - `CodeInterpreterTool`

            - `type: "code_interpreter"`

              The type of tool being defined: `code_interpreter`

              - `"code_interpreter"`

          - `AssistantToolsFileSearchTypeOnly`

            - `type: "file_search"`

              The type of tool being defined: `file_search`

              - `"file_search"`

      - `completed_at: number | null`

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

        `format: unixtime`

      - `content: Array<MessageContent>`

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

        - `ImageFileContentBlock`

          References an image [File](/api/reference/resources/files) in the content of a message.

          - `image_file: ImageFile`

            - `file_id: string`

              The [File](/api/reference/resources/files) 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`.

              - `"auto"`

              - `"low"`

              - `"high"`

          - `type: "image_file"`

            Always `image_file`.

            - `"image_file"`

        - `ImageURLContentBlock`

          References an image URL in the content of a message.

          - `image_url: ImageURL`

            - `url: string`

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

              `format: uri`

            - `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`

              - `"auto"`

              - `"low"`

              - `"high"`

          - `type: "image_url"`

            The type of the content part.

            - `"image_url"`

        - `TextContentBlock`

          The text content that is part of a message.

          - `text: Text`

            - `annotations: Array<Annotation>`

              - `FileCitationAnnotation`

                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`

                  `minimum: 0`

                - `file_citation: FileCitation`

                  - `file_id: string`

                    The ID of the specific File the citation is from.

                - `start_index: number`

                  `minimum: 0`

                - `text: string`

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

                - `type: "file_citation"`

                  Always `file_citation`.

                  - `"file_citation"`

              - `FilePathAnnotation`

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

                - `end_index: number`

                  `minimum: 0`

                - `file_path: FilePath`

                  - `file_id: string`

                    The ID of the file that was generated.

                - `start_index: number`

                  `minimum: 0`

                - `text: string`

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

                - `type: "file_path"`

                  Always `file_path`.

                  - `"file_path"`

            - `value: string`

              The data that makes up the text.

          - `type: "text"`

            Always `text`.

            - `"text"`

        - `RefusalContentBlock`

          The refusal content generated by the assistant.

          - `refusal: string`

          - `type: "refusal"`

            Always `refusal`.

            - `"refusal"`

      - `created_at: number`

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

        `format: unixtime`

      - `incomplete_at: number | null`

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

        `format: unixtime`

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

          - `"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`.

        - `"thread.message"`

      - `role: "user" | "assistant"`

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

        - `"user"`

        - `"assistant"`

      - `run_id: string | null`

        The ID of the [run](/api/docs/assistants/migration) 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`.

        - `"in_progress"`

        - `"incomplete"`

        - `"completed"`

      - `thread_id: string`

        The [thread](/api/docs/assistants/migration) ID that this message belongs to.

    - `event: "thread.message.created"`

      - `"thread.message.created"`

  - `ThreadMessageInProgress`

    Occurs when a [message](/api/docs/assistants/migration) moves to an `in_progress` state.

    - `data: Message`

      Represents a message within a [thread](/api/docs/assistants/migration).

    - `event: "thread.message.in_progress"`

      - `"thread.message.in_progress"`

  - `ThreadMessageDelta`

    Occurs when parts of a [Message](/api/docs/assistants/migration) are being streamed.

    - `data: MessageDeltaEvent`

      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`

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

        - `content?: Array<MessageContentDelta>`

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

          - `ImageFileDeltaBlock`

            References an image [File](/api/reference/resources/files) 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"`

            - `image_file?: ImageFileDelta`

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

                - `"auto"`

                - `"low"`

                - `"high"`

              - `file_id?: string`

                The [File](/api/reference/resources/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content.

          - `TextDeltaBlock`

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

            - `text?: TextDelta`

              - `annotations?: Array<AnnotationDelta>`

                - `FileCitationDeltaAnnotation`

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

                    - `"file_citation"`

                  - `end_index?: number`

                    `minimum: 0`

                  - `file_citation?: FileCitation`

                    - `file_id?: string`

                      The ID of the specific File the citation is from.

                    - `quote?: string`

                      The specific quote in the file.

                  - `start_index?: number`

                    `minimum: 0`

                  - `text?: string`

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

                - `FilePathDeltaAnnotation`

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

                    - `"file_path"`

                  - `end_index?: number`

                    `minimum: 0`

                  - `file_path?: FilePath`

                    - `file_id?: string`

                      The ID of the file that was generated.

                  - `start_index?: number`

                    `minimum: 0`

                  - `text?: string`

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

              - `value?: string`

                The data that makes up the text.

          - `RefusalDeltaBlock`

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

            - `refusal?: string`

          - `ImageURLDeltaBlock`

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

            - `image_url?: ImageURLDelta`

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

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

                - `"auto"`

                - `"low"`

                - `"high"`

              - `url?: string`

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

                `format: uri`

        - `role?: "user" | "assistant"`

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

          - `"user"`

          - `"assistant"`

      - `object: "thread.message.delta"`

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

        - `"thread.message.delta"`

    - `event: "thread.message.delta"`

      - `"thread.message.delta"`

  - `ThreadMessageCompleted`

    Occurs when a [message](/api/docs/assistants/migration) is completed.

    - `data: Message`

      Represents a message within a [thread](/api/docs/assistants/migration).

    - `event: "thread.message.completed"`

      - `"thread.message.completed"`

  - `ThreadMessageIncomplete`

    Occurs when a [message](/api/docs/assistants/migration) ends before it is completed.

    - `data: Message`

      Represents a message within a [thread](/api/docs/assistants/migration).

    - `event: "thread.message.incomplete"`

      - `"thread.message.incomplete"`

### Run Step Stream Event

- `RunStepStreamEvent = ThreadRunStepCreated | ThreadRunStepInProgress | ThreadRunStepDelta | 4 more`

  Occurs when a [run step](/api/docs/assistants/migration) is created.

  - `ThreadRunStepCreated`

    Occurs when a [run step](/api/docs/assistants/migration) is created.

    - `data: RunStep`

      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](/api/docs/assistants/migration) associated with the run step.

      - `cancelled_at: number | null`

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

        `format: unixtime`

      - `completed_at: number | null`

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

        `format: unixtime`

      - `created_at: number`

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

        `format: unixtime`

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

        `format: unixtime`

      - `failed_at: number | null`

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

        `format: unixtime`

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

          - `"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`.

        - `"thread.run.step"`

      - `run_id: string`

        The ID of the [run](/api/docs/assistants/migration) 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`.

        - `"in_progress"`

        - `"cancelled"`

        - `"failed"`

        - `"completed"`

        - `"expired"`

      - `step_details: MessageCreationStepDetails | ToolCallsStepDetails`

        The details of the run step.

        - `MessageCreationStepDetails`

          Details of the message creation by the run step.

          - `message_creation: MessageCreation`

            - `message_id: string`

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

          - `type: "message_creation"`

            Always `message_creation`.

            - `"message_creation"`

        - `ToolCallsStepDetails`

          Details of the tool call.

          - `tool_calls: Array<ToolCall>`

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

            - `CodeInterpreterToolCall`

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

              - `id: string`

                The ID of the tool call.

              - `code_interpreter: CodeInterpreter`

                The Code Interpreter tool call definition.

                - `input: string`

                  The input to the Code Interpreter tool call.

                - `outputs: Array<Logs | 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.

                  - `Logs`

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

                      - `"logs"`

                  - `Image`

                    - `image: Image`

                      - `file_id: string`

                        The [file](/api/reference/resources/files) ID of the image.

                    - `type: "image"`

                      Always `image`.

                      - `"image"`

              - `type: "code_interpreter"`

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

                - `"code_interpreter"`

            - `FileSearchToolCall`

              - `id: string`

                The ID of the tool call object.

              - `file_search: FileSearch`

                For now, this is always going to be an empty object.

                - `ranking_options?: RankingOptions`

                  The ranking options for the file search.

                  - `ranker: "auto" | "default_2024_08_21"`

                    The ranker to use for the file search. If not specified will use the `auto` ranker.

                    - `"auto"`

                    - `"default_2024_08_21"`

                  - `score_threshold: number`

                    The score threshold for the file search. All values must be a floating point number between 0 and 1.

                    `minimum: 0`, `maximum: 1`

                - `results?: Array<Result>`

                  The results of the file search.

                  - `file_id: string`

                    The ID of the file that result was found in.

                  - `file_name: string`

                    The name of the file that result was found in.

                  - `score: number`

                    The score of the result. All values must be a floating point number between 0 and 1.

                    `minimum: 0`, `maximum: 1`

                  - `content?: Array<Content>`

                    The content of the result that was found. The content is only included if requested via the include query parameter.

                    - `text?: string`

                      The text content of the file.

                    - `type?: "text"`

                      The type of the content.

                      - `"text"`

              - `type: "file_search"`

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

                - `"file_search"`

            - `FunctionToolCall`

              - `id: string`

                The ID of the tool call object.

              - `function: Function`

                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](/api/docs/assistants/migration) yet.

              - `type: "function"`

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

                - `"function"`

          - `type: "tool_calls"`

            Always `tool_calls`.

            - `"tool_calls"`

      - `thread_id: string`

        The ID of the [thread](/api/docs/assistants/migration) that was run.

      - `type: "message_creation" | "tool_calls"`

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

        - `"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).

    - `event: "thread.run.step.created"`

      - `"thread.run.step.created"`

  - `ThreadRunStepInProgress`

    Occurs when a [run step](/api/docs/assistants/migration) moves to an `in_progress` state.

    - `data: RunStep`

      Represents a step in execution of a run.

    - `event: "thread.run.step.in_progress"`

      - `"thread.run.step.in_progress"`

  - `ThreadRunStepDelta`

    Occurs when parts of a [run step](/api/docs/assistants/migration) are being streamed.

    - `data: RunStepDeltaEvent`

      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: RunStepDelta`

        The delta containing the fields that have changed on the run step.

        - `step_details?: RunStepDeltaMessageDelta | ToolCallDeltaObject`

          The details of the run step.

          - `RunStepDeltaMessageDelta`

            Details of the message creation by the run step.

            - `type: "message_creation"`

              Always `message_creation`.

              - `"message_creation"`

            - `message_creation?: MessageCreation`

              - `message_id?: string`

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

          - `ToolCallDeltaObject`

            Details of the tool call.

            - `type: "tool_calls"`

              Always `tool_calls`.

              - `"tool_calls"`

            - `tool_calls?: Array<ToolCallDelta>`

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

              - `CodeInterpreterToolCallDelta`

                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.

                  - `"code_interpreter"`

                - `id?: string`

                  The ID of the tool call.

                - `code_interpreter?: CodeInterpreter`

                  The Code Interpreter tool call definition.

                  - `input?: string`

                    The input to the Code Interpreter tool call.

                  - `outputs?: Array<CodeInterpreterLogs | CodeInterpreterOutputImage>`

                    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.

                    - `CodeInterpreterLogs`

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

                      - `logs?: string`

                        The text output from the Code Interpreter tool call.

                    - `CodeInterpreterOutputImage`

                      - `index: number`

                        The index of the output in the outputs array.

                      - `type: "image"`

                        Always `image`.

                        - `"image"`

                      - `image?: Image`

                        - `file_id?: string`

                          The [file](/api/reference/resources/files) ID of the image.

              - `FileSearchToolCallDelta`

                - `file_search: unknown`

                  For now, this is always going to be an empty object.

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

                  - `"file_search"`

                - `id?: string`

                  The ID of the tool call object.

              - `FunctionToolCallDelta`

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

                  - `"function"`

                - `id?: string`

                  The ID of the tool call object.

                - `function?: Function`

                  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](/api/docs/assistants/migration) yet.

      - `object: "thread.run.step.delta"`

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

        - `"thread.run.step.delta"`

    - `event: "thread.run.step.delta"`

      - `"thread.run.step.delta"`

  - `ThreadRunStepCompleted`

    Occurs when a [run step](/api/docs/assistants/migration) is completed.

    - `data: RunStep`

      Represents a step in execution of a run.

    - `event: "thread.run.step.completed"`

      - `"thread.run.step.completed"`

  - `ThreadRunStepFailed`

    Occurs when a [run step](/api/docs/assistants/migration) fails.

    - `data: RunStep`

      Represents a step in execution of a run.

    - `event: "thread.run.step.failed"`

      - `"thread.run.step.failed"`

  - `ThreadRunStepCancelled`

    Occurs when a [run step](/api/docs/assistants/migration) is cancelled.

    - `data: RunStep`

      Represents a step in execution of a run.

    - `event: "thread.run.step.cancelled"`

      - `"thread.run.step.cancelled"`

  - `ThreadRunStepExpired`

    Occurs when a [run step](/api/docs/assistants/migration) expires.

    - `data: RunStep`

      Represents a step in execution of a run.

    - `event: "thread.run.step.expired"`

      - `"thread.run.step.expired"`

### Run Stream Event

- `RunStreamEvent = ThreadRunCreated | ThreadRunQueued | ThreadRunInProgress | 7 more`

  Occurs when a new [run](/api/docs/assistants/migration) is created.

  - `ThreadRunCreated`

    Occurs when a new [run](/api/docs/assistants/migration) is created.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

      - `id: string`

        The identifier, which can be referenced in API endpoints.

      - `assistant_id: string`

        The ID of the [assistant](/api/docs/assistants/migration) used for execution of this run.

      - `cancelled_at: number | null`

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

        `format: unixtime`

      - `completed_at: number | null`

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

        `format: unixtime`

      - `created_at: number`

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

        `format: unixtime`

      - `expires_at: number | null`

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

        `format: unixtime`

      - `failed_at: number | null`

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

        `format: unixtime`

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

          - `"max_completion_tokens"`

          - `"max_prompt_tokens"`

      - `instructions: string`

        The instructions that the [assistant](/api/docs/assistants/migration) 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`.

          - `"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.

        `minimum: 256`

      - `max_prompt_tokens: number | null`

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

        `minimum: 256`

      - `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](/api/docs/assistants/migration) used for this run.

      - `object: "thread.run"`

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

        - `"thread.run"`

      - `parallel_tool_calls: boolean`

        Whether to enable [parallel function calling](/api/docs/guides/function-calling#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`

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

          - `tool_calls: Array<RequiredActionFunctionToolCall>`

            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](/api/docs/assistants/migration) endpoint.

            - `function: Function`

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

              - `"function"`

        - `type: "submit_tool_outputs"`

          For now, this is always `submit_tool_outputs`.

          - `"submit_tool_outputs"`

      - `response_format: AssistantResponseFormatOption | null`

        Specifies the format that the model must output. Compatible with [GPT-4o](/api/docs/models/gpt-4o), [GPT-4 Turbo](/api/docs/models/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](/api/docs/guides/structured-outputs).

        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.

        - `"auto"`

          - `"auto"`

        - `ResponseFormatText`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `ResponseFormatJSONObject`

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

            - `"json_object"`

        - `ResponseFormatJSONSchema`

          JSON Schema response format. Used to generate structured JSON responses.
          Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

          - `json_schema: JSONSchema`

            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](https://json-schema.org/).

            - `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](/api/docs/guides/structured-outputs).

          - `type: "json_schema"`

            The type of response format being defined. Always `json_schema`.

            - `"json_schema"`

      - `started_at: number | null`

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

        `format: unixtime`

      - `status: RunStatus`

        The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`.

        - `"queued"`

        - `"in_progress"`

        - `"requires_action"`

        - `"cancelling"`

        - `"cancelled"`

        - `"failed"`

        - `"completed"`

        - `"incomplete"`

        - `"expired"`

      - `thread_id: string`

        The ID of the [thread](/api/docs/assistants/migration) 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.

        - `"none" | "auto" | "required"`

          - `"none"`

          - `"auto"`

          - `"required"`

        - `AssistantToolChoice`

          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

            - `"function"`

            - `"code_interpreter"`

            - `"file_search"`

          - `function?: AssistantToolChoiceFunction`

            - `name: string`

              The name of the function to call.

      - `tools: Array<AssistantTool>`

        The list of tools that the [assistant](/api/docs/assistants/migration) used for this run.

        `maxItems: 20`

        - `CodeInterpreterTool`

          - `type: "code_interpreter"`

            The type of tool being defined: `code_interpreter`

            - `"code_interpreter"`

        - `FileSearchTool`

          - `type: "file_search"`

            The type of tool being defined: `file_search`

            - `"file_search"`

          - `file_search?: FileSearch`

            Overrides for the file search tool.

            - `max_num_results?: number`

              The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.

              Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

              `minimum: 1`, `maximum: 50`

            - `ranking_options?: RankingOptions`

              The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.

              See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

              - `score_threshold: number`

                The score threshold for the file search. All values must be a floating point number between 0 and 1.

                `minimum: 0`, `maximum: 1`

              - `ranker?: "auto" | "default_2024_08_21"`

                The ranker to use for the file search. If not specified will use the `auto` ranker.

                - `"auto"`

                - `"default_2024_08_21"`

        - `FunctionTool`

          - `function: FunctionDefinition`

            - `name: string`

              The name of the function to be called. 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 function does, used by the model to choose when and how to call the function.

            - `parameters?: FunctionParameters`

              The parameters the functions accepts, described as a JSON Schema object. See the [guide](/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.

              Omitting `parameters` defines a function with an empty parameter list.

            - `strict?: boolean | null`

              Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](/api/docs/guides/function-calling).

          - `type: "function"`

            The type of tool being defined: `function`

            - `"function"`

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

          - `"auto"`

          - `"last_messages"`

        - `last_messages?: number | null`

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

          `minimum: 1`

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

    - `event: "thread.run.created"`

      - `"thread.run.created"`

  - `ThreadRunQueued`

    Occurs when a [run](/api/docs/assistants/migration) moves to a `queued` status.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.queued"`

      - `"thread.run.queued"`

  - `ThreadRunInProgress`

    Occurs when a [run](/api/docs/assistants/migration) moves to an `in_progress` status.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.in_progress"`

      - `"thread.run.in_progress"`

  - `ThreadRunRequiresAction`

    Occurs when a [run](/api/docs/assistants/migration) moves to a `requires_action` status.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.requires_action"`

      - `"thread.run.requires_action"`

  - `ThreadRunCompleted`

    Occurs when a [run](/api/docs/assistants/migration) is completed.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.completed"`

      - `"thread.run.completed"`

  - `ThreadRunIncomplete`

    Occurs when a [run](/api/docs/assistants/migration) ends with status `incomplete`.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.incomplete"`

      - `"thread.run.incomplete"`

  - `ThreadRunFailed`

    Occurs when a [run](/api/docs/assistants/migration) fails.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.failed"`

      - `"thread.run.failed"`

  - `ThreadRunCancelling`

    Occurs when a [run](/api/docs/assistants/migration) moves to a `cancelling` status.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.cancelling"`

      - `"thread.run.cancelling"`

  - `ThreadRunCancelled`

    Occurs when a [run](/api/docs/assistants/migration) is cancelled.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.cancelled"`

      - `"thread.run.cancelled"`

  - `ThreadRunExpired`

    Occurs when a [run](/api/docs/assistants/migration) expires.

    - `data: Run`

      Represents an execution run on a [thread](/api/docs/assistants/migration).

    - `event: "thread.run.expired"`

      - `"thread.run.expired"`

### Thread Stream Event

- `ThreadStreamEvent`

  Occurs when a new [thread](/api/docs/assistants/migration) is created.

  - `data: Thread`

    Represents a thread that contains [messages](/api/docs/assistants/migration).

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

      `format: unixtime`

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

      - `"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?: Array<string>`

          A list of [file](/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.

          `maxItems: 20`

      - `file_search?: FileSearch`

        - `vector_store_ids?: Array<string>`

          The [vector store](/api/reference/resources/vector_stores) attached to this thread. There can be a maximum of 1 vector store attached to the thread.

          `maxItems: 1`

  - `event: "thread.created"`

    - `"thread.created"`

  - `enabled?: boolean`

    Whether to enable input audio transcription.

# ChatKit

## Domain Types

### ChatKit Workflow

- `ChatKitWorkflow`

  Workflow metadata and state returned for the session.

  - `id: string`

    Identifier of the workflow backing the session.

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

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

    - `string`

    - `number`

    - `boolean`

    - `number`

  - `tracing: Tracing`

    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.

# Sessions

## Cancel a ChatKit session

`client.beta.chatkit.sessions.cancel(stringsessionID, RequestOptionsoptions?): ChatSession`

**post** `/chatkit/sessions/{session_id}/cancel`

Cancel an active ChatKit session and return its most recent metadata.

Cancelling prevents new requests from using the issued client secret.

### Parameters

- `sessionID: string`

### Returns

- `ChatSession`

  Represents a ChatKit session and its resolved configuration.

  - `id: string`

    Identifier for the ChatKit session.

  - `chatkit_configuration: ChatSessionChatKitConfiguration`

    Resolved ChatKit feature configuration for the session.

    - `automatic_thread_titling: ChatSessionAutomaticThreadTitling`

      Automatic thread titling preferences.

      - `enabled: boolean`

        Whether automatic thread titling is enabled.

    - `file_upload: ChatSessionFileUpload`

      Upload settings for 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.

    - `history: ChatSessionHistory`

      History retention configuration.

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

  - `client_secret: string`

    Ephemeral client secret that authenticates session requests.

  - `expires_at: number`

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

    `format: unixtime`

  - `max_requests_per_1_minute: number`

    Convenience copy of the per-minute request limit.

  - `object: "chatkit.session"`

    Type discriminator that is always `chatkit.session`.

    - `"chatkit.session"`

  - `rate_limits: ChatSessionRateLimits`

    Resolved rate limit values.

    - `max_requests_per_1_minute: number`

      Maximum allowed requests per one-minute window.

  - `status: ChatSessionStatus`

    Current lifecycle state of the session.

    - `"active"`

    - `"expired"`

    - `"cancelled"`

  - `user: string`

    User identifier associated with the session.

  - `workflow: ChatKitWorkflow`

    Workflow metadata for the session.

    - `id: string`

      Identifier of the workflow backing the session.

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

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

      - `string`

      - `number`

      - `boolean`

      - `number`

    - `tracing: Tracing`

      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.

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const chatSession = await client.beta.chatkit.sessions.cancel('cksess_123');

console.log(chatSession.id);
```

#### 200 — Example

```json
{
  "id": "cksess_123",
  "object": "chatkit.session",
  "client_secret": "",
  "expires_at": 1712349876,
  "workflow": {
    "id": "workflow_alpha",
    "version": "2024-10-01",
    "state_variables": {
      "message": "hello"
    },
    "tracing": {
      "enabled": true
    }
  },
  "user": "user_789",
  "rate_limits": {
    "max_requests_per_1_minute": 60
  },
  "max_requests_per_1_minute": 60,
  "status": "cancelled",
  "chatkit_configuration": {
    "automatic_thread_titling": {
      "enabled": true
    },
    "file_upload": {
      "enabled": true,
      "max_file_size": 16,
      "max_files": 20
    },
    "history": {
      "enabled": true,
      "recent_threads": 10
    }
  }
}
```

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI();

const chatSession = await client.beta.chatkit.sessions.cancel('cksess_123');

console.log(chatSession.id);
```

#### Response example

```json
{
  "id": "cksess_123",
  "object": "chatkit.session",
  "client_secret": "",
  "expires_at": 1735689600,
  "workflow": {
    "id": "workflow_alpha",
    "version": null,
    "state_variables": null,
    "tracing": {
      "enabled": true
    }
  },
  "user": "user_123",
  "rate_limits": {
    "max_requests_per_1_minute": 10
  },
  "max_requests_per_1_minute": 10,
  "status": "cancelled",
  "chatkit_configuration": {
    "automatic_thread_titling": {
      "enabled": true
    },
    "file_upload": {
      "enabled": false,
      "max_file_size": 512,
      "max_files": 10
    },
    "history": {
      "enabled": true,
      "recent_threads": null
    }
  }
}
```

## Create a ChatKit session

`client.beta.chatkit.sessions.create(SessionCreateParamsbody, RequestOptionsoptions?): ChatSession`

**post** `/chatkit/sessions`

Create a ChatKit session.

### Parameters

- `body: SessionCreateParams`

  - `user: string`

    A free-form string that identifies your end user; ensures this Session can access other objects that have the same `user` scope.

    `minLength: 1`

  - `workflow: ChatSessionWorkflowParam`

    Workflow that powers the session.

    - `id: string`

      Identifier for the workflow invoked by the session.

    - `state_variables?: Record<string, string | number | 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.

      - `string`

      - `number`

      - `boolean`

      - `number`

    - `tracing?: Tracing`

      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.

  - `chatkit_configuration?: ChatSessionChatKitConfigurationParam`

    Optional overrides for ChatKit runtime configuration features

    - `automatic_thread_titling?: AutomaticThreadTitling`

      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`

      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.

        `minimum: 1`, `maximum: 512`

      - `max_files?: number`

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

        `minimum: 1`

    - `history?: History`

      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.

        `minimum: 1`

  - `expires_after?: ChatSessionExpiresAfterParam`

    Optional override for session expiration timing in seconds from creation. Defaults to 10 minutes.

    - `anchor: "created_at"`

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

      - `"created_at"`

    - `seconds: number`

      Number of seconds after the anchor when the session expires.

      `format: int64`, `minimum: 1`, `maximum: 600`

  - `rate_limits?: ChatSessionRateLimitsParam`

    Optional override for per-minute request limits. When omitted, defaults to 10.

    - `max_requests_per_1_minute?: number`

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

      `minimum: 1`

### Returns

- `ChatSession`

  Represents a ChatKit session and its resolved configuration.

  - `id: string`

    Identifier for the ChatKit session.

  - `chatkit_configuration: ChatSessionChatKitConfiguration`

    Resolved ChatKit feature configuration for the session.

    - `automatic_thread_titling: ChatSessionAutomaticThreadTitling`

      Automatic thread titling preferences.

      - `enabled: boolean`

        Whether automatic thread titling is enabled.

    - `file_upload: ChatSessionFileUpload`

      Upload settings for 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.

    - `history: ChatSessionHistory`

      History retention configuration.

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

  - `client_secret: string`

    Ephemeral client secret that authenticates session requests.

  - `expires_at: number`

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

    `format: unixtime`

  - `max_requests_per_1_minute: number`

    Convenience copy of the per-minute request limit.

  - `object: "chatkit.session"`

    Type discriminator that is always `chatkit.session`.

    - `"chatkit.session"`

  - `rate_limits: ChatSessionRateLimits`

    Resolved rate limit values.

    - `max_requests_per_1_minute: number`

      Maximum allowed requests per one-minute window.

  - `status: ChatSessionStatus`

    Current lifecycle state of the session.

    - `"active"`

    - `"expired"`

    - `"cancelled"`

  - `user: string`

    User identifier associated with the session.

  - `workflow: ChatKitWorkflow`

    Workflow metadata for the session.

    - `id: string`

      Identifier of the workflow backing the session.

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

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

      - `string`

      - `number`

      - `boolean`

      - `number`

    - `tracing: Tracing`

      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.

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const chatSession = await client.beta.chatkit.sessions.create({
  user: 'x',
  workflow: { id: 'id' },
});

console.log(chatSession.id);
```

#### 200 — Example

```json
{
  "id": "cksess_123",
  "chatkit_configuration": {
    "automatic_thread_titling": {
      "enabled": true
    },
    "file_upload": {
      "enabled": true,
      "max_file_size": 16,
      "max_files": 20
    },
    "history": {
      "enabled": true,
      "recent_threads": 10
    }
  },
  "client_secret": "ek_token_123",
  "expires_at": 1712349876,
  "max_requests_per_1_minute": 60,
  "object": "chatkit.session",
  "rate_limits": {
    "max_requests_per_1_minute": 60
  },
  "status": "active",
  "user": "user_789",
  "workflow": {
    "id": "workflow_alpha",
    "state_variables": {
      "message": "hello"
    },
    "tracing": {
      "enabled": true
    },
    "version": "2024-10-01"
  }
}
```

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI();

const chatSession = await client.beta.chatkit.sessions.create({ user: 'user_123', workflow: { id: 'workflow_alpha' } });

console.log(chatSession.id);
```

#### Response example

```json
{
  "id": "cksess_123",
  "object": "chatkit.session",
  "client_secret": "ek_example_00eyJleHBpcmVzX2F0IjogMTczNTY4OTYwMH0=",
  "expires_at": 1735689600,
  "workflow": {
    "id": "workflow_alpha",
    "version": null,
    "state_variables": null,
    "tracing": {
      "enabled": true
    }
  },
  "user": "user_123",
  "rate_limits": {
    "max_requests_per_1_minute": 10
  },
  "max_requests_per_1_minute": 10,
  "status": "active",
  "chatkit_configuration": {
    "automatic_thread_titling": {
      "enabled": true
    },
    "file_upload": {
      "enabled": false,
      "max_file_size": 512,
      "max_files": 10
    },
    "history": {
      "enabled": true,
      "recent_threads": null
    }
  }
}
```

# Threads

## Delete a ChatKit thread

`client.beta.chatkit.threads.delete(stringthreadID, RequestOptionsoptions?): ThreadDeleteResponse`

**delete** `/chatkit/threads/{thread_id}`

Delete a ChatKit thread along with its items and stored attachments.

### Parameters

- `threadID: string`

### Returns

- `ThreadDeleteResponse`

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

    - `"chatkit.thread.deleted"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const thread = await client.beta.chatkit.threads.delete('cthr_123');

console.log(thread.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "deleted": true,
  "object": "chatkit.thread.deleted"
}
```

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI();

const thread = await client.beta.chat_kit.threads.delete('cthr_123');

console.log(thread.id);
```

#### Response example

```json
{
  "id": "cthr_123",
  "object": "chatkit.thread.deleted",
  "deleted": true
}
```

## List ChatKit threads

`client.beta.chatkit.threads.list(ThreadListParamsquery?, RequestOptionsoptions?): ConversationCursorPage<ChatKitThread>`

**get** `/chatkit/threads`

List ChatKit threads with optional pagination and user filters.

### Parameters

- `query: ThreadListParams`

  - `after?: string`

    List items created after this thread item ID. Defaults to null for the first page.

  - `before?: string`

    List items created before this thread item ID. Defaults to null for the newest results.

  - `limit?: number`

    Maximum number of thread items to return. Defaults to 20.

    `minimum: 0`, `maximum: 100`

  - `order?: "asc" | "desc"`

    Sort order for results by creation time. Defaults to `desc`.

    - `"asc"`

    - `"desc"`

  - `user?: string`

    Filter threads that belong to this user identifier. Defaults to null to return all users.

    `minLength: 1`, `maxLength: 512`

### Returns

- `ChatKitThread`

  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.

    `format: unixtime`

  - `object: "chatkit.thread"`

    Type discriminator that is always `chatkit.thread`.

    - `"chatkit.thread"`

  - `status: Active | Locked | Closed`

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

    - `Active`

      Indicates that a thread is active.

      - `type: "active"`

        Status discriminator that is always `active`.

        - `"active"`

    - `Locked`

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

        - `"locked"`

    - `Closed`

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

        - `"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.

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const chatkitThread of client.beta.chatkit.threads.list()) {
  console.log(chatkitThread.id);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "cthr_def456",
      "created_at": 1712345600,
      "object": "chatkit.thread",
      "status": {
        "type": "active"
      },
      "title": "Demo feedback",
      "user": "user_456"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI();

// Automatically fetches more pages as needed.
for await (const chatkitThread of client.beta.chatkit.threads.list()) {
  console.log(chatkitThread.id);
}
```

#### Response example

```json
{
  "data": [
    {
      "id": "cthr_abc123",
      "object": "chatkit.thread",
      "title": "Customer escalation",
      "created_at": 1712345600,
      "status": {
        "type": "active"
      },
      "user": "user_123"
    },
    {
      "id": "cthr_def456",
      "object": "chatkit.thread",
      "title": "Demo feedback",
      "created_at": 1712345600,
      "status": {
        "type": "active"
      },
      "user": "user_456"
    }
  ],
  "has_more": false,
  "object": "list",
  "first_id": "cthr_abc123",
  "last_id": "cthr_def456"
}
```

## List ChatKit thread items

`client.beta.chatkit.threads.listItems(stringthreadID, ThreadListItemsParamsquery?, RequestOptionsoptions?): ConversationCursorPage<ChatKitThreadUserMessageItem | ChatKitThreadAssistantMessageItem | ChatKitWidgetItem | 3 more>`

**get** `/chatkit/threads/{thread_id}/items`

List items that belong to a ChatKit thread.

### Parameters

- `threadID: string`

- `query: ThreadListItemsParams`

  - `after?: string`

    List items created after this thread item ID. Defaults to null for the first page.

  - `before?: string`

    List items created before this thread item ID. Defaults to null for the newest results.

  - `limit?: number`

    Maximum number of thread items to return. Defaults to 20.

    `minimum: 0`, `maximum: 100`

  - `order?: "asc" | "desc"`

    Sort order for results by creation time. Defaults to `desc`.

    - `"asc"`

    - `"desc"`

### Returns

- `Data = ChatKitThreadUserMessageItem | ChatKitThreadAssistantMessageItem | ChatKitWidgetItem | 3 more`

  User-authored messages within a thread.

  - `ChatKitThreadUserMessageItem`

    User-authored messages within a thread.

    - `id: string`

      Identifier of the thread item.

    - `attachments: Array<ChatKitAttachment>`

      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.

        `format: uri`

      - `type: "image" | "file"`

        Attachment discriminator.

        - `"image"`

        - `"file"`

    - `content: Array<InputText | QuotedText>`

      Ordered content elements supplied by the user.

      - `InputText`

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

          - `"input_text"`

      - `QuotedText`

        Quoted snippet that the user referenced in their message.

        - `text: string`

          Quoted text content.

        - `type: "quoted_text"`

          Type discriminator that is always `quoted_text`.

          - `"quoted_text"`

    - `created_at: number`

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

      `format: unixtime`

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

      - `"chatkit.thread_item"`

    - `thread_id: string`

      Identifier of the parent thread.

    - `type: "chatkit.user_message"`

      - `"chatkit.user_message"`

  - `ChatKitThreadAssistantMessageItem`

    Assistant-authored message within a thread.

    - `id: string`

      Identifier of the thread item.

    - `content: Array<ChatKitResponseOutputText>`

      Ordered assistant response segments.

      - `annotations: Array<File | URL>`

        Ordered list of annotations attached to the response text.

        - `File`

          Annotation that references an uploaded file.

          - `source: Source`

            File attachment referenced by the annotation.

            - `filename: string`

              Filename referenced by the annotation.

            - `type: "file"`

              Type discriminator that is always `file`.

              - `"file"`

          - `type: "file"`

            Type discriminator that is always `file` for this annotation.

            - `"file"`

        - `URL`

          Annotation that references a URL.

          - `source: Source`

            URL referenced by the annotation.

            - `type: "url"`

              Type discriminator that is always `url`.

              - `"url"`

            - `url: string`

              URL referenced by the annotation.

              `format: uri`

          - `type: "url"`

            Type discriminator that is always `url` for this annotation.

            - `"url"`

      - `text: string`

        Assistant generated text.

      - `type: "output_text"`

        Type discriminator that is always `output_text`.

        - `"output_text"`

    - `created_at: number`

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

      `format: unixtime`

    - `object: "chatkit.thread_item"`

      Type discriminator that is always `chatkit.thread_item`.

      - `"chatkit.thread_item"`

    - `thread_id: string`

      Identifier of the parent thread.

    - `type: "chatkit.assistant_message"`

      Type discriminator that is always `chatkit.assistant_message`.

      - `"chatkit.assistant_message"`

  - `ChatKitWidgetItem`

    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.

      `format: unixtime`

    - `object: "chatkit.thread_item"`

      Type discriminator that is always `chatkit.thread_item`.

      - `"chatkit.thread_item"`

    - `thread_id: string`

      Identifier of the parent thread.

    - `type: "chatkit.widget"`

      Type discriminator that is always `chatkit.widget`.

      - `"chatkit.widget"`

    - `widget: string`

      Serialized widget payload rendered in the UI.

  - `ChatKitClientToolCall`

    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.

      `format: unixtime`

    - `name: string`

      Tool name that was invoked.

    - `object: "chatkit.thread_item"`

      Type discriminator that is always `chatkit.thread_item`.

      - `"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.

      - `"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`.

      - `"chatkit.client_tool_call"`

  - `ChatKitTask`

    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.

      `format: unixtime`

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

      - `"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.

      - `"custom"`

      - `"thought"`

    - `thread_id: string`

      Identifier of the parent thread.

    - `type: "chatkit.task"`

      Type discriminator that is always `chatkit.task`.

      - `"chatkit.task"`

  - `ChatKitTaskGroup`

    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.

      `format: unixtime`

    - `object: "chatkit.thread_item"`

      Type discriminator that is always `chatkit.thread_item`.

      - `"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.

        - `"custom"`

        - `"thought"`

    - `thread_id: string`

      Identifier of the parent thread.

    - `type: "chatkit.task_group"`

      Type discriminator that is always `chatkit.task_group`.

      - `"chatkit.task_group"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const thread of client.beta.chatkit.threads.listItems('cthr_123')) {
  console.log(thread);
}
```

#### 200 — Example

```json
{
  "data": [
    {
      "id": "id",
      "attachments": [
        {
          "id": "id",
          "mime_type": "mime_type",
          "name": "name",
          "preview_url": "https://example.com",
          "type": "image"
        }
      ],
      "content": [
        {
          "text": "text",
          "type": "input_text"
        }
      ],
      "created_at": 0,
      "inference_options": {
        "model": "model",
        "tool_choice": {
          "id": "id"
        }
      },
      "object": "chatkit.thread_item",
      "thread_id": "thread_id",
      "type": "chatkit.user_message"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI();

// Automatically fetches more pages as needed.
for await (const thread of client.beta.chatkit.threads.listItems('cthr_123')) {
  console.log(thread);
}
```

#### Response example

```json
{
  "data": [
    {
      "id": "cthi_user_001",
      "object": "chatkit.thread_item",
      "type": "chatkit.user_message",
      "content": [
        {
          "type": "input_text",
          "text": "I need help debugging an onboarding issue."
        }
      ],
      "attachments": [],
      "created_at": 1712345600,
      "thread_id": "cthr_abc123",
      "inference_options": null
    },
    {
      "id": "cthi_assistant_002",
      "object": "chatkit.thread_item",
      "type": "chatkit.assistant_message",
      "content": [
        {
          "type": "output_text",
          "text": "Let's start by confirming the workflow version you deployed.",
          "annotations": []
        }
      ],
      "created_at": 1712345601,
      "thread_id": "cthr_abc123"
    }
  ],
  "has_more": false,
  "object": "list",
  "first_id": "cthi_user_001",
  "last_id": "cthi_assistant_002"
}
```

## Retrieve a ChatKit thread

`client.beta.chatkit.threads.retrieve(stringthreadID, RequestOptionsoptions?): ChatKitThread`

**get** `/chatkit/threads/{thread_id}`

Retrieve a ChatKit thread by its identifier.

### Parameters

- `threadID: string`

### Returns

- `ChatKitThread`

  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.

    `format: unixtime`

  - `object: "chatkit.thread"`

    Type discriminator that is always `chatkit.thread`.

    - `"chatkit.thread"`

  - `status: Active | Locked | Closed`

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

    - `Active`

      Indicates that a thread is active.

      - `type: "active"`

        Status discriminator that is always `active`.

        - `"active"`

    - `Locked`

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

        - `"locked"`

    - `Closed`

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

        - `"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.

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const chatkitThread = await client.beta.chatkit.threads.retrieve('cthr_123');

console.log(chatkitThread.id);
```

#### 200 — Example

```json
{
  "id": "cthr_def456",
  "created_at": 1712345600,
  "object": "chatkit.thread",
  "status": {
    "type": "active"
  },
  "title": "Demo feedback",
  "user": "user_456"
}
```

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI();

const chatkitThread = await client.beta.chatkit.threads.retrieve('cthr_123');

console.log(chatkitThread.id);
```

#### Response example

```json
{
  "id": "cthr_abc123",
  "object": "chatkit.thread",
  "title": "Customer escalation",
  "created_at": 1712345600,
  "status": {
    "type": "active"
  },
  "user": "user_123"
}
```

## Domain Types

### Chat Session

- `ChatSession`

  Represents a ChatKit session and its resolved configuration.

  - `id: string`

    Identifier for the ChatKit session.

  - `chatkit_configuration: ChatSessionChatKitConfiguration`

    Resolved ChatKit feature configuration for the session.

    - `automatic_thread_titling: ChatSessionAutomaticThreadTitling`

      Automatic thread titling preferences.

      - `enabled: boolean`

        Whether automatic thread titling is enabled.

    - `file_upload: ChatSessionFileUpload`

      Upload settings for 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.

    - `history: ChatSessionHistory`

      History retention configuration.

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

  - `client_secret: string`

    Ephemeral client secret that authenticates session requests.

  - `expires_at: number`

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

    `format: unixtime`

  - `max_requests_per_1_minute: number`

    Convenience copy of the per-minute request limit.

  - `object: "chatkit.session"`

    Type discriminator that is always `chatkit.session`.

    - `"chatkit.session"`

  - `rate_limits: ChatSessionRateLimits`

    Resolved rate limit values.

    - `max_requests_per_1_minute: number`

      Maximum allowed requests per one-minute window.

  - `status: ChatSessionStatus`

    Current lifecycle state of the session.

    - `"active"`

    - `"expired"`

    - `"cancelled"`

  - `user: string`

    User identifier associated with the session.

  - `workflow: ChatKitWorkflow`

    Workflow metadata for the session.

    - `id: string`

      Identifier of the workflow backing the session.

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

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

      - `string`

      - `number`

      - `boolean`

      - `number`

    - `tracing: Tracing`

      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.

### Chat Session Automatic Thread Titling

- `ChatSessionAutomaticThreadTitling`

  Automatic thread title preferences for the session.

  - `enabled: boolean`

    Whether automatic thread titling is enabled.

### Chat Session ChatKit Configuration

- `ChatSessionChatKitConfiguration`

  ChatKit configuration for the session.

  - `automatic_thread_titling: ChatSessionAutomaticThreadTitling`

    Automatic thread titling preferences.

    - `enabled: boolean`

      Whether automatic thread titling is enabled.

  - `file_upload: ChatSessionFileUpload`

    Upload settings for 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.

  - `history: ChatSessionHistory`

    History retention configuration.

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

### Chat Session ChatKit Configuration Param

- `ChatSessionChatKitConfigurationParam`

  Optional per-session configuration settings for ChatKit behavior.

  - `automatic_thread_titling?: AutomaticThreadTitling`

    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`

    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.

      `minimum: 1`, `maximum: 512`

    - `max_files?: number`

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

      `minimum: 1`

  - `history?: History`

    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.

      `minimum: 1`

### Chat Session Expires After Param

- `ChatSessionExpiresAfterParam`

  Controls when the session expires relative to an anchor timestamp.

  - `anchor: "created_at"`

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

    - `"created_at"`

  - `seconds: number`

    Number of seconds after the anchor when the session expires.

    `format: int64`, `minimum: 1`, `maximum: 600`

### Chat Session File Upload

- `ChatSessionFileUpload`

  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.

### Chat Session History

- `ChatSessionHistory`

  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.

### Chat Session Rate Limits

- `ChatSessionRateLimits`

  Active per-minute request limit for the session.

  - `max_requests_per_1_minute: number`

    Maximum allowed requests per one-minute window.

### Chat Session Rate Limits Param

- `ChatSessionRateLimitsParam`

  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.

    `minimum: 1`

### Chat Session Status

- `ChatSessionStatus = "active" | "expired" | "cancelled"`

  - `"active"`

  - `"expired"`

  - `"cancelled"`

### Chat Session Workflow Param

- `ChatSessionWorkflowParam`

  Workflow reference and overrides applied to the chat session.

  - `id: string`

    Identifier for the workflow invoked by the session.

  - `state_variables?: Record<string, string | number | 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.

    - `string`

    - `number`

    - `boolean`

    - `number`

  - `tracing?: Tracing`

    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.

### ChatKit Attachment

- `ChatKitAttachment`

  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.

    `format: uri`

  - `type: "image" | "file"`

    Attachment discriminator.

    - `"image"`

    - `"file"`

### ChatKit Response Output Text

- `ChatKitResponseOutputText`

  Assistant response text accompanied by optional annotations.

  - `annotations: Array<File | URL>`

    Ordered list of annotations attached to the response text.

    - `File`

      Annotation that references an uploaded file.

      - `source: Source`

        File attachment referenced by the annotation.

        - `filename: string`

          Filename referenced by the annotation.

        - `type: "file"`

          Type discriminator that is always `file`.

          - `"file"`

      - `type: "file"`

        Type discriminator that is always `file` for this annotation.

        - `"file"`

    - `URL`

      Annotation that references a URL.

      - `source: Source`

        URL referenced by the annotation.

        - `type: "url"`

          Type discriminator that is always `url`.

          - `"url"`

        - `url: string`

          URL referenced by the annotation.

          `format: uri`

      - `type: "url"`

        Type discriminator that is always `url` for this annotation.

        - `"url"`

  - `text: string`

    Assistant generated text.

  - `type: "output_text"`

    Type discriminator that is always `output_text`.

    - `"output_text"`

### ChatKit Thread

- `ChatKitThread`

  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.

    `format: unixtime`

  - `object: "chatkit.thread"`

    Type discriminator that is always `chatkit.thread`.

    - `"chatkit.thread"`

  - `status: Active | Locked | Closed`

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

    - `Active`

      Indicates that a thread is active.

      - `type: "active"`

        Status discriminator that is always `active`.

        - `"active"`

    - `Locked`

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

        - `"locked"`

    - `Closed`

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

        - `"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.

### ChatKit Thread Assistant Message Item

- `ChatKitThreadAssistantMessageItem`

  Assistant-authored message within a thread.

  - `id: string`

    Identifier of the thread item.

  - `content: Array<ChatKitResponseOutputText>`

    Ordered assistant response segments.

    - `annotations: Array<File | URL>`

      Ordered list of annotations attached to the response text.

      - `File`

        Annotation that references an uploaded file.

        - `source: Source`

          File attachment referenced by the annotation.

          - `filename: string`

            Filename referenced by the annotation.

          - `type: "file"`

            Type discriminator that is always `file`.

            - `"file"`

        - `type: "file"`

          Type discriminator that is always `file` for this annotation.

          - `"file"`

      - `URL`

        Annotation that references a URL.

        - `source: Source`

          URL referenced by the annotation.

          - `type: "url"`

            Type discriminator that is always `url`.

            - `"url"`

          - `url: string`

            URL referenced by the annotation.

            `format: uri`

        - `type: "url"`

          Type discriminator that is always `url` for this annotation.

          - `"url"`

    - `text: string`

      Assistant generated text.

    - `type: "output_text"`

      Type discriminator that is always `output_text`.

      - `"output_text"`

  - `created_at: number`

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

    `format: unixtime`

  - `object: "chatkit.thread_item"`

    Type discriminator that is always `chatkit.thread_item`.

    - `"chatkit.thread_item"`

  - `thread_id: string`

    Identifier of the parent thread.

  - `type: "chatkit.assistant_message"`

    Type discriminator that is always `chatkit.assistant_message`.

    - `"chatkit.assistant_message"`

### ChatKit Thread Item List

- `ChatKitThreadItemList`

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

  - `data: Array<ChatKitThreadUserMessageItem | ChatKitThreadAssistantMessageItem | ChatKitWidgetItem | 3 more>`

    A list of items

    - `ChatKitThreadUserMessageItem`

      User-authored messages within a thread.

      - `id: string`

        Identifier of the thread item.

      - `attachments: Array<ChatKitAttachment>`

        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.

          `format: uri`

        - `type: "image" | "file"`

          Attachment discriminator.

          - `"image"`

          - `"file"`

      - `content: Array<InputText | QuotedText>`

        Ordered content elements supplied by the user.

        - `InputText`

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

            - `"input_text"`

        - `QuotedText`

          Quoted snippet that the user referenced in their message.

          - `text: string`

            Quoted text content.

          - `type: "quoted_text"`

            Type discriminator that is always `quoted_text`.

            - `"quoted_text"`

      - `created_at: number`

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

        `format: unixtime`

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

        - `"chatkit.thread_item"`

      - `thread_id: string`

        Identifier of the parent thread.

      - `type: "chatkit.user_message"`

        - `"chatkit.user_message"`

    - `ChatKitThreadAssistantMessageItem`

      Assistant-authored message within a thread.

      - `id: string`

        Identifier of the thread item.

      - `content: Array<ChatKitResponseOutputText>`

        Ordered assistant response segments.

        - `annotations: Array<File | URL>`

          Ordered list of annotations attached to the response text.

          - `File`

            Annotation that references an uploaded file.

            - `source: Source`

              File attachment referenced by the annotation.

              - `filename: string`

                Filename referenced by the annotation.

              - `type: "file"`

                Type discriminator that is always `file`.

                - `"file"`

            - `type: "file"`

              Type discriminator that is always `file` for this annotation.

              - `"file"`

          - `URL`

            Annotation that references a URL.

            - `source: Source`

              URL referenced by the annotation.

              - `type: "url"`

                Type discriminator that is always `url`.

                - `"url"`

              - `url: string`

                URL referenced by the annotation.

                `format: uri`

            - `type: "url"`

              Type discriminator that is always `url` for this annotation.

              - `"url"`

        - `text: string`

          Assistant generated text.

        - `type: "output_text"`

          Type discriminator that is always `output_text`.

          - `"output_text"`

      - `created_at: number`

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

        `format: unixtime`

      - `object: "chatkit.thread_item"`

        Type discriminator that is always `chatkit.thread_item`.

        - `"chatkit.thread_item"`

      - `thread_id: string`

        Identifier of the parent thread.

      - `type: "chatkit.assistant_message"`

        Type discriminator that is always `chatkit.assistant_message`.

        - `"chatkit.assistant_message"`

    - `ChatKitWidgetItem`

      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.

        `format: unixtime`

      - `object: "chatkit.thread_item"`

        Type discriminator that is always `chatkit.thread_item`.

        - `"chatkit.thread_item"`

      - `thread_id: string`

        Identifier of the parent thread.

      - `type: "chatkit.widget"`

        Type discriminator that is always `chatkit.widget`.

        - `"chatkit.widget"`

      - `widget: string`

        Serialized widget payload rendered in the UI.

    - `ChatKitClientToolCall`

      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.

        `format: unixtime`

      - `name: string`

        Tool name that was invoked.

      - `object: "chatkit.thread_item"`

        Type discriminator that is always `chatkit.thread_item`.

        - `"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.

        - `"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`.

        - `"chatkit.client_tool_call"`

    - `ChatKitTask`

      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.

        `format: unixtime`

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

        - `"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.

        - `"custom"`

        - `"thought"`

      - `thread_id: string`

        Identifier of the parent thread.

      - `type: "chatkit.task"`

        Type discriminator that is always `chatkit.task`.

        - `"chatkit.task"`

    - `ChatKitTaskGroup`

      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.

        `format: unixtime`

      - `object: "chatkit.thread_item"`

        Type discriminator that is always `chatkit.thread_item`.

        - `"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.

          - `"custom"`

          - `"thought"`

      - `thread_id: string`

        Identifier of the parent thread.

      - `type: "chatkit.task_group"`

        Type discriminator that is always `chatkit.task_group`.

        - `"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`.

    - `"list"`

### ChatKit Thread User Message Item

- `ChatKitThreadUserMessageItem`

  User-authored messages within a thread.

  - `id: string`

    Identifier of the thread item.

  - `attachments: Array<ChatKitAttachment>`

    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.

      `format: uri`

    - `type: "image" | "file"`

      Attachment discriminator.

      - `"image"`

      - `"file"`

  - `content: Array<InputText | QuotedText>`

    Ordered content elements supplied by the user.

    - `InputText`

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

        - `"input_text"`

    - `QuotedText`

      Quoted snippet that the user referenced in their message.

      - `text: string`

        Quoted text content.

      - `type: "quoted_text"`

        Type discriminator that is always `quoted_text`.

        - `"quoted_text"`

  - `created_at: number`

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

    `format: unixtime`

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

    - `"chatkit.thread_item"`

  - `thread_id: string`

    Identifier of the parent thread.

  - `type: "chatkit.user_message"`

    - `"chatkit.user_message"`

### ChatKit Widget Item

- `ChatKitWidgetItem`

  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.

    `format: unixtime`

  - `object: "chatkit.thread_item"`

    Type discriminator that is always `chatkit.thread_item`.

    - `"chatkit.thread_item"`

  - `thread_id: string`

    Identifier of the parent thread.

  - `type: "chatkit.widget"`

    Type discriminator that is always `chatkit.widget`.

    - `"chatkit.widget"`

  - `widget: string`

    Serialized widget payload rendered in the UI.

### Thread Delete Response

- `ThreadDeleteResponse`

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

    - `"chatkit.thread.deleted"`

# Responses

## Cancel a response

`client.beta.responses.cancel(stringresponseID, ResponseCancelParamsparams?, RequestOptionsoptions?): BetaResponse`

**post** `/responses/{response_id}/cancel?beta=true`

Cancels a model response with the given ID. Only responses created with
the `background` parameter set to `true` can be cancelled.
[Learn more](/api/docs/guides/background).

### Parameters

- `responseID: string`

- `params: ResponseCancelParams`

  - `betas?: Array<"responses_multi_agent=v1">`

    Optional beta features to enable for this request.

    - `"responses_multi_agent=v1"`

### Returns

- `BetaResponse`

  - `id: string`

    Unique identifier for this Response.

  - `access_programs: AccessPrograms | null`

    - `cyber: "standard" | "daybreak_blue" | "daybreak_red"`

      The effective Cyber access program used for this response.

      - `"standard"`

      - `"daybreak_blue"`

      - `"daybreak_red"`

  - `created_at: number`

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

    `format: unixtime`

  - `error: BetaResponseError | null`

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

    - `code: "server_error" | "rate_limit_exceeded" | "invalid_prompt" | 18 more`

      The error code for the response.

      - `"server_error"`

      - `"rate_limit_exceeded"`

      - `"invalid_prompt"`

      - `"data_residency_mismatch"`

      - `"bio_policy"`

      - `"misalignment_policy_violation"`

      - `"vector_store_timeout"`

      - `"invalid_image"`

      - `"invalid_image_format"`

      - `"invalid_base64_image"`

      - `"invalid_image_url"`

      - `"image_too_large"`

      - `"image_too_small"`

      - `"image_parse_error"`

      - `"image_content_policy_violation"`

      - `"invalid_image_mode"`

      - `"image_file_too_large"`

      - `"unsupported_image_media_type"`

      - `"empty_image_file"`

      - `"failed_to_download_image"`

      - `"image_file_not_found"`

    - `message: string`

      A human-readable description of the error.

    - `misalignment?: Misalignment`

      - `detailed_explanation?: string`

        The public explanation for this block.

      - `error_type?: (string & {}) | "potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

        An optional classification; clients must accept additional values.

        - `(string & {})`

        - `"potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

          - `"potentially_unintended_data_transfer"`

          - `"potentially_unintended_data_access"`

          - `"potentially_unintended_destructive_activity"`

          - `"other"`

      - `review_target?: string | null`

        An opaque target for explicitly continuing this review, or null when unavailable.

        `minLength: 1`, `maxLength: 96`

      - `steer?: Steer`

        An optional public continuation instruction.

        - `message: string`

          The public continuation instruction.

    - `param?: string | null`

      The request parameter associated with the error, or null if none was recorded.

    - `type?: string | null`

      The original error type, or null if it was not recorded.

  - `incomplete_details: IncompleteDetails | null`

    Details about why the response is incomplete.

    - `reason?: "max_output_tokens" | "max_messages" | "content_filter" | "steered"`

      The reason why the response is incomplete. `steered` means
      the response stopped at a safe output boundary after a
      WebSocket `response.steer` event. The server can then create
      a successor response automatically with the queued input.

      - `"max_output_tokens"`

      - `"max_messages"`

      - `"content_filter"`

      - `"steered"`

  - `instructions: string | Array<BetaResponseInputItem> | null`

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

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

    - `string`

    - `Array<BetaResponseInputItem>`

      - `BetaEasyInputMessage`

        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.

          - `string`

          - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

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

            - `BetaResponseInputText`

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

                - `"input_text"`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `detail: BetaImageDetail`

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

                - `"low"`

                - `"high"`

                - `"auto"`

                - `"original"`

              - `type: "input_image"`

                The type of the input item. Always `input_image`.

                - `"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.

                `format: uri`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFile`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"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`.

                - `"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.

                `format: uri`

              - `filename?: string`

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

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

        - `role: "user" | "assistant" | "system" | "developer"`

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

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"developer"`

        - `phase?: "commentary" | "final_answer" | 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.

          - `"commentary"`

          - `"final_answer"`

        - `type?: "message"`

          The type of the message input. Always `message`.

          - `"message"`

      - `Message`

        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.

        - `content: BetaResponseInputMessageContentList`

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

        - `role: "user" | "system" | "developer"`

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

          - `"user"`

          - `"system"`

          - `"developer"`

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

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

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type?: "message"`

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

          - `"message"`

      - `BetaResponseOutputMessage`

        An output message from the model.

        - `id: string`

          The unique ID of the output message.

        - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

          The content of the output message.

          - `BetaResponseOutputText`

            A text output from the model.

            - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

              The annotations of the text output.

              - `FileCitation`

                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 in the output text at which to insert the file citation.

                - `type: "file_citation"`

                  The type of the file citation. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation`

                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_citation"`

                - `url: string`

                  The URL of the web resource.

                  `format: uri`

              - `ContainerFileCitation`

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

                  - `"container_file_citation"`

              - `FilePath`

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

                  - `"file_path"`

            - `text: string`

              The text output from the model.

            - `type: "output_text"`

              The type of the output text. Always `output_text`.

              - `"output_text"`

            - `logprobs?: Array<Logprob>`

              - `token: string`

              - `bytes: Array<number>`

              - `logprob: number`

              - `top_logprobs: Array<TopLogprob>`

                - `token: string`

                - `bytes: Array<number>`

                - `logprob: number`

          - `BetaResponseOutputRefusal`

            A refusal from the model.

            - `refusal: string`

              The refusal explanation from the model.

            - `type: "refusal"`

              The type of the refusal. Always `refusal`.

              - `"refusal"`

        - `role: "assistant"`

          The role of the output message. Always `assistant`.

          - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "message"`

          The type of the output message. Always `message`.

          - `"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" | "final_answer" | 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.

          - `"commentary"`

          - `"final_answer"`

      - `BetaResponseFileSearchToolCall`

        The results of a file search tool call. See the
        [file search guide](/api/docs/guides/tools-file-search) 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`,

          - `"in_progress"`

          - `"searching"`

          - `"completed"`

          - `"incomplete"`

          - `"failed"`

        - `type: "file_search_call"`

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

          - `"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.

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

            `format: float`

          - `text?: string`

            The text that was retrieved from the file.

      - `BetaResponseComputerToolCall`

        A tool call to a computer use tool. See the
        [computer use guide](/api/docs/guides/tools-computer-use) 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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "computer_call"`

          The type of the computer call. Always `computer_call`.

          - `"computer_call"`

        - `action?: BetaComputerAction`

          A click action.

          - `Click`

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

              - `"left"`

              - `"right"`

              - `"wheel"`

              - `"back"`

              - `"forward"`

            - `type: "click"`

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

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

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

              - `"double_click"`

            - `x: number`

              The x-coordinate where the double click occurred.

            - `y: number`

              The y-coordinate where the double click occurred.

          - `Drag`

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

              - `"drag"`

            - `keys?: Array<string> | null`

              The keys being held while dragging the mouse.

          - `Keypress`

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

              - `"keypress"`

          - `Move`

            A mouse move action.

            - `type: "move"`

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

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

            A screenshot action.

            - `type: "screenshot"`

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

              - `"screenshot"`

          - `Scroll`

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

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

            An action to type in text.

            - `text: string`

              The text to type.

            - `type: "type"`

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

              - `"type"`

          - `Wait`

            A wait action.

            - `type: "wait"`

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

              - `"wait"`

        - `actions?: BetaComputerActionList`

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

          - `Click`

            A click action.

          - `DoubleClick`

            A double click action.

          - `Drag`

            A drag action.

          - `Keypress`

            A collection of keypresses the model would like to perform.

          - `Move`

            A mouse move action.

          - `Screenshot`

            A screenshot action.

          - `Scroll`

            A scroll action.

          - `Type`

            An action to type in text.

          - `Wait`

            A wait action.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput`

        The output of a computer tool call.

        - `call_id: string`

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

          `minLength: 1`, `maxLength: 64`

        - `output: BetaResponseComputerToolCallOutputScreenshot`

          A computer screenshot image used with the computer use tool.

          - `type: "computer_screenshot"`

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

            - `"computer_screenshot"`

          - `file_id?: string`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url?: string`

            The URL of the screenshot image.

            `format: uri`

        - `type: "computer_call_output"`

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

          - `"computer_call_output"`

        - `id?: string | null`

          The ID of the computer tool call output.

        - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

          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.

        - `status?: "in_progress" | "completed" | "incomplete" | null`

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

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseFunctionWebSearch`

        The results of a web search tool call. See the
        [web search guide](/api/docs/guides/tools-web-search) for more information.

        - `id: string`

          The unique ID of the web search tool call.

        - `action: Search | OpenPage | FindInPage`

          An object describing the specific action taken in this web search call.
          Includes details on how the model used the web (search, open_page, find_in_page).

          - `Search`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries?: Array<string>`

              The search queries.

            - `query?: string`

              The search query.

            - `sources?: Array<Source>`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

                `format: uri`

          - `OpenPage`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url?: string | null`

              The URL opened by the model.

              `format: uri`

          - `FindInPage`

            Action type "find_in_page": Searches for a pattern within a loaded page.

            - `pattern: string`

              The pattern or text to search for within the page.

            - `type: "find_in_page"`

              The action type.

              - `"find_in_page"`

            - `url: string`

              The URL of the page searched for the pattern.

              `format: uri`

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

          The status of the web search tool call.

          - `"in_progress"`

          - `"searching"`

          - `"completed"`

          - `"failed"`

          - `"incomplete"`

        - `type: "web_search_call"`

          The type of the web search tool call. Always `web_search_call`.

          - `"web_search_call"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseFunctionToolCall`

        A tool call to run a function. See the
        [function calling guide](/api/docs/guides/function-calling) 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`.

          - `"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.

        - `async?: boolean`

          Whether the function tool call runs asynchronously.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

            - `type: "program"`

              - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `FunctionCallOutput`

        The output of a function tool call.

        - `output: string | BetaResponseFunctionCallOutputItemList`

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

          - `string`

          - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

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

            - `BetaResponseInputTextContent`

              A text input to the model.

              - `text: string`

                The text input to the model.

                `maxLength: 10485760`

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImageContent`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

              - `type: "input_image"`

                The type of the input item. Always `input_image`.

                - `"input_image"`

              - `detail?: BetaImageDetail | null`

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

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

                `maxLength: 20971520`, `format: uri`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFileContent`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"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`.

                - `"auto"`

                - `"low"`

                - `"high"`

              - `file_data?: string | null`

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

                `maxLength: 73400320`

              - `file_id?: string | null`

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

              - `file_url?: string | null`

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

                `format: uri`

              - `filename?: string | null`

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

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

        - `type: "function_call_output"`

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

          - `"function_call_output"`

        - `id?: string | null`

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

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

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

          `minLength: 1`, `maxLength: 64`

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `name?: string | null`

          The name of the tool that produced the output.

          `minLength: 1`, `maxLength: 128`

        - `namespace?: string | null`

          The namespace of the tool that produced the output.

          `minLength: 1`, `maxLength: 128`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

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

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AgentMessage`

        A message routed between agents.

        - `author: string`

          The sending agent identity.

        - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

          Plaintext, image, or encrypted content sent between agents.

          - `BetaResponseInputTextContent`

            A text input to the model.

          - `BetaResponseInputImageContent`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

          - `EncryptedContent`

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

            - `encrypted_content: string`

              Opaque encrypted content.

              `maxLength: 10485760`

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

        - `id?: string | null`

          The unique ID of this agent message item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall`

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

          The multi-agent action that was executed.

          - `"spawn_agent"`

          - `"interrupt_agent"`

          - `"list_agents"`

          - `"send_message"`

          - `"followup_task"`

          - `"wait_agent"`

        - `arguments: string`

          The action arguments as a JSON string.

        - `call_id: string`

          The unique ID linking this call to its output.

          `minLength: 1`, `maxLength: 64`

        - `type: "multi_agent_call"`

          The item type. Always `multi_agent_call`.

          - `"multi_agent_call"`

        - `id?: string | null`

          The unique ID of this multi-agent call.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput`

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

          The multi-agent action that produced this result.

          - `"spawn_agent"`

          - `"interrupt_agent"`

          - `"list_agents"`

          - `"send_message"`

          - `"followup_task"`

          - `"wait_agent"`

        - `call_id: string`

          The unique ID of the multi-agent call.

          `minLength: 1`, `maxLength: 64`

        - `output: Array<Output>`

          Text output returned by the multi-agent action.

          - `text: string`

            The text content.

            `maxLength: 10485760`

          - `type: "output_text"`

            The content type. Always `output_text`.

            - `"output_text"`

          - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

            Citations associated with the text content.

            - `FileCitation`

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

                `minimum: 0`

              - `type: "file_citation"`

                The citation type. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation`

              - `end_index: number`

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

                `minimum: 0`

              - `start_index: number`

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

                `minimum: 0`

              - `title: string`

                The title of the cited resource.

              - `type: "url_citation"`

                The citation type. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the cited resource.

                `format: uri`

            - `ContainerFileCitation`

              - `container_id: string`

                The ID of the container.

              - `end_index: number`

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

                `minimum: 0`

              - `file_id: string`

                The ID of the container file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

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

                `minimum: 0`

              - `type: "container_file_citation"`

                The citation type. Always `container_file_citation`.

                - `"container_file_citation"`

        - `type: "multi_agent_call_output"`

          The item type. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `id?: string | null`

          The unique ID of this multi-agent call output.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall`

        - `arguments: unknown`

          The arguments supplied to the tool search call.

        - `type: "tool_search_call"`

          The item type. Always `tool_search_call`.

          - `"tool_search_call"`

        - `id?: string | null`

          The unique ID of this tool search call.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

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

          `minLength: 1`, `maxLength: 64`

        - `execution?: "server" | "client"`

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

          - `"server"`

          - `"client"`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the tool search call.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseToolSearchOutputItemParam`

        - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

          The loaded tool definitions returned by the tool search output.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

              - `"function"`

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

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

            - `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`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

            - `type: "file_search"`

              The type of the file search tool. Always `file_search`.

              - `"file_search"`

            - `vector_store_ids: Array<string>`

              The IDs of the vector stores to search.

            - `filters?: ComparisonFilter | CompoundFilter | null`

              A filter to apply.

              - `ComparisonFilter`

                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

                  - `"eq"`

                  - `"ne"`

                  - `"gt"`

                  - `"gte"`

                  - `"lt"`

                  - `"lte"`

                  - `"in"`

                  - `"nin"`

                - `value: string | number | boolean | Array<string | number>`

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

                  - `string`

                  - `number`

                  - `boolean`

                  - `Array<string | number>`

                    - `string`

                    - `number`

              - `CompoundFilter`

                Combine multiple filters using `and` or `or`.

                - `filters: Array<ComparisonFilter | unknown>`

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

                  - `ComparisonFilter`

                    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

                      - `"eq"`

                      - `"ne"`

                      - `"gt"`

                      - `"gte"`

                      - `"lt"`

                      - `"lte"`

                      - `"in"`

                      - `"nin"`

                    - `value: string | number | boolean | Array<string | number>`

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

                      - `string`

                      - `number`

                      - `boolean`

                      - `Array<string | number>`

                        - `string`

                        - `number`

                  - `unknown`

                - `type: "and" | "or"`

                  Type of operation: `and` or `or`.

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

              Ranking options for search.

              - `hybrid_search?: HybridSearch`

                Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

                - `embedding_weight: number`

                  The weight of the embedding in the reciprocal ranking fusion.

                - `text_weight: number`

                  The weight of the text in the reciprocal ranking fusion.

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

                The ranker to use for the file search.

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

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `type: "computer"`

              The type of the computer tool. Always `computer`.

              - `"computer"`

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

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

              - `"windows"`

              - `"mac"`

              - `"linux"`

              - `"ubuntu"`

              - `"browser"`

            - `type: "computer_use_preview"`

              The type of the computer use tool. Always `computer_use_preview`.

              - `"computer_use_preview"`

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

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

              - `"web_search"`

              - `"web_search_2025_08_26"`

            - `external_web_access?: boolean`

              Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

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

              - `"low"`

              - `"medium"`

              - `"high"`

            - `user_location?: UserLocation | null`

              The approximate location of the user. If omitted or null, defaults to the
              United States. To avoid this fallback, pass `{"type": "approximate"}` without
              location fields. To localize results, provide the relevant location fields.

              - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type?: "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

              - `"mcp"`

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

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools?: Array<string> | McpToolFilter | null`

              List of allowed tool names or a filter object.

              - `Array<string>`

              - `McpToolFilter`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

              This field is deprecated for models released after September 1, 2026.
              Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
              connect through a Secure MCP Tunnel.

              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`

              - `"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" | null`

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

              - `McpToolApprovalFilter`

                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`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                    it will match this filter.

                  - `tool_names?: Array<string>`

                    List of allowed tool names.

                - `never?: Never`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

              `format: uri`

            - `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`

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

            - `container: string | CodeInterpreterToolAuto`

              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.

              - `string`

              - `CodeInterpreterToolAuto`

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

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids?: Array<string>`

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

                  `maxItems: 50`

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

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                    - `type: "disabled"`

                      Disable outbound network access. Always `disabled`.

                      - `"disabled"`

                  - `BetaContainerNetworkPolicyAllowlist`

                    - `allowed_domains: Array<string>`

                      A list of allowed domains when type is `allowlist`.

                      `minItems: 1`

                    - `type: "allowlist"`

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

                      - `"allowlist"`

                    - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                      Optional domain-scoped secrets for allowlisted domains.

                      `minItems: 1`

                      - `domain: string`

                        The domain associated with the secret.

                        `minLength: 1`

                      - `name: string`

                        The name of the secret to inject for the domain.

                        `minLength: 1`

                      - `value: string`

                        The secret value to inject for the domain.

                        `minLength: 1`, `maxLength: 10485760`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

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

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

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

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

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background?: "transparent" | "opaque" | "auto"`

              Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
              `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
              Transparent backgrounds are available for supported GPT Image models. For
              `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
              using `transparent`, set the output format to `png` or `webp`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `complexity?: "low" | "medium" | "high"`

              Computation spent planning the image, independently of rendering quality.
              Overrides the outer response's `reasoning.effort` for image generation.
              When omitted, inherits a supported outer reasoning effort or uses the
              image model's configured default.
              For SVG output, controls the reference image, not the SVG author's
              reasoning.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `frame_count?: number`

              Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

              `minimum: 2`, `maximum: 16`

            - `frame_duration_ms?: number`

              Duration of each GIF frame in milliseconds, rounded to 10 ms.
              Requires `output_format` to be `gif`. Default: 200.

              `minimum: 20`, `maximum: 2000`

            - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

              - `"high"`

              - `"low"`

            - `input_image_mask?: InputImageMask`

              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" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              Deprecated values:

              - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

              - `(string & {})`

              - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                - `"gpt-image-1"`

                - `"gpt-image-1-mini"`

                - `"gpt-image-2"`

                - `"gpt-image-2-2026-04-21"`

                - `"gpt-image-2.5-sunburst"`

                - `"gpt-image-2.5-sunburst-2026-09-08"`

                - `"gpt-image-2.5-flare"`

                - `"gpt-image-2.5-flare-2026-09-08"`

                - `"gpt-image-2.6-sunburst"`

                - `"gpt-image-2.6-flare"`

                - `"gpt-image-1.5"`

                - `"chatgpt-image-latest"`

            - `moderation?: "auto" | "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression?: number`

              Compression level for the output image. Default: 100.

              `minimum: 0`, `maximum: 100`

            - `output_format?: "png" | "webp" | "jpeg" | 2 more`

              The output format of the generated image. One of `png`, `webp`, `jpeg`,
              `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
              that supports the selected format. GIF output does not support
              partial image streaming (`partial_images` greater than `0`),
              `input_image_mask`, or custom `output_compression`.
              Responses lifecycle events can still be streamed for GIF output.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

              - `"gif"`

              - `"svg"`

            - `partial_images?: number`

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

              `minimum: 0`, `maximum: 3`

            - `quality?: "low" | "medium" | "high" | 3 more`

              The quality of the generated image. The GPT image models support `low`,
              `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
              including their `2026-09-08` snapshots, also support `xhigh` and `max`.
              Default: `auto`.

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

              - `"auto"`

            - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

              - `(string & {})`

              - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

            - `svg?: Svg`

              SVG author model settings. Requires `output_format` to be `svg`.
              When SVG model selection is enabled, omitting this object uses the
              outer response model. Otherwise, the default SVG author is used and
              explicit model overrides are unavailable.

              - `model?: string`

                `minLength: 1`

              - `reasoning?: Reasoning | null`

                Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                - `effort?: "none" | "minimal" | "low" | 4 more`

                  Controls how much effort the model should spend on reasoning for this request.

                  - `"none"`

                  - `"minimal"`

                  - `"low"`

                  - `"medium"`

                  - `"high"`

                  - `"xhigh"`

                  - `"max"`

          - `LocalShell`

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

              - `"local_shell"`

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

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

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

              - `BetaContainerAuto`

                - `type: "container_auto"`

                  Automatically creates a container for this request

                  - `"container_auto"`

                - `file_ids?: Array<string>`

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

                  `maxItems: 50`

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

                  The memory limit for the container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                  - `BetaContainerNetworkPolicyAllowlist`

                - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

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

                  `maxItems: 200`

                  - `BetaSkillReference`

                    - `skill_id: string`

                      The ID of the referenced skill.

                      `minLength: 1`, `maxLength: 64`

                    - `type: "skill_reference"`

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

                      - `"skill_reference"`

                    - `version?: string`

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

                  - `BetaInlineSkill`

                    - `description: string`

                      The description of the skill.

                    - `name: string`

                      The name of the skill.

                    - `source: BetaInlineSkillSource`

                      Inline skill payload

                      - `data: string`

                        Base64-encoded skill zip bundle.

                        `minLength: 1`, `maxLength: 70254592`

                      - `media_type: "application/zip"`

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

                        - `"application/zip"`

                      - `type: "base64"`

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

                        - `"base64"`

                    - `type: "inline"`

                      Defines an inline skill for this request.

                      - `"inline"`

              - `BetaLocalEnvironment`

                - `type: "local"`

                  Use a local computer environment.

                  - `"local"`

                - `skills?: Array<BetaLocalSkill>`

                  An optional list of skills.

                  `maxItems: 200`

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

                  The ID of the referenced container.

                - `type: "container_reference"`

                  References a container created with the /v1/containers endpoint

                  - `"container_reference"`

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

              - `"custom"`

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

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `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 | Grammar`

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

              - `Text`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar`

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

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `BetaToolSearchOutputNamespaceTool`

            Groups function/custom tools under a shared namespace.

            - `description: string`

              A description of the namespace shown to the model.

            - `name: string`

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

              `minLength: 1`

            - `tools: Array<Function | BetaCustomTool>`

              The function/custom tools loaded inside this namespace.

              `minItems: 1`

              - `Function`

                - `name: string`

                  The name of the loaded function tool.

                  `minLength: 1`, `maxLength: 128`

                - `type: "function"`

                  - `"function"`

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

                  The tool invocation context(s).

                  `minItems: 1`

                  - `"direct"`

                  - `"programmatic"`

                - `async?: boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `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`

                A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `type: "namespace"`

              The type of the tool. Always `namespace`.

              - `"namespace"`

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"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.

              - `"server"`

              - `"client"`

            - `parameters?: unknown`

              Parameter schema for a client-executed tool search tool.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

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

              - `"web_search_preview"`

              - `"web_search_preview_2025_03_11"`

            - `search_content_types?: Array<"text" | "image">`

              - `"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.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `user_location?: UserLocation | null`

              The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

              - `type: "approximate"`

                The type of location approximation. Always `approximate`.

                - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `BetaApplyPatchTool`

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

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

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

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The item type. Always `tool_search_output`.

          - `"tool_search_output"`

        - `id?: string | null`

          The unique ID of this tool search output.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

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

          `minLength: 1`, `maxLength: 64`

        - `execution?: "server" | "client"`

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

          - `"server"`

          - `"client"`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the tool search output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AdditionalTools`

        - `role: "developer"`

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

          - `"developer"`

        - `tools: Array<BetaTool>`

          A list of additional tools made available at this item.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

              - `"mcp"`

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

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools?: Array<string> | McpToolFilter | null`

              List of allowed tool names or a filter object.

              - `Array<string>`

              - `McpToolFilter`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

              This field is deprecated for models released after September 1, 2026.
              Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
              connect through a Secure MCP Tunnel.

              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`

              - `"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" | null`

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

              - `McpToolApprovalFilter`

                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`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                    it will match this filter.

                  - `tool_names?: Array<string>`

                    List of allowed tool names.

                - `never?: Never`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

              `format: uri`

            - `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`

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

            - `container: string | CodeInterpreterToolAuto`

              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.

              - `string`

              - `CodeInterpreterToolAuto`

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

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids?: Array<string>`

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

                  `maxItems: 50`

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

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                  - `BetaContainerNetworkPolicyAllowlist`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

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

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

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

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

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background?: "transparent" | "opaque" | "auto"`

              Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
              `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
              Transparent backgrounds are available for supported GPT Image models. For
              `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
              using `transparent`, set the output format to `png` or `webp`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `complexity?: "low" | "medium" | "high"`

              Computation spent planning the image, independently of rendering quality.
              Overrides the outer response's `reasoning.effort` for image generation.
              When omitted, inherits a supported outer reasoning effort or uses the
              image model's configured default.
              For SVG output, controls the reference image, not the SVG author's
              reasoning.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `frame_count?: number`

              Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

              `minimum: 2`, `maximum: 16`

            - `frame_duration_ms?: number`

              Duration of each GIF frame in milliseconds, rounded to 10 ms.
              Requires `output_format` to be `gif`. Default: 200.

              `minimum: 20`, `maximum: 2000`

            - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

              - `"high"`

              - `"low"`

            - `input_image_mask?: InputImageMask`

              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" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              Deprecated values:

              - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

              - `(string & {})`

              - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                - `"gpt-image-1"`

                - `"gpt-image-1-mini"`

                - `"gpt-image-2"`

                - `"gpt-image-2-2026-04-21"`

                - `"gpt-image-2.5-sunburst"`

                - `"gpt-image-2.5-sunburst-2026-09-08"`

                - `"gpt-image-2.5-flare"`

                - `"gpt-image-2.5-flare-2026-09-08"`

                - `"gpt-image-2.6-sunburst"`

                - `"gpt-image-2.6-flare"`

                - `"gpt-image-1.5"`

                - `"chatgpt-image-latest"`

            - `moderation?: "auto" | "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression?: number`

              Compression level for the output image. Default: 100.

              `minimum: 0`, `maximum: 100`

            - `output_format?: "png" | "webp" | "jpeg" | 2 more`

              The output format of the generated image. One of `png`, `webp`, `jpeg`,
              `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
              that supports the selected format. GIF output does not support
              partial image streaming (`partial_images` greater than `0`),
              `input_image_mask`, or custom `output_compression`.
              Responses lifecycle events can still be streamed for GIF output.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

              - `"gif"`

              - `"svg"`

            - `partial_images?: number`

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

              `minimum: 0`, `maximum: 3`

            - `quality?: "low" | "medium" | "high" | 3 more`

              The quality of the generated image. The GPT image models support `low`,
              `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
              including their `2026-09-08` snapshots, also support `xhigh` and `max`.
              Default: `auto`.

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

              - `"auto"`

            - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

              - `(string & {})`

              - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

            - `svg?: Svg`

              SVG author model settings. Requires `output_format` to be `svg`.
              When SVG model selection is enabled, omitting this object uses the
              outer response model. Otherwise, the default SVG author is used and
              explicit model overrides are unavailable.

              - `model?: string`

                `minLength: 1`

              - `reasoning?: Reasoning | null`

                Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                - `effort?: "none" | "minimal" | "low" | 4 more`

                  Controls how much effort the model should spend on reasoning for this request.

                  - `"none"`

                  - `"minimal"`

                  - `"low"`

                  - `"medium"`

                  - `"high"`

                  - `"xhigh"`

                  - `"max"`

          - `LocalShell`

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

              - `"local_shell"`

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

            - `description: string`

              A description of the namespace shown to the model.

            - `name: string`

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

              `minLength: 1`

            - `tools: Array<Function | BetaCustomTool>`

              The function/custom tools available inside this namespace.

              `minItems: 1`

              - `Function`

                - `name: string`

                  `minLength: 1`, `maxLength: 128`

                - `type: "function"`

                  - `"function"`

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

                  The tool invocation context(s).

                  `minItems: 1`

                  - `"direct"`

                  - `"programmatic"`

                - `async?: boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `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`

                A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `type: "namespace"`

              The type of the tool. Always `namespace`.

              - `"namespace"`

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

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

        - `type: "additional_tools"`

          The item type. Always `additional_tools`.

          - `"additional_tools"`

        - `id?: string | null`

          The unique ID of this additional tools item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseConfigurationUpdateItemParam`

        An update to the conversation's response configuration. Supply reasoning,
        text, or both. Each setting stays in effect until a later update replaces it.

        - `type: "configuration_update"`

          The item type. Always `configuration_update`.

          - `"configuration_update"`

        - `id?: string | null`

          The unique ID of the configuration update item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reasoning?: Reasoning`

          Updates to reasoning configuration. Only effort is supported.

          - `effort?: "none" | "minimal" | "low" | 4 more | null`

            The reasoning effort to use for subsequent responses until another
            configuration update replaces it.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

        - `text?: Text`

          The text output configuration for subsequent responses.

          - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

            Use a JSON schema for structured output or text to return to plain text.

            - `Text`

              Default response format. Used to generate text responses.

              - `type: "text"`

                The type of response format being defined. Always `text`.

                - `"text"`

            - `BetaResponseFormatTextJSONSchemaConfig`

              JSON Schema response format. Used to generate structured JSON responses.
              Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

              - `name: string`

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

              - `schema: Record<string, unknown>`

                The schema for the response format, described as a JSON Schema object.
                Learn how to build JSON schemas [here](https://json-schema.org/).

              - `type: "json_schema"`

                The type of response format being defined. Always `json_schema`.

                - `"json_schema"`

              - `description?: string`

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

              - `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](/api/docs/guides/structured-outputs).

      - `BetaResponseReasoningItem`

        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](/api/docs/guides/conversation-state).

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

            - `"summary_text"`

        - `type: "reasoning"`

          The type of the object. Always `reasoning`.

          - `"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`.

            - `"reasoning_text"`

        - `encrypted_content?: string | null`

          The encrypted content of the reasoning item. This is populated by default
          for reasoning items returned by `POST /v1/responses` and WebSocket
          `response.create` requests.

          When streaming, use the completed reasoning item and its
          `encrypted_content` from the `response.output_item.done` event in
          subsequent requests. The `encrypted_content` in
          `response.output_item.added` may be incomplete. This is especially
          important when `store` is `false` or when using Zero Data Retention.

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

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

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseCompactionItemParam`

        A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

        - `encrypted_content: string`

          The encrypted content of the compaction summary.

          `maxLength: 104857600`

        - `type: "compaction"`

          The type of the item. Always `compaction`.

          - `"compaction"`

        - `id?: string | null`

          The ID of the compaction item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ImageGenerationCall`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"generating"`

          - `"failed"`

        - `type: "image_generation_call"`

          The type of the image generation call. Always `image_generation_call`.

          - `"image_generation_call"`

        - `action?: "generate" | "edit" | "auto" | null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background?: "transparent" | "opaque" | "auto" | null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error?: Error`

          Details of a moderation failure, when available.

          - `code: string | null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string | null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details?: ModerationDetails`

            Public details for a `moderation_blocked` error, when available.

            - `categories: Array<string>`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" | "output" | "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `quality?: "low" | "medium" | "high" | 3 more | null`

          The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `revised_prompt?: string | null`

          The prompt that was used after any model prompt rewriting.

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

        - `svg_usage?: SvgUsage`

          - `input_tokens: number`

          - `model: string`

          - `output_tokens: number`

          - `reasoning_tokens: number`

          - `total_tokens: number`

      - `BetaResponseCodeInterpreterToolCall`

        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 | Image> | null`

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

          - `Logs`

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

              - `"logs"`

          - `Image`

            The image output from the code interpreter.

            - `type: "image"`

              The type of the output. Always `image`.

              - `"image"`

            - `url: string`

              The URL of the image output from the code interpreter.

              `format: uri`

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

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"interpreting"`

          - `"failed"`

        - `type: "code_interpreter_call"`

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

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

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

        - `id: string`

          The unique ID of the local shell call.

        - `action: Action`

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

            - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "local_shell_call"`

          The type of the local shell call. Always `local_shell_call`.

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

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

          - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall`

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

        - `action: Action`

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

          - `commands: Array<string>`

            Ordered shell commands for the execution environment to run.

          - `max_output_length?: number | null`

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

          - `timeout_ms?: number | null`

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

        - `call_id: string`

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

          `minLength: 1`, `maxLength: 64`

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `id?: string | null`

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

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

          The environment to execute the shell commands in.

          - `BetaLocalEnvironment`

          - `BetaContainerReference`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

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

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCallOutput`

        The streamed output items emitted by a shell tool call.

        - `call_id: string`

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

          `minLength: 1`, `maxLength: 64`

        - `output: Array<BetaResponseFunctionShellCallOutputContent>`

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

          - `outcome: Timeout | Exit`

            The exit or timeout outcome associated with this shell call.

            - `Timeout`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit`

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

              - `exit_code: number`

                The exit code returned by the shell process.

              - `type: "exit"`

                The outcome type. Always `exit`.

                - `"exit"`

          - `stderr: string`

            Captured stderr output for the shell call.

            `maxLength: 10485760`

          - `stdout: string`

            Captured stdout output for the shell call.

            `maxLength: 10485760`

        - `type: "shell_call_output"`

          The type of the item. Always `shell_call_output`.

          - `"shell_call_output"`

        - `id?: string | null`

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

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `max_output_length?: number | null`

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

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the shell call output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ApplyPatchCall`

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

        - `call_id: string`

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

          `minLength: 1`, `maxLength: 64`

        - `operation: CreateFile | DeleteFile | UpdateFile`

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

          - `CreateFile`

            Instruction for creating a new file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply when creating the file.

              `maxLength: 10485760`

            - `path: string`

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

              `minLength: 1`

            - `type: "create_file"`

              The operation type. Always `create_file`.

              - `"create_file"`

          - `DeleteFile`

            Instruction for deleting an existing file via the apply_patch tool.

            - `path: string`

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

              `minLength: 1`

            - `type: "delete_file"`

              The operation type. Always `delete_file`.

              - `"delete_file"`

          - `UpdateFile`

            Instruction for updating an existing file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply to the existing file.

              `maxLength: 10485760`

            - `path: string`

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

              `minLength: 1`

            - `type: "update_file"`

              The operation type. Always `update_file`.

              - `"update_file"`

        - `status: "in_progress" | "completed"`

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

          - `"in_progress"`

          - `"completed"`

        - `type: "apply_patch_call"`

          The type of the item. Always `apply_patch_call`.

          - `"apply_patch_call"`

        - `id?: string | null`

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

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `ApplyPatchCallOutput`

        The streamed output emitted by an apply patch tool call.

        - `call_id: string`

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

          `minLength: 1`, `maxLength: 64`

        - `status: "completed" | "failed"`

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

          - `"completed"`

          - `"failed"`

        - `type: "apply_patch_call_output"`

          The type of the item. Always `apply_patch_call_output`.

          - `"apply_patch_call_output"`

        - `id?: string | null`

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

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `output?: string | null`

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

          `maxLength: 10485760`

      - `McpListTools`

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

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

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

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

        A response to an MCP approval request.

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

          - `"mcp_approval_response"`

        - `id?: string | null`

          The unique ID of the 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.

      - `McpCall`

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

          - `"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?: BetaMcpToolCallError | null`

          The error from the tool call, if any.

          - `McpProtocolError`

            - `code: number`

            - `message: string`

            - `type: "mcp_protocol_error"`

              - `"mcp_protocol_error"`

          - `McpToolExecutionError`

            - `content: unknown`

            - `type: "mcp_tool_execution_error"`

              - `"mcp_tool_execution_error"`

          - `HTTPError`

            - `code: number`

            - `message: string`

            - `type: "http_error"`

              - `"http_error"`

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

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `BetaResponseCustomToolCallOutput`

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

        - `call_id: string`

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

        - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

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

          - `string`

          - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            - `BetaResponseInputText`

              A text input to the model.

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile`

              A file input to the model.

        - `type: "custom_tool_call_output"`

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

          - `"custom_tool_call_output"`

        - `id?: string`

          The unique ID of the custom tool call output 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 | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `BetaResponseCustomToolCall`

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

          - `"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.

        - `async?: boolean`

          Whether the custom tool call runs asynchronously.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

            - `type: "program"`

              - `"program"`

        - `namespace?: string`

          The namespace of the custom tool being called.

      - `CompactionTrigger`

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

        - `type: "compaction_trigger"`

          The type of the item. Always `compaction_trigger`.

          - `"compaction_trigger"`

        - `id?: string | null`

          The unique ID of this compaction trigger.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ItemReference`

        An internal identifier for an item to reference.

        - `id: string`

          The ID of the item to reference.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `type?: "item_reference" | null`

          The type of item to reference. Always `item_reference`.

          - `"item_reference"`

      - `Program`

        - `id: string`

          The unique ID of this program item.

        - `call_id: string`

          The stable call ID of the program item.

          `minLength: 1`, `maxLength: 64`

        - `code: string`

          The JavaScript source executed by programmatic tool calling.

          `maxLength: 10485760`

        - `fingerprint: string`

          Opaque program replay fingerprint that must be round-tripped.

          `maxLength: 10485760`

        - `type: "program"`

          The item type. Always `program`.

          - `"program"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput`

        - `id: string`

          The unique ID of this program output item.

        - `call_id: string`

          The call ID of the program item.

          `minLength: 1`, `maxLength: 64`

        - `result: string`

          The result produced by the program item.

          `maxLength: 10485760`

        - `status: "completed" | "incomplete"`

          The terminal status of the program output.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The item type. Always `program_output`.

          - `"program_output"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

  - `metadata: Record<string, string> | 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: "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more | (string & {})`

    Model ID used to generate the response, like `gpt-6-astra`. OpenAI
    offers a wide range of models with different capabilities, performance
    characteristics, and price points. Refer to the [model guide](/api/docs/models)
    to browse and compare available models.

    Deprecated values:

    - "gpt-5.4-nano", "gpt-5.4-nano-2026-03-17", "gpt-5.1", "gpt-5.1-2025-11-13": Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-5.3-chat-latest", "gpt-5.2-chat-latest": Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-5.1-codex", "gpt-5.1-chat-latest", "gpt-5-chat-latest", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", "o3-deep-research", "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5-codex", "gpt-5.1-codex-max": Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-5.1-mini": Not a supported model ID. Retained for SDK compatibility.
    - "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "o3", "o3-2025-04-16", "o3-pro", "o3-pro-2025-06-10", "gpt-5-pro", "gpt-5-pro-2025-10-06": Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-mini", "gpt-4o-mini-2024-07-18": Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4.1-nano", "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3-mini", "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "gpt-4o-2024-05-13", "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-1106-preview", "gpt-4", "gpt-4-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-0125", "o1-pro", "o1-pro-2025-03-19": Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "o1-preview", "o1-preview-2024-09-12": Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "o1-mini", "o1-mini-2024-09-12": Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-audio-mini", "gpt-audio-mini-2025-12-15": Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-12-17", "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", "gpt-4o-mini-audio-preview-2024-12-17": Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4o-audio-preview-2024-10-01": Announced shutdown date: 2025-10-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "chatgpt-4o-latest": Announced shutdown date: 2026-02-17. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "codex-mini-latest": Announced shutdown date: 2026-02-12. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4-0125-preview", "gpt-4-turbo-preview", "gpt-4-0314": Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4-vision-preview": Announced shutdown date: 2024-12-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-0613": Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k-0613": Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-3.5-turbo-1106": Announced shutdown date: 2026-09-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.

    - `"gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more`

      Model ID used to generate the response, like `gpt-6-astra`. OpenAI
      offers a wide range of models with different capabilities, performance
      characteristics, and price points. Refer to the [model guide](/api/docs/models)
      to browse and compare available models.

      - `"gpt-6-astra"`

      - `"gpt-6.1-sol"`

      - `"gpt-6.1-terra"`

      - `"gpt-6-sol"`

      - `"gpt-6-luna"`

      - `"gpt-5.6-sol"`

      - `"gpt-5.6-terra"`

      - `"gpt-5.6-luna"`

      - `"gpt-5.5"`

      - `"gpt-5.5-2026-04-23"`

      - `"gpt-5.4"`

      - `"gpt-5.4-mini"`

      - `"gpt-5.4-nano"`

      - `"gpt-5.4-mini-2026-03-17"`

      - `"gpt-5.4-nano-2026-03-17"`

      - `"gpt-5.3-chat-latest"`

      - `"gpt-5.2"`

      - `"gpt-5.2-2025-12-11"`

      - `"gpt-5.2-chat-latest"`

      - `"gpt-5.2-pro"`

      - `"gpt-5.2-pro-2025-12-11"`

      - `"gpt-5.1"`

      - `"gpt-5.1-2025-11-13"`

      - `"gpt-5.1-codex"`

      - `"gpt-5.1-mini"`

      - `"gpt-5.1-chat-latest"`

      - `"gpt-5"`

      - `"gpt-5-mini"`

      - `"gpt-5-nano"`

      - `"gpt-5-2025-08-07"`

      - `"gpt-5-mini-2025-08-07"`

      - `"gpt-5-nano-2025-08-07"`

      - `"gpt-5-chat-latest"`

      - `"gpt-4.1"`

      - `"gpt-4.1-mini"`

      - `"gpt-4.1-nano"`

      - `"gpt-4.1-2025-04-14"`

      - `"gpt-4.1-mini-2025-04-14"`

      - `"gpt-4.1-nano-2025-04-14"`

      - `"o4-mini"`

      - `"o4-mini-2025-04-16"`

      - `"o3"`

      - `"o3-2025-04-16"`

      - `"o3-mini"`

      - `"o3-mini-2025-01-31"`

      - `"o1"`

      - `"o1-2024-12-17"`

      - `"o1-preview"`

      - `"o1-preview-2024-09-12"`

      - `"o1-mini"`

      - `"o1-mini-2024-09-12"`

      - `"gpt-4o"`

      - `"gpt-4o-2024-11-20"`

      - `"gpt-4o-2024-08-06"`

      - `"gpt-4o-2024-05-13"`

      - `"gpt-audio-mini"`

      - `"gpt-audio-mini-2025-12-15"`

      - `"gpt-4o-audio-preview"`

      - `"gpt-4o-audio-preview-2024-10-01"`

      - `"gpt-4o-audio-preview-2024-12-17"`

      - `"gpt-4o-audio-preview-2025-06-03"`

      - `"gpt-4o-mini-audio-preview"`

      - `"gpt-4o-mini-audio-preview-2024-12-17"`

      - `"gpt-4o-search-preview"`

      - `"gpt-4o-mini-search-preview"`

      - `"gpt-4o-search-preview-2025-03-11"`

      - `"gpt-4o-mini-search-preview-2025-03-11"`

      - `"chatgpt-4o-latest"`

      - `"codex-mini-latest"`

      - `"gpt-4o-mini"`

      - `"gpt-4o-mini-2024-07-18"`

      - `"gpt-4-turbo"`

      - `"gpt-4-turbo-2024-04-09"`

      - `"gpt-4-0125-preview"`

      - `"gpt-4-turbo-preview"`

      - `"gpt-4-1106-preview"`

      - `"gpt-4-vision-preview"`

      - `"gpt-4"`

      - `"gpt-4-0314"`

      - `"gpt-4-0613"`

      - `"gpt-4-32k"`

      - `"gpt-4-32k-0314"`

      - `"gpt-4-32k-0613"`

      - `"gpt-3.5-turbo"`

      - `"gpt-3.5-turbo-16k"`

      - `"gpt-3.5-turbo-0301"`

      - `"gpt-3.5-turbo-0613"`

      - `"gpt-3.5-turbo-1106"`

      - `"gpt-3.5-turbo-0125"`

      - `"gpt-3.5-turbo-16k-0613"`

      - `"o1-pro"`

      - `"o1-pro-2025-03-19"`

      - `"o3-pro"`

      - `"o3-pro-2025-06-10"`

      - `"o3-deep-research"`

      - `"o3-deep-research-2025-06-26"`

      - `"o4-mini-deep-research"`

      - `"o4-mini-deep-research-2025-06-26"`

      - `"computer-use-preview"`

      - `"computer-use-preview-2025-03-11"`

      - `"gpt-5.5-pro"`

      - `"gpt-5.5-pro-2026-04-23"`

      - `"gpt-5-codex"`

      - `"gpt-5-pro"`

      - `"gpt-5-pro-2025-10-06"`

      - `"gpt-5.1-codex-max"`

      - `"gpt-daybreak-blue-latest"`

      - `"gpt-daybreak-red-latest"`

      - `"gpt-5.6-cyber"`

      - `"gpt-6-cyber"`

      - `"gpt-rosalind-research"`

      - `"gpt-6-rosalind"`

    - `(string & {})`

  - `object: "response"`

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

    - `"response"`

  - `output: Array<BetaResponseOutputItem>`

    An array of content items generated by the model.

    - The length and order of items in the `output` array is dependent
      on the model's response.
    - Rather than accessing the first item in the `output` array and
      assuming it's an `assistant` message with the content generated by
      the model, you might consider using the `output_text` property where
      supported in SDKs.

    - `BetaResponseOutputMessage`

      An output message from the model.

    - `BetaResponseFileSearchToolCall`

      The results of a file search tool call. See the
      [file search guide](/api/docs/guides/tools-file-search) for more information.

    - `BetaResponseFunctionToolCall`

      A tool call to run a function. See the
      [function calling guide](/api/docs/guides/function-calling) for more information.

    - `BetaResponseFunctionToolCallOutputItem`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

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

        - `string`

        - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          - `BetaResponseInputText`

            A text input to the model.

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile`

            A file input to the model.

      - `status: "in_progress" | "completed" | "incomplete"`

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

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "function_call_output"`

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

        - `"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.

      - `call_id?: string`

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

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

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

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

      - `name?: string`

        The name of the tool that produced the output.

      - `namespace?: string`

        The namespace of the tool that produced the output.

    - `AgentMessage`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

        Encrypted content sent between agents.

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseOutputText`

          A text output from the model.

        - `Text`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText`

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

            - `"summary_text"`

        - `ReasoningText`

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

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal`

          A refusal from the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot`

          A screenshot of a computer.

          - `detail: BetaImageDetail`

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

          - `file_id: string | null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string | null`

            The URL of the screenshot image.

            `format: uri`

          - `type: "computer_screenshot"`

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

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputFile`

          A file input to the model.

        - `EncryptedContent`

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

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall`

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

        - `"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`.

        - `"multi_agent_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput`

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

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

        Text output returned by the multi-agent action.

        - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

          The annotations of the text output.

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

        - `logprobs?: Array<Logprob>`

      - `type: "multi_agent_call_output"`

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

        - `"multi_agent_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseFunctionWebSearch`

      The results of a web search tool call. See the
      [web search guide](/api/docs/guides/tools-web-search) for more information.

    - `BetaResponseComputerToolCall`

      A tool call to a computer use tool. See the
      [computer use guide](/api/docs/guides/tools-computer-use) for more information.

    - `BetaResponseComputerToolCallOutputItem`

      - `id: string`

        The ID of the computer tool call output.

      - `call_id: string`

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

      - `output: BetaResponseComputerToolCallOutputScreenshot`

        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.

        - `"completed"`

        - `"incomplete"`

        - `"failed"`

        - `"in_progress"`

      - `type: "computer_call_output"`

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

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

      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](/api/docs/guides/conversation-state).

    - `Program`

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

        - `"program"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput`

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

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The type of the item. Always `program_output`.

        - `"program_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseToolSearchCall`

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

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

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

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "tool_search_call"`

        The type of the item. Always `tool_search_call`.

        - `"tool_search_call"`

      - `agent?: Agent`

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

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

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

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: Array<BetaTool>`

        The loaded tool definitions returned by tool search.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

        - `BetaFileSearchTool`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `BetaComputerTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

        - `CodeInterpreter`

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

        - `ProgrammaticToolCalling`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

        - `LocalShell`

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

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `BetaApplyPatchTool`

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

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent?: Agent`

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

        The unique ID of the additional tools item.

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

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: Array<BetaTool>`

        The additional tool definitions made available at this item.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

        - `BetaFileSearchTool`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `BetaComputerTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

        - `CodeInterpreter`

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

        - `ProgrammaticToolCalling`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

        - `LocalShell`

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

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `BetaApplyPatchTool`

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

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseCompactionItem`

      A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

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

        - `"compaction"`

      - `agent?: Agent`

        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`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"generating"`

        - `"failed"`

      - `type: "image_generation_call"`

        The type of the image generation call. Always `image_generation_call`.

        - `"image_generation_call"`

      - `action?: "generate" | "edit" | "auto" | null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background?: "transparent" | "opaque" | "auto" | null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error?: Error`

        Details of a moderation failure, when available.

        - `code: string | null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string | null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details?: ModerationDetails`

          Public details for a `moderation_blocked` error, when available.

          - `categories: Array<string>`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" | "output" | "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

        - `"gif"`

        - `"svg"`

      - `quality?: "low" | "medium" | "high" | 3 more | null`

        The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

        - `"auto"`

      - `revised_prompt?: string | null`

        The prompt that was used after any model prompt rewriting.

      - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `(string & {})`

        - `"1024x1024" | "1024x1536" | "1536x1024"`

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

      - `svg_usage?: SvgUsage`

        - `input_tokens: number`

        - `model: string`

        - `output_tokens: number`

        - `reasoning_tokens: number`

        - `total_tokens: number`

    - `BetaResponseCodeInterpreterToolCall`

      A tool call to run code.

    - `LocalShellCall`

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

      - `id: string`

        The unique ID of the local shell call.

      - `action: Action`

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

          - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "local_shell_call"`

        The type of the local shell call. Always `local_shell_call`.

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

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

        - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseFunctionShellToolCall`

      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`

        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 | BetaResponseContainerReference | null`

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

        - `BetaResponseLocalEnvironment`

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

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" | "completed" | "incomplete"`

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

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "shell_call"`

        The type of the item. Always `shell_call`.

        - `"shell_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

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

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The ID of the entity that created this tool call.

    - `BetaResponseFunctionShellToolCallOutput`

      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 | Exit`

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

          - `Timeout`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit`

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

              - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "shell_call_output"`

        The type of the shell call output. Always `shell_call_output`.

        - `"shell_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

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

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

    - `BetaResponseApplyPatchToolCall`

      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 | DeleteFile | UpdateFile`

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

        - `CreateFile`

          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.

            - `"create_file"`

        - `DeleteFile`

          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.

            - `"delete_file"`

        - `UpdateFile`

          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.

            - `"update_file"`

      - `status: "in_progress" | "completed"`

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

        - `"in_progress"`

        - `"completed"`

      - `type: "apply_patch_call"`

        The type of the item. Always `apply_patch_call`.

        - `"apply_patch_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

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

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The ID of the entity that created this tool call.

    - `BetaResponseApplyPatchToolCallOutput`

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

        - `"completed"`

        - `"failed"`

      - `type: "apply_patch_call_output"`

        The type of the item. Always `apply_patch_call_output`.

        - `"apply_patch_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

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

          - `type: "program"`

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

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

        - `"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?: BetaMcpToolCallError | 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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `McpListTools`

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

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

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

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

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

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

      A call to a custom tool created by the model.

    - `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `created_by?: string`

        The identifier of the actor that created the item.

  - `parallel_tool_calls: boolean`

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

  - `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.
    We generally recommend altering this or `top_p` but not both.

    `minimum: 0`, `maximum: 2`

  - `tool_choice: BetaToolChoiceOptions | BetaToolChoiceAllowed | BetaToolChoiceTypes | 6 more`

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

    - `BetaToolChoiceOptions = "none" | "auto" | "required"`

      Controls which (if any) tool is called by the model.

      `none` means the model will not call any tool and instead generates a message.

      `auto` means the model can pick between generating a message or calling one or
      more tools.

      `required` means the model must call one or more tools.

      - `"none"`

      - `"auto"`

      - `"required"`

    - `BetaToolChoiceAllowed`

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

      - `mode: "auto" | "required"`

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

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

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

        - `"auto"`

        - `"required"`

      - `tools: Array<Record<string, unknown>>`

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

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

        ```json
        [
          { "type": "function", "name": "get_weather" },
          { "type": "mcp", "server_label": "deepwiki" },
          { "type": "image_generation" }
        ]
        ```

      - `type: "allowed_tools"`

        Allowed tool configuration type. Always `allowed_tools`.

        - `"allowed_tools"`

    - `BetaToolChoiceTypes`

      Indicates that the model should use a built-in tool to generate a response.
      [Learn more about built-in tools](/api/docs/guides/tools).

      - `type: "file_search" | "web_search_preview" | "computer" | 5 more`

        The type of hosted tool the model should to use. Learn more about
        [built-in tools](/api/docs/guides/tools).

        Allowed values are:

        - `file_search`
        - `web_search_preview`
        - `computer`
        - `computer_use_preview`
        - `computer_use`
        - `code_interpreter`
        - `image_generation`

        - `"file_search"`

        - `"web_search_preview"`

        - `"computer"`

        - `"computer_use_preview"`

        - `"computer_use"`

        - `"web_search_preview_2025_03_11"`

        - `"image_generation"`

        - `"code_interpreter"`

    - `BetaToolChoiceFunction`

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

      - `name: string`

        The name of the function to call.

      - `type: "function"`

        For function calling, the type is always `function`.

        - `"function"`

    - `BetaToolChoiceMcp`

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

      - `server_label: string`

        The label of the MCP server to use.

      - `type: "mcp"`

        For MCP tools, the type is always `mcp`.

        - `"mcp"`

      - `name?: string | null`

        The name of the tool to call on the server.

    - `BetaToolChoiceCustom`

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

      - `name: string`

        The name of the custom tool to call.

      - `type: "custom"`

        For custom tool calling, the type is always `custom`.

        - `"custom"`

    - `BetaSpecificProgrammaticToolCallingParam`

      - `type: "programmatic_tool_calling"`

        The tool to call. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `BetaToolChoiceApplyPatch`

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

      - `type: "apply_patch"`

        The tool to call. Always `apply_patch`.

        - `"apply_patch"`

    - `BetaToolChoiceShell`

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

      - `type: "shell"`

        The tool to call. Always `shell`.

        - `"shell"`

  - `tools: Array<BetaTool>`

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

    We support the following categories of tools:

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

    - `BetaFunctionTool`

      Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

    - `BetaFileSearchTool`

      A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

    - `BetaComputerTool`

      A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

    - `BetaComputerUsePreviewTool`

      A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

    - `BetaWebSearchTool`

      Search the Internet for sources related to the prompt. Learn more about the
      [web search tool](/api/docs/guides/tools-web-search).

    - `Mcp`

      Give the model access to additional tools via remote Model Context Protocol
      (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

    - `CodeInterpreter`

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

    - `ProgrammaticToolCalling`

    - `ImageGeneration`

      A tool that generates images using the GPT image models.

    - `LocalShell`

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

    - `BetaFunctionShellTool`

      A tool that allows the model to execute shell commands.

    - `BetaCustomTool`

      A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

    - `BetaNamespaceTool`

      Groups function/custom tools under a shared namespace.

    - `BetaToolSearchTool`

      Hosted or BYOT tool search configuration for deferred tools.

    - `BetaWebSearchPreviewTool`

      This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

    - `BetaApplyPatchTool`

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

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

    `minimum: 0`, `maximum: 1`

  - `background?: boolean | null`

    Whether to run the model response in the background.
    [Learn more](/api/docs/guides/background).

  - `completed_at?: number | null`

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

    `format: unixtime`

  - `conversation?: Conversation | null`

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

    - `id: string`

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

  - `image?: Image`

    - `context_compression: "enabled" | "disabled"`

      Effective image context optimization policy.

      - `"enabled"`

      - `"disabled"`

  - `max_output_tokens?: number | null`

    An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/api/docs/guides/reasoning).

  - `max_tool_calls?: number | null`

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

  - `moderation?: Moderation | null`

    Moderation results for the response input and output, if moderated completions were requested.

    - `input: ModerationResult | Error`

      Moderation for the response input.

      - `ModerationResult`

        A moderation result produced for the response input or output.

        - `categories: Record<string, boolean>`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: Record<string, Array<"text" | "image">>`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: Record<string, number>`

          A dictionary of moderation categories to scores.

        - `flagged: boolean`

          A boolean indicating whether the content was flagged by any category.

        - `model: string`

          The moderation model that produced this result.

        - `type: "moderation_result"`

          The object type, which was always `moderation_result` for successful moderation results.

          - `"moderation_result"`

      - `Error`

        An error produced while attempting moderation for the response input or output.

        - `code: string`

          The error code.

        - `message: string`

          The error message.

        - `type: "error"`

          The object type, which was always `error` for moderation failures.

          - `"error"`

    - `output: ModerationResult | Error`

      Moderation for the response output.

      - `ModerationResult`

        A moderation result produced for the response input or output.

        - `categories: Record<string, boolean>`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: Record<string, Array<"text" | "image">>`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: Record<string, number>`

          A dictionary of moderation categories to scores.

        - `flagged: boolean`

          A boolean indicating whether the content was flagged by any category.

        - `model: string`

          The moderation model that produced this result.

        - `type: "moderation_result"`

          The object type, which was always `moderation_result` for successful moderation results.

          - `"moderation_result"`

      - `Error`

        An error produced while attempting moderation for the response input or output.

        - `code: string`

          The error code.

        - `message: string`

          The error message.

        - `type: "error"`

          The object type, which was always `error` for moderation failures.

          - `"error"`

  - `previous_response_id?: string | null`

    The unique ID of the previous response to the model. Use this to
    create multi-turn conversations. Learn more about
    [conversation state](/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.

  - `prompt?: BetaResponsePrompt | null`

    Reference to a prompt template and its variables.
    [Learn more](/api/docs/guides/text?api-mode=responses#version-prompts-in-code).

    - `id: string`

      The unique identifier of the prompt template to use.

    - `variables?: Record<string, string | BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile> | null`

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

      - `string`

      - `BetaResponseInputText`

        A text input to the model.

      - `BetaResponseInputImage`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

      - `BetaResponseInputFile`

        A file input to the model.

    - `version?: string | null`

      Optional version of the prompt template.

  - `prompt_cache_diagnostics?: CacheMiss | CacheHit | ComparisonResponseNotFound | Unavailable`

    Prompt cache diagnostics requested for this response.

    - `CacheMiss`

      - `cache_missed_tokens: number`

        The estimated number of input tokens affected after the first detected divergence.

      - `reason: "model_changed" | "prompt_cache_key_changed" | "tools_changed" | 6 more`

        The reason prompt cache reuse did not occur.

        - `"model_changed"`

        - `"prompt_cache_key_changed"`

        - `"tools_changed"`

        - `"text_format_changed"`

        - `"reasoning_effort_changed"`

        - `"verbosity_changed"`

        - `"context_compacted"`

        - `"input_changed"`

        - `"service_tier_changed"`

      - `type: "cache_miss"`

        - `"cache_miss"`

      - `comparison_reusable_tokens?: number`

        The raw token count of the reusable prefix in the compared response.

    - `CacheHit`

      - `type: "cache_hit"`

        - `"cache_hit"`

    - `ComparisonResponseNotFound`

      - `type: "comparison_response_not_found"`

        - `"comparison_response_not_found"`

    - `Unavailable`

      - `type: "unavailable"`

        - `"unavailable"`

  - `prompt_cache_key?: string | null`

    Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/api/docs/guides/prompt-caching).

  - `prompt_cache_options?: PromptCacheOptions`

    The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

    - `mode: "implicit" | "explicit"`

      Whether implicit prompt-cache breakpoints were enabled.

      - `"implicit"`

      - `"explicit"`

    - `ttl: "30m" | "12h"`

      The minimum lifetime applied to each cache breakpoint.

      - `"30m"`

      - `"12h"`

    - `comparison_response_id?: string | null`

      The response ID supplied as the prompt cache diagnostics comparison.

  - `prompt_cache_retention?: "in_memory" | "24h" | null`

    Deprecated. Use `prompt_cache_options.ttl` instead.

    The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/api/docs/guides/prompt-caching#prompt-cache-retention).
    This field expresses a maximum retention policy, while
    `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two
    fields are independent and do not interact.
    For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported.

    For older models that support both `in_memory` and `24h`, the default depends on your organization's data retention policy:

    - Organizations without ZDR enabled default to `24h`.
    - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified.

    - `"in_memory"`

    - `"24h"`

  - `reasoning?: Reasoning | null`

    Configuration options for
    [reasoning models](/api/docs/guides/reasoning).

    - `context?: "auto" | "current_turn" | "all_turns" | null`

      Controls which reasoning items are rendered back to the model on later turns.
      If omitted or set to `auto`, the model determines the context mode. The
      `gpt-5.6` model family defaults to `all_turns`; earlier models default to
      `current_turn`.

      When returned on a response, this is the effective reasoning context mode
      used for the response.

      - `"auto"`

      - `"current_turn"`

      - `"all_turns"`

    - `effort?: "none" | "minimal" | "low" | 4 more | null`

      Constrains effort on reasoning for reasoning models. Currently supported
      values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
      Reducing reasoning effort can result in faster responses and fewer tokens
      used on reasoning in a response. Not all reasoning models support every
      value. See the
      [reasoning guide](/api/docs/guides/reasoning)
      for model-specific support.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `generate_summary?: "auto" | "concise" | "detailed" | null`

      **Deprecated:** use `summary` instead.

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

      - `"auto"`

      - `"concise"`

      - `"detailed"`

    - `mode?: (string & {}) | "standard" | "pro"`

      Controls the reasoning execution mode for the request.

      When returned on a response, this is the effective execution mode.

      - `(string & {})`

      - `"standard" | "pro"`

        - `"standard"`

        - `"pro"`

    - `summary?: "auto" | "concise" | "detailed" | null`

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

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

      - `"auto"`

      - `"concise"`

      - `"detailed"`

  - `safety_identifier?: string | null`

    A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.
    The IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

    `maxLength: 128`

  - `service_tier?: BetaServiceTier | null`

    Specifies the processing type used for serving the request.

    - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
    - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
    - If set to '[flex](/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.
    - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.
    - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for `gpt-5.6-sol`; a response served through it will show `service_tier=ultrafast`.
    - When not set, the default behavior is 'auto'.

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

    - `"auto"`

    - `"default"`

    - `"flex"`

    - `"scale"`

    - `"priority"`

    - `"fast"`

    - `"ultrafast"`

  - `status?: BetaResponseStatus`

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

    - `"completed"`

    - `"failed"`

    - `"in_progress"`

    - `"cancelled"`

    - `"queued"`

    - `"incomplete"`

  - `text?: BetaResponseTextConfig`

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

    - [Text inputs and outputs](/api/docs/guides/text)
    - [Structured Outputs](/api/docs/guides/structured-outputs)

    - `format?: BetaResponseFormatTextConfig`

      An object specifying the format that the model must output.

      Configuring `{ "type": "json_schema" }` enables Structured Outputs,
      which ensures the model will match your supplied JSON schema. Learn more in the
      [Structured Outputs guide](/api/docs/guides/structured-outputs).

      The default format is `{ "type": "text" }` with no additional options.

      **Not recommended for gpt-4o and newer models:**

      Setting to `{ "type": "json_object" }` enables the older JSON mode, which
      ensures the message the model generates is valid JSON. Using `json_schema`
      is preferred for models that support it.

      - `Text`

        Default response format. Used to generate text responses.

        - `type: "text"`

          The type of response format being defined. Always `text`.

          - `"text"`

      - `BetaResponseFormatTextJSONSchemaConfig`

        JSON Schema response format. Used to generate structured JSON responses.
        Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `JSONObject`

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

          - `"json_object"`

    - `verbosity?: "low" | "medium" | "high" | null`

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

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tool_usage?: ToolUsage`

    Usage reported by hosted tools, separate from base model `usage`. The field
    can be omitted when tool usage is unavailable. When present, tool families
    with no recorded usage have zero counts.

    `image_gen` sums available token counts across image generation calls.
    Calls with missing or incomplete usage records may be skipped. Output
    token details and cached input counts can be omitted. An omitted cache
    count means cache usage is unknown.

    `web_search.num_requests` counts billable searches. Discounted searches
    and actions such as opening a page are excluded. Use billing records to
    reconcile final charges.

    - `image_gen: ImageGen`

      Aggregated usage statistics for image generation tool calls.

      - `input_tokens: number`

        The number of tokens (images and text) in the input prompt.

      - `input_tokens_details: InputTokensDetails`

        The input tokens detailed information for the image generation.

        - `image_tokens: number`

          The number of image tokens in the input prompt.

        - `text_tokens: number`

          The number of text tokens in the input prompt.

      - `output_tokens: number`

        The number of output tokens generated by the model.

      - `total_tokens: number`

        The total number of tokens (images and text) used for the image generation.

      - `cached_tokens?: number`

      - `cached_tokens_details?: CachedTokensDetails`

        - `cached_image_tokens: number`

        - `cached_text_tokens: number`

      - `output_tokens_details?: OutputTokensDetails`

        The output token details for the image generation.

        - `image_tokens: number`

          The number of image output tokens generated by the model.

        - `text_tokens: number`

          The number of text output tokens generated by the model.

    - `web_search: WebSearch`

      Aggregated billable usage statistics for web search tool calls.

      - `num_requests: number`

        The number of billable web search requests issued.

  - `top_logprobs?: number | null`

    An integer between 0 and 20 specifying the maximum number of most likely
    tokens to return at each token position, each with an associated log
    probability. In some cases, the number of returned tokens may be fewer than
    requested.

    `minimum: 0`, `maximum: 20`

  - `truncation?: "auto" | "disabled" | null`

    The truncation strategy to use for the model response.

    - `auto`: If the input to this Response exceeds
      the model's context window size, the model will truncate the
      response to fit the context window by dropping items from the beginning of the conversation.
      On some models, trimming can begin earlier because the API subtracts the model's
      maximum output allowance from its input limit, even if you set a lower `max_output_tokens`.
    - `disabled` (default): If the input size will exceed the context window
      size for a model, the request will fail with a 400 error.

    - `"auto"`

    - `"disabled"`

  - `usage?: BetaResponseUsage`

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

    - `input_tokens: number`

      The number of input tokens.

    - `input_tokens_details: InputTokensDetails`

      A detailed breakdown of the input tokens.

      - `cache_write_tokens: number`

        The number of input tokens that were written to the cache.

      - `cached_tokens: number`

        The number of tokens that were retrieved from the cache.
        [More on prompt caching](/api/docs/guides/prompt-caching).

      - `cache_write_tokens_details?: CacheWriteTokensDetails`

        - `ttl_12h_tokens: number`

          The number of input tokens written with 12-hour retention.

        - `ttl_30m_tokens: number`

          The number of input tokens written with 30-minute retention.

    - `output_tokens: number`

      The number of output tokens.

    - `output_tokens_details: OutputTokensDetails`

      A detailed breakdown of the output tokens.

      - `reasoning_tokens: number`

        The number of reasoning tokens.

    - `total_tokens: number`

      The total number of tokens used.

  - `user?: string`

    This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.
    A stable identifier for your end-users.
    Used to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const betaResponse = await client.beta.responses.cancel('resp_677efb5139a88190b512bc3fef8e535d');

console.log(betaResponse.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "access_programs": {
    "cyber": "standard"
  },
  "created_at": 0,
  "error": {
    "code": "server_error",
    "message": "message",
    "misalignment": {
      "detailed_explanation": "detailed_explanation",
      "error_type": "potentially_unintended_data_transfer",
      "review_target": "review_target",
      "steer": {
        "message": "message"
      }
    },
    "param": "param",
    "type": "type"
  },
  "incomplete_details": {
    "reason": "max_output_tokens"
  },
  "instructions": "string",
  "metadata": {
    "foo": "string"
  },
  "model": "gpt-6-astra",
  "object": "response",
  "output": [
    {
      "id": "id",
      "content": [
        {
          "annotations": [
            {
              "file_id": "file_id",
              "filename": "filename",
              "index": 0,
              "type": "file_citation"
            }
          ],
          "text": "text",
          "type": "output_text",
          "logprobs": [
            {
              "token": "token",
              "bytes": [
                0
              ],
              "logprob": 0,
              "top_logprobs": [
                {
                  "token": "token",
                  "bytes": [
                    0
                  ],
                  "logprob": 0
                }
              ]
            }
          ]
        }
      ],
      "role": "assistant",
      "status": "in_progress",
      "type": "message",
      "agent": {
        "agent_name": "agent_name"
      },
      "phase": "commentary"
    }
  ],
  "parallel_tool_calls": true,
  "temperature": 1,
  "tool_choice": "none",
  "tools": [
    {
      "name": "name",
      "parameters": {
        "foo": "bar"
      },
      "strict": true,
      "type": "function",
      "allowed_callers": [
        "direct"
      ],
      "async": true,
      "defer_loading": true,
      "description": "description",
      "output_schema": {
        "foo": "bar"
      }
    }
  ],
  "top_p": 1,
  "background": true,
  "completed_at": 0,
  "conversation": {
    "id": "id"
  },
  "image": {
    "context_compression": "enabled"
  },
  "max_output_tokens": 0,
  "max_tool_calls": 0,
  "moderation": {
    "input": {
      "categories": {
        "foo": true
      },
      "category_applied_input_types": {
        "foo": [
          "text"
        ]
      },
      "category_scores": {
        "foo": 0
      },
      "flagged": true,
      "model": "model",
      "type": "moderation_result"
    },
    "output": {
      "categories": {
        "foo": true
      },
      "category_applied_input_types": {
        "foo": [
          "text"
        ]
      },
      "category_scores": {
        "foo": 0
      },
      "flagged": true,
      "model": "model",
      "type": "moderation_result"
    }
  },
  "output_text": "output_text",
  "previous_response_id": "previous_response_id",
  "prompt": {
    "id": "id",
    "variables": {
      "foo": "string"
    },
    "version": "version"
  },
  "prompt_cache_diagnostics": {
    "cache_missed_tokens": 0,
    "reason": "model_changed",
    "type": "cache_miss",
    "comparison_reusable_tokens": 0
  },
  "prompt_cache_key": "prompt-cache-key-1234",
  "prompt_cache_options": {
    "mode": "implicit",
    "ttl": "30m",
    "comparison_response_id": "comparison_response_id"
  },
  "prompt_cache_retention": "in_memory",
  "reasoning": {
    "context": "auto",
    "effort": "none",
    "generate_summary": "auto",
    "mode": "standard",
    "summary": "auto"
  },
  "safety_identifier": "safety-identifier-1234",
  "service_tier": "auto",
  "status": "completed",
  "text": {
    "format": {
      "type": "text"
    },
    "verbosity": "low"
  },
  "tool_usage": {
    "image_gen": {
      "input_tokens": 0,
      "input_tokens_details": {
        "image_tokens": 0,
        "text_tokens": 0
      },
      "output_tokens": 0,
      "total_tokens": 0,
      "cached_tokens": 0,
      "cached_tokens_details": {
        "cached_image_tokens": 0,
        "cached_text_tokens": 0
      },
      "output_tokens_details": {
        "image_tokens": 0,
        "text_tokens": 0
      }
    },
    "web_search": {
      "num_requests": 0
    }
  },
  "top_logprobs": 0,
  "truncation": "auto",
  "usage": {
    "input_tokens": 0,
    "input_tokens_details": {
      "cache_write_tokens": 0,
      "cached_tokens": 0,
      "cache_write_tokens_details": {
        "ttl_12h_tokens": 0,
        "ttl_30m_tokens": 0
      }
    },
    "output_tokens": 0,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 0
  },
  "user": "user-1234"
}
```

### Example

```typescript
import OpenAI from "openai";
const client = new OpenAI();

const response = await client.responses.cancel("resp_123");
console.log(response);
```

#### Response example

```json
{
  "id": "resp_67cb71b351908190a308f3859487620d06981a8637e6bc44",
  "object": "response",
  "access_programs": null,
  "created_at": 1741386163,
  "status": "cancelled",
  "background": true,
  "completed_at": null,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-6-astra",
  "output": [
    {
      "type": "message",
      "id": "msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44",
      "status": "in_progress",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Silent circuits hum,  \nThoughts emerge in data streams—  \nDigital dawn breaks.",
          "annotations": [],
          "logprobs": []
        }
      ]
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": null,
  "user": null,
  "metadata": {}
}
```

## Compact conversation

`client.beta.responses.compact(ResponseCompactParamsparams, RequestOptionsoptions?): BetaCompactedResponse`

**post** `/responses/compact?beta=true`

Compact a conversation. Returns a compacted response object.

Learn when and how to compact long-running conversations in the [conversation state guide](/api/docs/guides/conversation-state#managing-the-context-window). For ZDR-compatible compaction details, see [Compaction (advanced)](/api/docs/guides/conversation-state#compaction-advanced).

### Parameters

- `params: ResponseCompactParams`

  - `model: "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more | (string & {}) | null`

    Body param: Model ID used to generate the response, like `gpt-6-astra`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](/api/docs/models) to browse and compare available models.

    - `"gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more`

      Model ID used to generate the response, like `gpt-6-astra`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](/api/docs/models) to browse and compare available models.

      - `"gpt-6-astra"`

      - `"gpt-6.1-sol"`

      - `"gpt-6.1-terra"`

      - `"gpt-6-sol"`

      - `"gpt-6-luna"`

      - `"gpt-5.6-sol"`

      - `"gpt-5.6-terra"`

      - `"gpt-5.6-luna"`

      - `"gpt-5.5"`

      - `"gpt-5.5-2026-04-23"`

      - `"gpt-5.4"`

      - `"gpt-5.4-mini"`

      - `"gpt-5.4-nano"`

      - `"gpt-5.4-mini-2026-03-17"`

      - `"gpt-5.4-nano-2026-03-17"`

      - `"gpt-5.3-chat-latest"`

      - `"gpt-5.2"`

      - `"gpt-5.2-2025-12-11"`

      - `"gpt-5.2-chat-latest"`

      - `"gpt-5.2-pro"`

      - `"gpt-5.2-pro-2025-12-11"`

      - `"gpt-5.1"`

      - `"gpt-5.1-2025-11-13"`

      - `"gpt-5.1-codex"`

      - `"gpt-5.1-mini"`

      - `"gpt-5.1-chat-latest"`

      - `"gpt-5"`

      - `"gpt-5-mini"`

      - `"gpt-5-nano"`

      - `"gpt-5-2025-08-07"`

      - `"gpt-5-mini-2025-08-07"`

      - `"gpt-5-nano-2025-08-07"`

      - `"gpt-5-chat-latest"`

      - `"gpt-4.1"`

      - `"gpt-4.1-mini"`

      - `"gpt-4.1-nano"`

      - `"gpt-4.1-2025-04-14"`

      - `"gpt-4.1-mini-2025-04-14"`

      - `"gpt-4.1-nano-2025-04-14"`

      - `"o4-mini"`

      - `"o4-mini-2025-04-16"`

      - `"o3"`

      - `"o3-2025-04-16"`

      - `"o3-mini"`

      - `"o3-mini-2025-01-31"`

      - `"o1"`

      - `"o1-2024-12-17"`

      - `"o1-preview"`

      - `"o1-preview-2024-09-12"`

      - `"o1-mini"`

      - `"o1-mini-2024-09-12"`

      - `"gpt-4o"`

      - `"gpt-4o-2024-11-20"`

      - `"gpt-4o-2024-08-06"`

      - `"gpt-4o-2024-05-13"`

      - `"gpt-audio-mini"`

      - `"gpt-audio-mini-2025-12-15"`

      - `"gpt-4o-audio-preview"`

      - `"gpt-4o-audio-preview-2024-10-01"`

      - `"gpt-4o-audio-preview-2024-12-17"`

      - `"gpt-4o-audio-preview-2025-06-03"`

      - `"gpt-4o-mini-audio-preview"`

      - `"gpt-4o-mini-audio-preview-2024-12-17"`

      - `"gpt-4o-search-preview"`

      - `"gpt-4o-mini-search-preview"`

      - `"gpt-4o-search-preview-2025-03-11"`

      - `"gpt-4o-mini-search-preview-2025-03-11"`

      - `"chatgpt-4o-latest"`

      - `"codex-mini-latest"`

      - `"gpt-4o-mini"`

      - `"gpt-4o-mini-2024-07-18"`

      - `"gpt-4-turbo"`

      - `"gpt-4-turbo-2024-04-09"`

      - `"gpt-4-0125-preview"`

      - `"gpt-4-turbo-preview"`

      - `"gpt-4-1106-preview"`

      - `"gpt-4-vision-preview"`

      - `"gpt-4"`

      - `"gpt-4-0314"`

      - `"gpt-4-0613"`

      - `"gpt-4-32k"`

      - `"gpt-4-32k-0314"`

      - `"gpt-4-32k-0613"`

      - `"gpt-3.5-turbo"`

      - `"gpt-3.5-turbo-16k"`

      - `"gpt-3.5-turbo-0301"`

      - `"gpt-3.5-turbo-0613"`

      - `"gpt-3.5-turbo-1106"`

      - `"gpt-3.5-turbo-0125"`

      - `"gpt-3.5-turbo-16k-0613"`

      - `"o1-pro"`

      - `"o1-pro-2025-03-19"`

      - `"o3-pro"`

      - `"o3-pro-2025-06-10"`

      - `"o3-deep-research"`

      - `"o3-deep-research-2025-06-26"`

      - `"o4-mini-deep-research"`

      - `"o4-mini-deep-research-2025-06-26"`

      - `"computer-use-preview"`

      - `"computer-use-preview-2025-03-11"`

      - `"gpt-5.5-pro"`

      - `"gpt-5.5-pro-2026-04-23"`

      - `"gpt-5-codex"`

      - `"gpt-5-pro"`

      - `"gpt-5-pro-2025-10-06"`

      - `"gpt-5.1-codex-max"`

      - `"gpt-daybreak-blue-latest"`

      - `"gpt-daybreak-red-latest"`

      - `"gpt-5.6-cyber"`

      - `"gpt-6-cyber"`

      - `"gpt-rosalind-research"`

      - `"gpt-6-rosalind"`

    - `(string & {})`

  - `image?: Image`

    Body param: Request level image options.

    - `context_compression?: "auto" | "enabled" | "disabled"`

      Controls image context optimization. Defaults to `auto`, which uses the model, transport, and input to select a policy. Use `enabled` to require compression support or `disabled` to turn it off.

      - `"auto"`

      - `"enabled"`

      - `"disabled"`

  - `input?: string | Array<BetaResponseInputItem> | null`

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

    - `string`

    - `Array<BetaResponseInputItem>`

      - `BetaEasyInputMessage`

        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.

          - `string`

          - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

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

            - `BetaResponseInputText`

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

                - `"input_text"`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `detail: BetaImageDetail`

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

                - `"low"`

                - `"high"`

                - `"auto"`

                - `"original"`

              - `type: "input_image"`

                The type of the input item. Always `input_image`.

                - `"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.

                `format: uri`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFile`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"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`.

                - `"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.

                `format: uri`

              - `filename?: string`

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

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

        - `role: "user" | "assistant" | "system" | "developer"`

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

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"developer"`

        - `phase?: "commentary" | "final_answer" | 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.

          - `"commentary"`

          - `"final_answer"`

        - `type?: "message"`

          The type of the message input. Always `message`.

          - `"message"`

      - `Message`

        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.

        - `content: BetaResponseInputMessageContentList`

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

        - `role: "user" | "system" | "developer"`

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

          - `"user"`

          - `"system"`

          - `"developer"`

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

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

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type?: "message"`

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

          - `"message"`

      - `BetaResponseOutputMessage`

        An output message from the model.

        - `id: string`

          The unique ID of the output message.

        - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

          The content of the output message.

          - `BetaResponseOutputText`

            A text output from the model.

            - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

              The annotations of the text output.

              - `FileCitation`

                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 in the output text at which to insert the file citation.

                - `type: "file_citation"`

                  The type of the file citation. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation`

                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_citation"`

                - `url: string`

                  The URL of the web resource.

                  `format: uri`

              - `ContainerFileCitation`

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

                  - `"container_file_citation"`

              - `FilePath`

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

                  - `"file_path"`

            - `text: string`

              The text output from the model.

            - `type: "output_text"`

              The type of the output text. Always `output_text`.

              - `"output_text"`

            - `logprobs?: Array<Logprob>`

              - `token: string`

              - `bytes: Array<number>`

              - `logprob: number`

              - `top_logprobs: Array<TopLogprob>`

                - `token: string`

                - `bytes: Array<number>`

                - `logprob: number`

          - `BetaResponseOutputRefusal`

            A refusal from the model.

            - `refusal: string`

              The refusal explanation from the model.

            - `type: "refusal"`

              The type of the refusal. Always `refusal`.

              - `"refusal"`

        - `role: "assistant"`

          The role of the output message. Always `assistant`.

          - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "message"`

          The type of the output message. Always `message`.

          - `"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" | "final_answer" | 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.

          - `"commentary"`

          - `"final_answer"`

      - `BetaResponseFileSearchToolCall`

        The results of a file search tool call. See the
        [file search guide](/api/docs/guides/tools-file-search) 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`,

          - `"in_progress"`

          - `"searching"`

          - `"completed"`

          - `"incomplete"`

          - `"failed"`

        - `type: "file_search_call"`

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

          - `"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.

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

            `format: float`

          - `text?: string`

            The text that was retrieved from the file.

      - `BetaResponseComputerToolCall`

        A tool call to a computer use tool. See the
        [computer use guide](/api/docs/guides/tools-computer-use) 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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "computer_call"`

          The type of the computer call. Always `computer_call`.

          - `"computer_call"`

        - `action?: BetaComputerAction`

          A click action.

          - `Click`

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

              - `"left"`

              - `"right"`

              - `"wheel"`

              - `"back"`

              - `"forward"`

            - `type: "click"`

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

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

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

              - `"double_click"`

            - `x: number`

              The x-coordinate where the double click occurred.

            - `y: number`

              The y-coordinate where the double click occurred.

          - `Drag`

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

              - `"drag"`

            - `keys?: Array<string> | null`

              The keys being held while dragging the mouse.

          - `Keypress`

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

              - `"keypress"`

          - `Move`

            A mouse move action.

            - `type: "move"`

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

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

            A screenshot action.

            - `type: "screenshot"`

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

              - `"screenshot"`

          - `Scroll`

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

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

            An action to type in text.

            - `text: string`

              The text to type.

            - `type: "type"`

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

              - `"type"`

          - `Wait`

            A wait action.

            - `type: "wait"`

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

              - `"wait"`

        - `actions?: BetaComputerActionList`

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

          - `Click`

            A click action.

          - `DoubleClick`

            A double click action.

          - `Drag`

            A drag action.

          - `Keypress`

            A collection of keypresses the model would like to perform.

          - `Move`

            A mouse move action.

          - `Screenshot`

            A screenshot action.

          - `Scroll`

            A scroll action.

          - `Type`

            An action to type in text.

          - `Wait`

            A wait action.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput`

        The output of a computer tool call.

        - `call_id: string`

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

          `minLength: 1`, `maxLength: 64`

        - `output: BetaResponseComputerToolCallOutputScreenshot`

          A computer screenshot image used with the computer use tool.

          - `type: "computer_screenshot"`

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

            - `"computer_screenshot"`

          - `file_id?: string`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url?: string`

            The URL of the screenshot image.

            `format: uri`

        - `type: "computer_call_output"`

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

          - `"computer_call_output"`

        - `id?: string | null`

          The ID of the computer tool call output.

        - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

          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.

        - `status?: "in_progress" | "completed" | "incomplete" | null`

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

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseFunctionWebSearch`

        The results of a web search tool call. See the
        [web search guide](/api/docs/guides/tools-web-search) for more information.

        - `id: string`

          The unique ID of the web search tool call.

        - `action: Search | OpenPage | FindInPage`

          An object describing the specific action taken in this web search call.
          Includes details on how the model used the web (search, open_page, find_in_page).

          - `Search`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries?: Array<string>`

              The search queries.

            - `query?: string`

              The search query.

            - `sources?: Array<Source>`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

                `format: uri`

          - `OpenPage`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url?: string | null`

              The URL opened by the model.

              `format: uri`

          - `FindInPage`

            Action type "find_in_page": Searches for a pattern within a loaded page.

            - `pattern: string`

              The pattern or text to search for within the page.

            - `type: "find_in_page"`

              The action type.

              - `"find_in_page"`

            - `url: string`

              The URL of the page searched for the pattern.

              `format: uri`

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

          The status of the web search tool call.

          - `"in_progress"`

          - `"searching"`

          - `"completed"`

          - `"failed"`

          - `"incomplete"`

        - `type: "web_search_call"`

          The type of the web search tool call. Always `web_search_call`.

          - `"web_search_call"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseFunctionToolCall`

        A tool call to run a function. See the
        [function calling guide](/api/docs/guides/function-calling) 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`.

          - `"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.

        - `async?: boolean`

          Whether the function tool call runs asynchronously.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

            - `type: "program"`

              - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `FunctionCallOutput`

        The output of a function tool call.

        - `output: string | BetaResponseFunctionCallOutputItemList`

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

          - `string`

          - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

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

            - `BetaResponseInputTextContent`

              A text input to the model.

              - `text: string`

                The text input to the model.

                `maxLength: 10485760`

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImageContent`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

              - `type: "input_image"`

                The type of the input item. Always `input_image`.

                - `"input_image"`

              - `detail?: BetaImageDetail | null`

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

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

                `maxLength: 20971520`, `format: uri`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFileContent`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"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`.

                - `"auto"`

                - `"low"`

                - `"high"`

              - `file_data?: string | null`

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

                `maxLength: 73400320`

              - `file_id?: string | null`

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

              - `file_url?: string | null`

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

                `format: uri`

              - `filename?: string | null`

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

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

        - `type: "function_call_output"`

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

          - `"function_call_output"`

        - `id?: string | null`

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

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

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

          `minLength: 1`, `maxLength: 64`

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `name?: string | null`

          The name of the tool that produced the output.

          `minLength: 1`, `maxLength: 128`

        - `namespace?: string | null`

          The namespace of the tool that produced the output.

          `minLength: 1`, `maxLength: 128`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

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

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AgentMessage`

        A message routed between agents.

        - `author: string`

          The sending agent identity.

        - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

          Plaintext, image, or encrypted content sent between agents.

          - `BetaResponseInputTextContent`

            A text input to the model.

          - `BetaResponseInputImageContent`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

          - `EncryptedContent`

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

            - `encrypted_content: string`

              Opaque encrypted content.

              `maxLength: 10485760`

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

        - `id?: string | null`

          The unique ID of this agent message item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall`

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

          The multi-agent action that was executed.

          - `"spawn_agent"`

          - `"interrupt_agent"`

          - `"list_agents"`

          - `"send_message"`

          - `"followup_task"`

          - `"wait_agent"`

        - `arguments: string`

          The action arguments as a JSON string.

        - `call_id: string`

          The unique ID linking this call to its output.

          `minLength: 1`, `maxLength: 64`

        - `type: "multi_agent_call"`

          The item type. Always `multi_agent_call`.

          - `"multi_agent_call"`

        - `id?: string | null`

          The unique ID of this multi-agent call.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput`

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

          The multi-agent action that produced this result.

          - `"spawn_agent"`

          - `"interrupt_agent"`

          - `"list_agents"`

          - `"send_message"`

          - `"followup_task"`

          - `"wait_agent"`

        - `call_id: string`

          The unique ID of the multi-agent call.

          `minLength: 1`, `maxLength: 64`

        - `output: Array<Output>`

          Text output returned by the multi-agent action.

          - `text: string`

            The text content.

            `maxLength: 10485760`

          - `type: "output_text"`

            The content type. Always `output_text`.

            - `"output_text"`

          - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

            Citations associated with the text content.

            - `FileCitation`

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

                `minimum: 0`

              - `type: "file_citation"`

                The citation type. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation`

              - `end_index: number`

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

                `minimum: 0`

              - `start_index: number`

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

                `minimum: 0`

              - `title: string`

                The title of the cited resource.

              - `type: "url_citation"`

                The citation type. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the cited resource.

                `format: uri`

            - `ContainerFileCitation`

              - `container_id: string`

                The ID of the container.

              - `end_index: number`

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

                `minimum: 0`

              - `file_id: string`

                The ID of the container file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

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

                `minimum: 0`

              - `type: "container_file_citation"`

                The citation type. Always `container_file_citation`.

                - `"container_file_citation"`

        - `type: "multi_agent_call_output"`

          The item type. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `id?: string | null`

          The unique ID of this multi-agent call output.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall`

        - `arguments: unknown`

          The arguments supplied to the tool search call.

        - `type: "tool_search_call"`

          The item type. Always `tool_search_call`.

          - `"tool_search_call"`

        - `id?: string | null`

          The unique ID of this tool search call.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

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

          `minLength: 1`, `maxLength: 64`

        - `execution?: "server" | "client"`

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

          - `"server"`

          - `"client"`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the tool search call.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseToolSearchOutputItemParam`

        - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

          The loaded tool definitions returned by the tool search output.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

              - `"function"`

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

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

            - `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`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

            - `type: "file_search"`

              The type of the file search tool. Always `file_search`.

              - `"file_search"`

            - `vector_store_ids: Array<string>`

              The IDs of the vector stores to search.

            - `filters?: ComparisonFilter | CompoundFilter | null`

              A filter to apply.

              - `ComparisonFilter`

                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

                  - `"eq"`

                  - `"ne"`

                  - `"gt"`

                  - `"gte"`

                  - `"lt"`

                  - `"lte"`

                  - `"in"`

                  - `"nin"`

                - `value: string | number | boolean | Array<string | number>`

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

                  - `string`

                  - `number`

                  - `boolean`

                  - `Array<string | number>`

                    - `string`

                    - `number`

              - `CompoundFilter`

                Combine multiple filters using `and` or `or`.

                - `filters: Array<ComparisonFilter | unknown>`

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

                  - `ComparisonFilter`

                    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

                      - `"eq"`

                      - `"ne"`

                      - `"gt"`

                      - `"gte"`

                      - `"lt"`

                      - `"lte"`

                      - `"in"`

                      - `"nin"`

                    - `value: string | number | boolean | Array<string | number>`

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

                      - `string`

                      - `number`

                      - `boolean`

                      - `Array<string | number>`

                        - `string`

                        - `number`

                  - `unknown`

                - `type: "and" | "or"`

                  Type of operation: `and` or `or`.

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

              Ranking options for search.

              - `hybrid_search?: HybridSearch`

                Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

                - `embedding_weight: number`

                  The weight of the embedding in the reciprocal ranking fusion.

                - `text_weight: number`

                  The weight of the text in the reciprocal ranking fusion.

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

                The ranker to use for the file search.

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

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `type: "computer"`

              The type of the computer tool. Always `computer`.

              - `"computer"`

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

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

              - `"windows"`

              - `"mac"`

              - `"linux"`

              - `"ubuntu"`

              - `"browser"`

            - `type: "computer_use_preview"`

              The type of the computer use tool. Always `computer_use_preview`.

              - `"computer_use_preview"`

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

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

              - `"web_search"`

              - `"web_search_2025_08_26"`

            - `external_web_access?: boolean`

              Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

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

              - `"low"`

              - `"medium"`

              - `"high"`

            - `user_location?: UserLocation | null`

              The approximate location of the user. If omitted or null, defaults to the
              United States. To avoid this fallback, pass `{"type": "approximate"}` without
              location fields. To localize results, provide the relevant location fields.

              - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type?: "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

              - `"mcp"`

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

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools?: Array<string> | McpToolFilter | null`

              List of allowed tool names or a filter object.

              - `Array<string>`

              - `McpToolFilter`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

              This field is deprecated for models released after September 1, 2026.
              Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
              connect through a Secure MCP Tunnel.

              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`

              - `"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" | null`

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

              - `McpToolApprovalFilter`

                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`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                    it will match this filter.

                  - `tool_names?: Array<string>`

                    List of allowed tool names.

                - `never?: Never`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

              `format: uri`

            - `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`

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

            - `container: string | CodeInterpreterToolAuto`

              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.

              - `string`

              - `CodeInterpreterToolAuto`

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

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids?: Array<string>`

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

                  `maxItems: 50`

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

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                    - `type: "disabled"`

                      Disable outbound network access. Always `disabled`.

                      - `"disabled"`

                  - `BetaContainerNetworkPolicyAllowlist`

                    - `allowed_domains: Array<string>`

                      A list of allowed domains when type is `allowlist`.

                      `minItems: 1`

                    - `type: "allowlist"`

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

                      - `"allowlist"`

                    - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                      Optional domain-scoped secrets for allowlisted domains.

                      `minItems: 1`

                      - `domain: string`

                        The domain associated with the secret.

                        `minLength: 1`

                      - `name: string`

                        The name of the secret to inject for the domain.

                        `minLength: 1`

                      - `value: string`

                        The secret value to inject for the domain.

                        `minLength: 1`, `maxLength: 10485760`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

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

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

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

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

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background?: "transparent" | "opaque" | "auto"`

              Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
              `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
              Transparent backgrounds are available for supported GPT Image models. For
              `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
              using `transparent`, set the output format to `png` or `webp`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `complexity?: "low" | "medium" | "high"`

              Computation spent planning the image, independently of rendering quality.
              Overrides the outer response's `reasoning.effort` for image generation.
              When omitted, inherits a supported outer reasoning effort or uses the
              image model's configured default.
              For SVG output, controls the reference image, not the SVG author's
              reasoning.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `frame_count?: number`

              Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

              `minimum: 2`, `maximum: 16`

            - `frame_duration_ms?: number`

              Duration of each GIF frame in milliseconds, rounded to 10 ms.
              Requires `output_format` to be `gif`. Default: 200.

              `minimum: 20`, `maximum: 2000`

            - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

              - `"high"`

              - `"low"`

            - `input_image_mask?: InputImageMask`

              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" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              Deprecated values:

              - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

              - `(string & {})`

              - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                - `"gpt-image-1"`

                - `"gpt-image-1-mini"`

                - `"gpt-image-2"`

                - `"gpt-image-2-2026-04-21"`

                - `"gpt-image-2.5-sunburst"`

                - `"gpt-image-2.5-sunburst-2026-09-08"`

                - `"gpt-image-2.5-flare"`

                - `"gpt-image-2.5-flare-2026-09-08"`

                - `"gpt-image-2.6-sunburst"`

                - `"gpt-image-2.6-flare"`

                - `"gpt-image-1.5"`

                - `"chatgpt-image-latest"`

            - `moderation?: "auto" | "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression?: number`

              Compression level for the output image. Default: 100.

              `minimum: 0`, `maximum: 100`

            - `output_format?: "png" | "webp" | "jpeg" | 2 more`

              The output format of the generated image. One of `png`, `webp`, `jpeg`,
              `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
              that supports the selected format. GIF output does not support
              partial image streaming (`partial_images` greater than `0`),
              `input_image_mask`, or custom `output_compression`.
              Responses lifecycle events can still be streamed for GIF output.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

              - `"gif"`

              - `"svg"`

            - `partial_images?: number`

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

              `minimum: 0`, `maximum: 3`

            - `quality?: "low" | "medium" | "high" | 3 more`

              The quality of the generated image. The GPT image models support `low`,
              `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
              including their `2026-09-08` snapshots, also support `xhigh` and `max`.
              Default: `auto`.

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

              - `"auto"`

            - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

              - `(string & {})`

              - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

            - `svg?: Svg`

              SVG author model settings. Requires `output_format` to be `svg`.
              When SVG model selection is enabled, omitting this object uses the
              outer response model. Otherwise, the default SVG author is used and
              explicit model overrides are unavailable.

              - `model?: string`

                `minLength: 1`

              - `reasoning?: Reasoning | null`

                Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                - `effort?: "none" | "minimal" | "low" | 4 more`

                  Controls how much effort the model should spend on reasoning for this request.

                  - `"none"`

                  - `"minimal"`

                  - `"low"`

                  - `"medium"`

                  - `"high"`

                  - `"xhigh"`

                  - `"max"`

          - `LocalShell`

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

              - `"local_shell"`

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

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

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

              - `BetaContainerAuto`

                - `type: "container_auto"`

                  Automatically creates a container for this request

                  - `"container_auto"`

                - `file_ids?: Array<string>`

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

                  `maxItems: 50`

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

                  The memory limit for the container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                  - `BetaContainerNetworkPolicyAllowlist`

                - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

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

                  `maxItems: 200`

                  - `BetaSkillReference`

                    - `skill_id: string`

                      The ID of the referenced skill.

                      `minLength: 1`, `maxLength: 64`

                    - `type: "skill_reference"`

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

                      - `"skill_reference"`

                    - `version?: string`

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

                  - `BetaInlineSkill`

                    - `description: string`

                      The description of the skill.

                    - `name: string`

                      The name of the skill.

                    - `source: BetaInlineSkillSource`

                      Inline skill payload

                      - `data: string`

                        Base64-encoded skill zip bundle.

                        `minLength: 1`, `maxLength: 70254592`

                      - `media_type: "application/zip"`

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

                        - `"application/zip"`

                      - `type: "base64"`

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

                        - `"base64"`

                    - `type: "inline"`

                      Defines an inline skill for this request.

                      - `"inline"`

              - `BetaLocalEnvironment`

                - `type: "local"`

                  Use a local computer environment.

                  - `"local"`

                - `skills?: Array<BetaLocalSkill>`

                  An optional list of skills.

                  `maxItems: 200`

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

                  The ID of the referenced container.

                - `type: "container_reference"`

                  References a container created with the /v1/containers endpoint

                  - `"container_reference"`

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

              - `"custom"`

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

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `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 | Grammar`

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

              - `Text`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar`

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

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `BetaToolSearchOutputNamespaceTool`

            Groups function/custom tools under a shared namespace.

            - `description: string`

              A description of the namespace shown to the model.

            - `name: string`

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

              `minLength: 1`

            - `tools: Array<Function | BetaCustomTool>`

              The function/custom tools loaded inside this namespace.

              `minItems: 1`

              - `Function`

                - `name: string`

                  The name of the loaded function tool.

                  `minLength: 1`, `maxLength: 128`

                - `type: "function"`

                  - `"function"`

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

                  The tool invocation context(s).

                  `minItems: 1`

                  - `"direct"`

                  - `"programmatic"`

                - `async?: boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `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`

                A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `type: "namespace"`

              The type of the tool. Always `namespace`.

              - `"namespace"`

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"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.

              - `"server"`

              - `"client"`

            - `parameters?: unknown`

              Parameter schema for a client-executed tool search tool.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

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

              - `"web_search_preview"`

              - `"web_search_preview_2025_03_11"`

            - `search_content_types?: Array<"text" | "image">`

              - `"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.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `user_location?: UserLocation | null`

              The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

              - `type: "approximate"`

                The type of location approximation. Always `approximate`.

                - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `BetaApplyPatchTool`

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

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

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

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The item type. Always `tool_search_output`.

          - `"tool_search_output"`

        - `id?: string | null`

          The unique ID of this tool search output.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

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

          `minLength: 1`, `maxLength: 64`

        - `execution?: "server" | "client"`

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

          - `"server"`

          - `"client"`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the tool search output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AdditionalTools`

        - `role: "developer"`

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

          - `"developer"`

        - `tools: Array<BetaTool>`

          A list of additional tools made available at this item.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

              - `"mcp"`

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

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools?: Array<string> | McpToolFilter | null`

              List of allowed tool names or a filter object.

              - `Array<string>`

              - `McpToolFilter`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

              This field is deprecated for models released after September 1, 2026.
              Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
              connect through a Secure MCP Tunnel.

              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`

              - `"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" | null`

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

              - `McpToolApprovalFilter`

                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`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                    it will match this filter.

                  - `tool_names?: Array<string>`

                    List of allowed tool names.

                - `never?: Never`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

              `format: uri`

            - `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`

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

            - `container: string | CodeInterpreterToolAuto`

              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.

              - `string`

              - `CodeInterpreterToolAuto`

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

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids?: Array<string>`

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

                  `maxItems: 50`

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

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                  - `BetaContainerNetworkPolicyAllowlist`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

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

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

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

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

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background?: "transparent" | "opaque" | "auto"`

              Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
              `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
              Transparent backgrounds are available for supported GPT Image models. For
              `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
              using `transparent`, set the output format to `png` or `webp`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `complexity?: "low" | "medium" | "high"`

              Computation spent planning the image, independently of rendering quality.
              Overrides the outer response's `reasoning.effort` for image generation.
              When omitted, inherits a supported outer reasoning effort or uses the
              image model's configured default.
              For SVG output, controls the reference image, not the SVG author's
              reasoning.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `frame_count?: number`

              Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

              `minimum: 2`, `maximum: 16`

            - `frame_duration_ms?: number`

              Duration of each GIF frame in milliseconds, rounded to 10 ms.
              Requires `output_format` to be `gif`. Default: 200.

              `minimum: 20`, `maximum: 2000`

            - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

              - `"high"`

              - `"low"`

            - `input_image_mask?: InputImageMask`

              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" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              Deprecated values:

              - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

              - `(string & {})`

              - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                - `"gpt-image-1"`

                - `"gpt-image-1-mini"`

                - `"gpt-image-2"`

                - `"gpt-image-2-2026-04-21"`

                - `"gpt-image-2.5-sunburst"`

                - `"gpt-image-2.5-sunburst-2026-09-08"`

                - `"gpt-image-2.5-flare"`

                - `"gpt-image-2.5-flare-2026-09-08"`

                - `"gpt-image-2.6-sunburst"`

                - `"gpt-image-2.6-flare"`

                - `"gpt-image-1.5"`

                - `"chatgpt-image-latest"`

            - `moderation?: "auto" | "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression?: number`

              Compression level for the output image. Default: 100.

              `minimum: 0`, `maximum: 100`

            - `output_format?: "png" | "webp" | "jpeg" | 2 more`

              The output format of the generated image. One of `png`, `webp`, `jpeg`,
              `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
              that supports the selected format. GIF output does not support
              partial image streaming (`partial_images` greater than `0`),
              `input_image_mask`, or custom `output_compression`.
              Responses lifecycle events can still be streamed for GIF output.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

              - `"gif"`

              - `"svg"`

            - `partial_images?: number`

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

              `minimum: 0`, `maximum: 3`

            - `quality?: "low" | "medium" | "high" | 3 more`

              The quality of the generated image. The GPT image models support `low`,
              `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
              including their `2026-09-08` snapshots, also support `xhigh` and `max`.
              Default: `auto`.

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

              - `"auto"`

            - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

              - `(string & {})`

              - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

            - `svg?: Svg`

              SVG author model settings. Requires `output_format` to be `svg`.
              When SVG model selection is enabled, omitting this object uses the
              outer response model. Otherwise, the default SVG author is used and
              explicit model overrides are unavailable.

              - `model?: string`

                `minLength: 1`

              - `reasoning?: Reasoning | null`

                Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                - `effort?: "none" | "minimal" | "low" | 4 more`

                  Controls how much effort the model should spend on reasoning for this request.

                  - `"none"`

                  - `"minimal"`

                  - `"low"`

                  - `"medium"`

                  - `"high"`

                  - `"xhigh"`

                  - `"max"`

          - `LocalShell`

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

              - `"local_shell"`

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

            - `description: string`

              A description of the namespace shown to the model.

            - `name: string`

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

              `minLength: 1`

            - `tools: Array<Function | BetaCustomTool>`

              The function/custom tools available inside this namespace.

              `minItems: 1`

              - `Function`

                - `name: string`

                  `minLength: 1`, `maxLength: 128`

                - `type: "function"`

                  - `"function"`

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

                  The tool invocation context(s).

                  `minItems: 1`

                  - `"direct"`

                  - `"programmatic"`

                - `async?: boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `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`

                A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `type: "namespace"`

              The type of the tool. Always `namespace`.

              - `"namespace"`

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

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

        - `type: "additional_tools"`

          The item type. Always `additional_tools`.

          - `"additional_tools"`

        - `id?: string | null`

          The unique ID of this additional tools item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseConfigurationUpdateItemParam`

        An update to the conversation's response configuration. Supply reasoning,
        text, or both. Each setting stays in effect until a later update replaces it.

        - `type: "configuration_update"`

          The item type. Always `configuration_update`.

          - `"configuration_update"`

        - `id?: string | null`

          The unique ID of the configuration update item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reasoning?: Reasoning`

          Updates to reasoning configuration. Only effort is supported.

          - `effort?: "none" | "minimal" | "low" | 4 more | null`

            The reasoning effort to use for subsequent responses until another
            configuration update replaces it.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

        - `text?: Text`

          The text output configuration for subsequent responses.

          - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

            Use a JSON schema for structured output or text to return to plain text.

            - `Text`

              Default response format. Used to generate text responses.

              - `type: "text"`

                The type of response format being defined. Always `text`.

                - `"text"`

            - `BetaResponseFormatTextJSONSchemaConfig`

              JSON Schema response format. Used to generate structured JSON responses.
              Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

              - `name: string`

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

              - `schema: Record<string, unknown>`

                The schema for the response format, described as a JSON Schema object.
                Learn how to build JSON schemas [here](https://json-schema.org/).

              - `type: "json_schema"`

                The type of response format being defined. Always `json_schema`.

                - `"json_schema"`

              - `description?: string`

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

              - `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](/api/docs/guides/structured-outputs).

      - `BetaResponseReasoningItem`

        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](/api/docs/guides/conversation-state).

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

            - `"summary_text"`

        - `type: "reasoning"`

          The type of the object. Always `reasoning`.

          - `"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`.

            - `"reasoning_text"`

        - `encrypted_content?: string | null`

          The encrypted content of the reasoning item. This is populated by default
          for reasoning items returned by `POST /v1/responses` and WebSocket
          `response.create` requests.

          When streaming, use the completed reasoning item and its
          `encrypted_content` from the `response.output_item.done` event in
          subsequent requests. The `encrypted_content` in
          `response.output_item.added` may be incomplete. This is especially
          important when `store` is `false` or when using Zero Data Retention.

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

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

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseCompactionItemParam`

        A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

        - `encrypted_content: string`

          The encrypted content of the compaction summary.

          `maxLength: 104857600`

        - `type: "compaction"`

          The type of the item. Always `compaction`.

          - `"compaction"`

        - `id?: string | null`

          The ID of the compaction item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ImageGenerationCall`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"generating"`

          - `"failed"`

        - `type: "image_generation_call"`

          The type of the image generation call. Always `image_generation_call`.

          - `"image_generation_call"`

        - `action?: "generate" | "edit" | "auto" | null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background?: "transparent" | "opaque" | "auto" | null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error?: Error`

          Details of a moderation failure, when available.

          - `code: string | null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string | null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details?: ModerationDetails`

            Public details for a `moderation_blocked` error, when available.

            - `categories: Array<string>`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" | "output" | "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `quality?: "low" | "medium" | "high" | 3 more | null`

          The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `revised_prompt?: string | null`

          The prompt that was used after any model prompt rewriting.

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

        - `svg_usage?: SvgUsage`

          - `input_tokens: number`

          - `model: string`

          - `output_tokens: number`

          - `reasoning_tokens: number`

          - `total_tokens: number`

      - `BetaResponseCodeInterpreterToolCall`

        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 | Image> | null`

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

          - `Logs`

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

              - `"logs"`

          - `Image`

            The image output from the code interpreter.

            - `type: "image"`

              The type of the output. Always `image`.

              - `"image"`

            - `url: string`

              The URL of the image output from the code interpreter.

              `format: uri`

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

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"interpreting"`

          - `"failed"`

        - `type: "code_interpreter_call"`

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

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

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

        - `id: string`

          The unique ID of the local shell call.

        - `action: Action`

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

            - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "local_shell_call"`

          The type of the local shell call. Always `local_shell_call`.

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

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

          - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall`

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

        - `action: Action`

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

          - `commands: Array<string>`

            Ordered shell commands for the execution environment to run.

          - `max_output_length?: number | null`

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

          - `timeout_ms?: number | null`

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

        - `call_id: string`

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

          `minLength: 1`, `maxLength: 64`

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `id?: string | null`

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

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

          The environment to execute the shell commands in.

          - `BetaLocalEnvironment`

          - `BetaContainerReference`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

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

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCallOutput`

        The streamed output items emitted by a shell tool call.

        - `call_id: string`

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

          `minLength: 1`, `maxLength: 64`

        - `output: Array<BetaResponseFunctionShellCallOutputContent>`

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

          - `outcome: Timeout | Exit`

            The exit or timeout outcome associated with this shell call.

            - `Timeout`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit`

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

              - `exit_code: number`

                The exit code returned by the shell process.

              - `type: "exit"`

                The outcome type. Always `exit`.

                - `"exit"`

          - `stderr: string`

            Captured stderr output for the shell call.

            `maxLength: 10485760`

          - `stdout: string`

            Captured stdout output for the shell call.

            `maxLength: 10485760`

        - `type: "shell_call_output"`

          The type of the item. Always `shell_call_output`.

          - `"shell_call_output"`

        - `id?: string | null`

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

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `max_output_length?: number | null`

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

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the shell call output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ApplyPatchCall`

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

        - `call_id: string`

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

          `minLength: 1`, `maxLength: 64`

        - `operation: CreateFile | DeleteFile | UpdateFile`

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

          - `CreateFile`

            Instruction for creating a new file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply when creating the file.

              `maxLength: 10485760`

            - `path: string`

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

              `minLength: 1`

            - `type: "create_file"`

              The operation type. Always `create_file`.

              - `"create_file"`

          - `DeleteFile`

            Instruction for deleting an existing file via the apply_patch tool.

            - `path: string`

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

              `minLength: 1`

            - `type: "delete_file"`

              The operation type. Always `delete_file`.

              - `"delete_file"`

          - `UpdateFile`

            Instruction for updating an existing file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply to the existing file.

              `maxLength: 10485760`

            - `path: string`

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

              `minLength: 1`

            - `type: "update_file"`

              The operation type. Always `update_file`.

              - `"update_file"`

        - `status: "in_progress" | "completed"`

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

          - `"in_progress"`

          - `"completed"`

        - `type: "apply_patch_call"`

          The type of the item. Always `apply_patch_call`.

          - `"apply_patch_call"`

        - `id?: string | null`

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

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `ApplyPatchCallOutput`

        The streamed output emitted by an apply patch tool call.

        - `call_id: string`

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

          `minLength: 1`, `maxLength: 64`

        - `status: "completed" | "failed"`

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

          - `"completed"`

          - `"failed"`

        - `type: "apply_patch_call_output"`

          The type of the item. Always `apply_patch_call_output`.

          - `"apply_patch_call_output"`

        - `id?: string | null`

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

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `output?: string | null`

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

          `maxLength: 10485760`

      - `McpListTools`

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

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

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

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

        A response to an MCP approval request.

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

          - `"mcp_approval_response"`

        - `id?: string | null`

          The unique ID of the 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.

      - `McpCall`

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

          - `"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?: BetaMcpToolCallError | null`

          The error from the tool call, if any.

          - `McpProtocolError`

            - `code: number`

            - `message: string`

            - `type: "mcp_protocol_error"`

              - `"mcp_protocol_error"`

          - `McpToolExecutionError`

            - `content: unknown`

            - `type: "mcp_tool_execution_error"`

              - `"mcp_tool_execution_error"`

          - `HTTPError`

            - `code: number`

            - `message: string`

            - `type: "http_error"`

              - `"http_error"`

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

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `BetaResponseCustomToolCallOutput`

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

        - `call_id: string`

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

        - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

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

          - `string`

          - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            - `BetaResponseInputText`

              A text input to the model.

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile`

              A file input to the model.

        - `type: "custom_tool_call_output"`

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

          - `"custom_tool_call_output"`

        - `id?: string`

          The unique ID of the custom tool call output 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 | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `BetaResponseCustomToolCall`

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

          - `"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.

        - `async?: boolean`

          Whether the custom tool call runs asynchronously.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

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

            - `type: "program"`

              - `"program"`

        - `namespace?: string`

          The namespace of the custom tool being called.

      - `CompactionTrigger`

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

        - `type: "compaction_trigger"`

          The type of the item. Always `compaction_trigger`.

          - `"compaction_trigger"`

        - `id?: string | null`

          The unique ID of this compaction trigger.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ItemReference`

        An internal identifier for an item to reference.

        - `id: string`

          The ID of the item to reference.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `type?: "item_reference" | null`

          The type of item to reference. Always `item_reference`.

          - `"item_reference"`

      - `Program`

        - `id: string`

          The unique ID of this program item.

        - `call_id: string`

          The stable call ID of the program item.

          `minLength: 1`, `maxLength: 64`

        - `code: string`

          The JavaScript source executed by programmatic tool calling.

          `maxLength: 10485760`

        - `fingerprint: string`

          Opaque program replay fingerprint that must be round-tripped.

          `maxLength: 10485760`

        - `type: "program"`

          The item type. Always `program`.

          - `"program"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput`

        - `id: string`

          The unique ID of this program output item.

        - `call_id: string`

          The call ID of the program item.

          `minLength: 1`, `maxLength: 64`

        - `result: string`

          The result produced by the program item.

          `maxLength: 10485760`

        - `status: "completed" | "incomplete"`

          The terminal status of the program output.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The item type. Always `program_output`.

          - `"program_output"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

  - `instructions?: string | null`

    Body param: Custom instructions for compaction. On models 6.2 and later, replaying a compaction created with custom instructions can cause Responses to drop subsequent reasoning items.

  - `previous_response_id?: string | null`

    Body param: The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.

  - `prompt_cache_key?: string | null`

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

    `maxLength: 64`

  - `prompt_cache_options?: PromptCacheOptions | null`

    Body param: Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the [prompt caching guide](/api/docs/guides/prompt-caching) for current details.

    - `mode?: "implicit" | "explicit"`

      Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching.

      - `"implicit"`

      - `"explicit"`

    - `ttl?: "30m"`

      The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer.

      - `"30m"`

  - `prompt_cache_retention?: "in_memory" | "24h" | null`

    Body param: How long to retain a prompt cache entry created by this request.

    - `"in_memory"`

    - `"24h"`

  - `service_tier?: "auto" | "default" | "fast" | 2 more | null`

    Body param: Specifies the processing type used for serving the request.   - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.   - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.   - If set to '[flex](/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.   - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. For models with a dedicated Fast tier, either value resolves to `service_tier=fast`; for other models, either value resolves to `service_tier=priority`.   - When not set, the default behavior is 'auto'.
    When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

    - `"auto"`

    - `"default"`

    - `"fast"`

    - `"flex"`

    - `"priority"`

  - `betas?: Array<"responses_multi_agent=v1">`

    Header param: Optional beta features to enable for this request.

    - `"responses_multi_agent=v1"`

### Returns

- `BetaCompactedResponse`

  - `id: string`

    The unique identifier for the compacted response.

  - `created_at: number`

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

    `format: unixtime`

  - `object: "response.compaction"`

    The object type. Always `response.compaction`.

    - `"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.

    - `BetaResponseOutputMessage`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

        The content of the output message.

        - `BetaResponseOutputText`

          A text output from the model.

          - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

            The annotations of the text output.

            - `FileCitation`

              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 in the output text at which to insert the file citation.

              - `type: "file_citation"`

                The type of the file citation. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation`

              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_citation"`

              - `url: string`

                The URL of the web resource.

                `format: uri`

            - `ContainerFileCitation`

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

                - `"container_file_citation"`

            - `FilePath`

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

                - `"file_path"`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

          - `logprobs?: Array<Logprob>`

            - `token: string`

            - `bytes: Array<number>`

            - `logprob: number`

            - `top_logprobs: Array<TopLogprob>`

              - `token: string`

              - `bytes: Array<number>`

              - `logprob: number`

        - `BetaResponseOutputRefusal`

          A refusal from the model.

          - `refusal: string`

            The refusal explanation from the model.

          - `type: "refusal"`

            The type of the refusal. Always `refusal`.

            - `"refusal"`

      - `role: "assistant"`

        The role of the output message. Always `assistant`.

        - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "message"`

        The type of the output message. Always `message`.

        - `"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" | "final_answer" | 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.

        - `"commentary"`

        - `"final_answer"`

    - `BetaResponseFileSearchToolCall`

      The results of a file search tool call. See the
      [file search guide](/api/docs/guides/tools-file-search) 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`,

        - `"in_progress"`

        - `"searching"`

        - `"completed"`

        - `"incomplete"`

        - `"failed"`

      - `type: "file_search_call"`

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

        - `"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.

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

          `format: float`

        - `text?: string`

          The text that was retrieved from the file.

    - `BetaResponseFunctionToolCall`

      A tool call to run a function. See the
      [function calling guide](/api/docs/guides/function-calling) 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`.

        - `"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.

      - `async?: boolean`

        Whether the function tool call runs asynchronously.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

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

          - `type: "program"`

            - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseFunctionToolCallOutputItem`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

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

        - `string`

        - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          - `BetaResponseInputText`

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

              - `"input_text"`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `detail: BetaImageDetail`

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

              - `"low"`

              - `"high"`

              - `"auto"`

              - `"original"`

            - `type: "input_image"`

              The type of the input item. Always `input_image`.

              - `"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.

              `format: uri`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFile`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"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`.

              - `"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.

              `format: uri`

            - `filename?: string`

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

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

      - `status: "in_progress" | "completed" | "incomplete"`

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

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "function_call_output"`

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

        - `"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.

      - `call_id?: string`

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

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

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

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

      - `name?: string`

        The name of the tool that produced the output.

      - `namespace?: string`

        The namespace of the tool that produced the output.

    - `AgentMessage`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

        Encrypted content sent between agents.

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseOutputText`

          A text output from the model.

        - `Text`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText`

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

            - `"summary_text"`

        - `ReasoningText`

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

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal`

          A refusal from the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot`

          A screenshot of a computer.

          - `detail: BetaImageDetail`

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

          - `file_id: string | null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string | null`

            The URL of the screenshot image.

            `format: uri`

          - `type: "computer_screenshot"`

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

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputFile`

          A file input to the model.

        - `EncryptedContent`

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

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall`

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

        - `"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`.

        - `"multi_agent_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput`

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

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

        Text output returned by the multi-agent action.

        - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

          The annotations of the text output.

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

        - `logprobs?: Array<Logprob>`

      - `type: "multi_agent_call_output"`

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

        - `"multi_agent_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseFunctionWebSearch`

      The results of a web search tool call. See the
      [web search guide](/api/docs/guides/tools-web-search) for more information.

      - `id: string`

        The unique ID of the web search tool call.

      - `action: Search | OpenPage | FindInPage`

        An object describing the specific action taken in this web search call.
        Includes details on how the model used the web (search, open_page, find_in_page).

        - `Search`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries?: Array<string>`

            The search queries.

          - `query?: string`

            The search query.

          - `sources?: Array<Source>`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

              `format: uri`

        - `OpenPage`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url?: string | null`

            The URL opened by the model.

            `format: uri`

        - `FindInPage`

          Action type "find_in_page": Searches for a pattern within a loaded page.

          - `pattern: string`

            The pattern or text to search for within the page.

          - `type: "find_in_page"`

            The action type.

            - `"find_in_page"`

          - `url: string`

            The URL of the page searched for the pattern.

            `format: uri`

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

        The status of the web search tool call.

        - `"in_progress"`

        - `"searching"`

        - `"completed"`

        - `"failed"`

        - `"incomplete"`

      - `type: "web_search_call"`

        The type of the web search tool call. Always `web_search_call`.

        - `"web_search_call"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseComputerToolCall`

      A tool call to a computer use tool. See the
      [computer use guide](/api/docs/guides/tools-computer-use) 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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "computer_call"`

        The type of the computer call. Always `computer_call`.

        - `"computer_call"`

      - `action?: BetaComputerAction`

        A click action.

        - `Click`

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

            - `"left"`

            - `"right"`

            - `"wheel"`

            - `"back"`

            - `"forward"`

          - `type: "click"`

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

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

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

            - `"double_click"`

          - `x: number`

            The x-coordinate where the double click occurred.

          - `y: number`

            The y-coordinate where the double click occurred.

        - `Drag`

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

            - `"drag"`

          - `keys?: Array<string> | null`

            The keys being held while dragging the mouse.

        - `Keypress`

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

            - `"keypress"`

        - `Move`

          A mouse move action.

          - `type: "move"`

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

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

          A screenshot action.

          - `type: "screenshot"`

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

            - `"screenshot"`

        - `Scroll`

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

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

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

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

            - `"type"`

        - `Wait`

          A wait action.

          - `type: "wait"`

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

            - `"wait"`

      - `actions?: BetaComputerActionList`

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

        - `Click`

          A click action.

        - `DoubleClick`

          A double click action.

        - `Drag`

          A drag action.

        - `Keypress`

          A collection of keypresses the model would like to perform.

        - `Move`

          A mouse move action.

        - `Screenshot`

          A screenshot action.

        - `Scroll`

          A scroll action.

        - `Type`

          An action to type in text.

        - `Wait`

          A wait action.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseComputerToolCallOutputItem`

      - `id: string`

        The ID of the computer tool call output.

      - `call_id: string`

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

      - `output: BetaResponseComputerToolCallOutputScreenshot`

        A computer screenshot image used with the computer use tool.

        - `type: "computer_screenshot"`

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

          - `"computer_screenshot"`

        - `file_id?: string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url?: string`

          The URL of the screenshot image.

          `format: uri`

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

        - `"completed"`

        - `"incomplete"`

        - `"failed"`

        - `"in_progress"`

      - `type: "computer_call_output"`

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

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

      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](/api/docs/guides/conversation-state).

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

          - `"summary_text"`

      - `type: "reasoning"`

        The type of the object. Always `reasoning`.

        - `"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`.

          - `"reasoning_text"`

      - `encrypted_content?: string | null`

        The encrypted content of the reasoning item. This is populated by default
        for reasoning items returned by `POST /v1/responses` and WebSocket
        `response.create` requests.

        When streaming, use the completed reasoning item and its
        `encrypted_content` from the `response.output_item.done` event in
        subsequent requests. The `encrypted_content` in
        `response.output_item.added` may be incomplete. This is especially
        important when `store` is `false` or when using Zero Data Retention.

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

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

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `Program`

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

        - `"program"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput`

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

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The type of the item. Always `program_output`.

        - `"program_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseToolSearchCall`

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

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

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

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "tool_search_call"`

        The type of the item. Always `tool_search_call`.

        - `"tool_search_call"`

      - `agent?: Agent`

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

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

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

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: Array<BetaTool>`

        The loaded tool definitions returned by tool search.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

            - `"function"`

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

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async?: boolean`

          - `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`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `type: "file_search"`

            The type of the file search tool. Always `file_search`.

            - `"file_search"`

          - `vector_store_ids: Array<string>`

            The IDs of the vector stores to search.

          - `filters?: ComparisonFilter | CompoundFilter | null`

            A filter to apply.

            - `ComparisonFilter`

              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

                - `"eq"`

                - `"ne"`

                - `"gt"`

                - `"gte"`

                - `"lt"`

                - `"lte"`

                - `"in"`

                - `"nin"`

              - `value: string | number | boolean | Array<string | number>`

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

                - `string`

                - `number`

                - `boolean`

                - `Array<string | number>`

                  - `string`

                  - `number`

            - `CompoundFilter`

              Combine multiple filters using `and` or `or`.

              - `filters: Array<ComparisonFilter | unknown>`

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

                - `ComparisonFilter`

                  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

                    - `"eq"`

                    - `"ne"`

                    - `"gt"`

                    - `"gte"`

                    - `"lt"`

                    - `"lte"`

                    - `"in"`

                    - `"nin"`

                  - `value: string | number | boolean | Array<string | number>`

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

                    - `string`

                    - `number`

                    - `boolean`

                    - `Array<string | number>`

                      - `string`

                      - `number`

                - `unknown`

              - `type: "and" | "or"`

                Type of operation: `and` or `or`.

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

            Ranking options for search.

            - `hybrid_search?: HybridSearch`

              Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

              - `embedding_weight: number`

                The weight of the embedding in the reciprocal ranking fusion.

              - `text_weight: number`

                The weight of the text in the reciprocal ranking fusion.

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

              The ranker to use for the file search.

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

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `type: "computer"`

            The type of the computer tool. Always `computer`.

            - `"computer"`

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

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

            - `"windows"`

            - `"mac"`

            - `"linux"`

            - `"ubuntu"`

            - `"browser"`

          - `type: "computer_use_preview"`

            The type of the computer use tool. Always `computer_use_preview`.

            - `"computer_use_preview"`

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

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

            - `"web_search"`

            - `"web_search_2025_08_26"`

          - `external_web_access?: boolean`

            Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

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

            - `"low"`

            - `"medium"`

            - `"high"`

          - `user_location?: UserLocation | null`

            The approximate location of the user. If omitted or null, defaults to the
            United States. To avoid this fallback, pass `{"type": "approximate"}` without
            location fields. To localize results, provide the relevant location fields.

            - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type?: "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

            - `"mcp"`

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

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools?: Array<string> | McpToolFilter | null`

            List of allowed tool names or a filter object.

            - `Array<string>`

            - `McpToolFilter`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

            This field is deprecated for models released after September 1, 2026.
            Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
            connect through a Secure MCP Tunnel.

            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`

            - `"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" | null`

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

            - `McpToolApprovalFilter`

              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`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                  it will match this filter.

                - `tool_names?: Array<string>`

                  List of allowed tool names.

              - `never?: Never`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

            `format: uri`

          - `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`

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

          - `container: string | CodeInterpreterToolAuto`

            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.

            - `string`

            - `CodeInterpreterToolAuto`

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

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids?: Array<string>`

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

                `maxItems: 50`

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

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist`

                  - `allowed_domains: Array<string>`

                    A list of allowed domains when type is `allowlist`.

                    `minItems: 1`

                  - `type: "allowlist"`

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

                    - `"allowlist"`

                  - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                    Optional domain-scoped secrets for allowlisted domains.

                    `minItems: 1`

                    - `domain: string`

                      The domain associated with the secret.

                      `minLength: 1`

                    - `name: string`

                      The name of the secret to inject for the domain.

                      `minLength: 1`

                    - `value: string`

                      The secret value to inject for the domain.

                      `minLength: 1`, `maxLength: 10485760`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

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

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

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

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

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background?: "transparent" | "opaque" | "auto"`

            Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
            `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
            Transparent backgrounds are available for supported GPT Image models. For
            `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
            using `transparent`, set the output format to `png` or `webp`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `complexity?: "low" | "medium" | "high"`

            Computation spent planning the image, independently of rendering quality.
            Overrides the outer response's `reasoning.effort` for image generation.
            When omitted, inherits a supported outer reasoning effort or uses the
            image model's configured default.
            For SVG output, controls the reference image, not the SVG author's
            reasoning.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `frame_count?: number`

            Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

            `minimum: 2`, `maximum: 16`

          - `frame_duration_ms?: number`

            Duration of each GIF frame in milliseconds, rounded to 10 ms.
            Requires `output_format` to be `gif`. Default: 200.

            `minimum: 20`, `maximum: 2000`

          - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

            - `"high"`

            - `"low"`

          - `input_image_mask?: InputImageMask`

            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" | 9 more`

            The image generation model to use. One of `gpt-image-1-mini`,
            `gpt-image-1.5`, `gpt-image-2`,
            `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
            `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
            `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
            `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
            `gpt-image-2`.

            `gpt-image-1` was shut down on October 23, 2026. Use
            `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

            Deprecated values:

            - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

            - `(string & {})`

            - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              - `"gpt-image-1"`

              - `"gpt-image-1-mini"`

              - `"gpt-image-2"`

              - `"gpt-image-2-2026-04-21"`

              - `"gpt-image-2.5-sunburst"`

              - `"gpt-image-2.5-sunburst-2026-09-08"`

              - `"gpt-image-2.5-flare"`

              - `"gpt-image-2.5-flare-2026-09-08"`

              - `"gpt-image-2.6-sunburst"`

              - `"gpt-image-2.6-flare"`

              - `"gpt-image-1.5"`

              - `"chatgpt-image-latest"`

          - `moderation?: "auto" | "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression?: number`

            Compression level for the output image. Default: 100.

            `minimum: 0`, `maximum: 100`

          - `output_format?: "png" | "webp" | "jpeg" | 2 more`

            The output format of the generated image. One of `png`, `webp`, `jpeg`,
            `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
            that supports the selected format. GIF output does not support
            partial image streaming (`partial_images` greater than `0`),
            `input_image_mask`, or custom `output_compression`.
            Responses lifecycle events can still be streamed for GIF output.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

            - `"gif"`

            - `"svg"`

          - `partial_images?: number`

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

            `minimum: 0`, `maximum: 3`

          - `quality?: "low" | "medium" | "high" | 3 more`

            The quality of the generated image. The GPT image models support `low`,
            `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
            including their `2026-09-08` snapshots, also support `xhigh` and `max`.
            Default: `auto`.

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

            - `"auto"`

          - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

            The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

            - `(string & {})`

            - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

          - `svg?: Svg`

            SVG author model settings. Requires `output_format` to be `svg`.
            When SVG model selection is enabled, omitting this object uses the
            outer response model. Otherwise, the default SVG author is used and
            explicit model overrides are unavailable.

            - `model?: string`

              `minLength: 1`

            - `reasoning?: Reasoning | null`

              Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

              - `effort?: "none" | "minimal" | "low" | 4 more`

                Controls how much effort the model should spend on reasoning for this request.

                - `"none"`

                - `"minimal"`

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

        - `LocalShell`

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

            - `"local_shell"`

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

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

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

            - `BetaContainerAuto`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids?: Array<string>`

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

                `maxItems: 50`

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

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled`

                - `BetaContainerNetworkPolicyAllowlist`

              - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

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

                `maxItems: 200`

                - `BetaSkillReference`

                  - `skill_id: string`

                    The ID of the referenced skill.

                    `minLength: 1`, `maxLength: 64`

                  - `type: "skill_reference"`

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

                    - `"skill_reference"`

                  - `version?: string`

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

                - `BetaInlineSkill`

                  - `description: string`

                    The description of the skill.

                  - `name: string`

                    The name of the skill.

                  - `source: BetaInlineSkillSource`

                    Inline skill payload

                    - `data: string`

                      Base64-encoded skill zip bundle.

                      `minLength: 1`, `maxLength: 70254592`

                    - `media_type: "application/zip"`

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

                      - `"application/zip"`

                    - `type: "base64"`

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

                      - `"base64"`

                  - `type: "inline"`

                    Defines an inline skill for this request.

                    - `"inline"`

            - `BetaLocalEnvironment`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills?: Array<BetaLocalSkill>`

                An optional list of skills.

                `maxItems: 200`

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

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

            - `"custom"`

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

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `async?: boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `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 | Grammar`

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

            - `Text`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar`

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

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

          - `description: string`

            A description of the namespace shown to the model.

          - `name: string`

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

            `minLength: 1`

          - `tools: Array<Function | BetaCustomTool>`

            The function/custom tools available inside this namespace.

            `minItems: 1`

            - `Function`

              - `name: string`

                `minLength: 1`, `maxLength: 128`

              - `type: "function"`

                - `"function"`

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

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `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`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `type: "namespace"`

            The type of the tool. Always `namespace`.

            - `"namespace"`

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"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.

            - `"server"`

            - `"client"`

          - `parameters?: unknown`

            Parameter schema for a client-executed tool search tool.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

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

            - `"web_search_preview"`

            - `"web_search_preview_2025_03_11"`

          - `search_content_types?: Array<"text" | "image">`

            - `"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.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `user_location?: UserLocation | null`

            The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

            - `type: "approximate"`

              The type of location approximation. Always `approximate`.

              - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `BetaApplyPatchTool`

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

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

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

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent?: Agent`

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

        The unique ID of the additional tools item.

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

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: Array<BetaTool>`

        The additional tool definitions made available at this item.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

        - `BetaFileSearchTool`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `BetaComputerTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

        - `CodeInterpreter`

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

        - `ProgrammaticToolCalling`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

        - `LocalShell`

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

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `BetaApplyPatchTool`

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

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseCompactionItem`

      A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

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

        - `"compaction"`

      - `agent?: Agent`

        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`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"generating"`

        - `"failed"`

      - `type: "image_generation_call"`

        The type of the image generation call. Always `image_generation_call`.

        - `"image_generation_call"`

      - `action?: "generate" | "edit" | "auto" | null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background?: "transparent" | "opaque" | "auto" | null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error?: Error`

        Details of a moderation failure, when available.

        - `code: string | null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string | null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details?: ModerationDetails`

          Public details for a `moderation_blocked` error, when available.

          - `categories: Array<string>`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" | "output" | "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

        - `"gif"`

        - `"svg"`

      - `quality?: "low" | "medium" | "high" | 3 more | null`

        The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

        - `"auto"`

      - `revised_prompt?: string | null`

        The prompt that was used after any model prompt rewriting.

      - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `(string & {})`

        - `"1024x1024" | "1024x1536" | "1536x1024"`

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

      - `svg_usage?: SvgUsage`

        - `input_tokens: number`

        - `model: string`

        - `output_tokens: number`

        - `reasoning_tokens: number`

        - `total_tokens: number`

    - `BetaResponseCodeInterpreterToolCall`

      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 | Image> | null`

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

        - `Logs`

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

            - `"logs"`

        - `Image`

          The image output from the code interpreter.

          - `type: "image"`

            The type of the output. Always `image`.

            - `"image"`

          - `url: string`

            The URL of the image output from the code interpreter.

            `format: uri`

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

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"interpreting"`

        - `"failed"`

      - `type: "code_interpreter_call"`

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

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

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

      - `id: string`

        The unique ID of the local shell call.

      - `action: Action`

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

          - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "local_shell_call"`

        The type of the local shell call. Always `local_shell_call`.

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

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

        - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseFunctionShellToolCall`

      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`

        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 | BetaResponseContainerReference | null`

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

        - `BetaResponseLocalEnvironment`

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

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" | "completed" | "incomplete"`

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

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "shell_call"`

        The type of the item. Always `shell_call`.

        - `"shell_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

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

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The ID of the entity that created this tool call.

    - `BetaResponseFunctionShellToolCallOutput`

      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 | Exit`

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

          - `Timeout`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit`

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

              - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "shell_call_output"`

        The type of the shell call output. Always `shell_call_output`.

        - `"shell_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

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

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

    - `BetaResponseApplyPatchToolCall`

      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 | DeleteFile | UpdateFile`

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

        - `CreateFile`

          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.

            - `"create_file"`

        - `DeleteFile`

          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.

            - `"delete_file"`

        - `UpdateFile`

          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.

            - `"update_file"`

      - `status: "in_progress" | "completed"`

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

        - `"in_progress"`

        - `"completed"`

      - `type: "apply_patch_call"`

        The type of the item. Always `apply_patch_call`.

        - `"apply_patch_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

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

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The ID of the entity that created this tool call.

    - `BetaResponseApplyPatchToolCallOutput`

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

        - `"completed"`

        - `"failed"`

      - `type: "apply_patch_call_output"`

        The type of the item. Always `apply_patch_call_output`.

        - `"apply_patch_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

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

          - `type: "program"`

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

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

        - `"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?: BetaMcpToolCallError | null`

        The error from the tool call, if any.

        - `McpProtocolError`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

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

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `McpListTools`

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

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

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

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

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

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

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

        - `"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.

      - `async?: boolean`

        Whether the custom tool call runs asynchronously.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

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

          - `type: "program"`

            - `"program"`

      - `namespace?: string`

        The namespace of the custom tool being called.

    - `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `created_by?: string`

        The identifier of the actor that created the item.

  - `usage: BetaResponseUsage`

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

    - `input_tokens: number`

      The number of input tokens.

    - `input_tokens_details: InputTokensDetails`

      A detailed breakdown of the input tokens.

      - `cache_write_tokens: number`

        The number of input tokens that were written to the cache.

      - `cached_tokens: number`

        The number of tokens that were retrieved from the cache.
        [More on prompt caching](/api/docs/guides/prompt-caching).

      - `cache_write_tokens_details?: CacheWriteTokensDetails`

        - `ttl_12h_tokens: number`

          The number of input tokens written with 12-hour retention.

        - `ttl_30m_tokens: number`

          The number of input tokens written with 30-minute retention.

    - `output_tokens: number`

      The number of output tokens.

    - `output_tokens_details: OutputTokensDetails`

      A detailed breakdown of the output tokens.

      - `reasoning_tokens: number`

        The number of reasoning tokens.

    - `total_tokens: number`

      The total number of tokens used.

  - `image?: Image`

    - `context_compression: "enabled" | "disabled"`

      Effective image context optimization policy.

      - `"enabled"`

      - `"disabled"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const betaCompactedResponse = await client.beta.responses.compact({ model: 'gpt-6-astra' });

console.log(betaCompactedResponse.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "created_at": 0,
  "object": "response.compaction",
  "output": [
    {
      "id": "id",
      "content": [
        {
          "annotations": [
            {
              "file_id": "file_id",
              "filename": "filename",
              "index": 0,
              "type": "file_citation"
            }
          ],
          "text": "text",
          "type": "output_text",
          "logprobs": [
            {
              "token": "token",
              "bytes": [
                0
              ],
              "logprob": 0,
              "top_logprobs": [
                {
                  "token": "token",
                  "bytes": [
                    0
                  ],
                  "logprob": 0
                }
              ]
            }
          ]
        }
      ],
      "role": "assistant",
      "status": "in_progress",
      "type": "message",
      "agent": {
        "agent_name": "agent_name"
      },
      "phase": "commentary"
    }
  ],
  "usage": {
    "input_tokens": 0,
    "input_tokens_details": {
      "cache_write_tokens": 0,
      "cached_tokens": 0,
      "cache_write_tokens_details": {
        "ttl_12h_tokens": 0,
        "ttl_30m_tokens": 0
      }
    },
    "output_tokens": 0,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 0
  },
  "image": {
    "context_compression": "enabled"
  }
}
```

### Example

```typescript
import OpenAI from "openai";

const openai = new OpenAI();

// Compact the previous response if you are running out of tokens
const compactedResponse = await openai.responses.compact({
  model: "gpt-6-astra",
  input: [
    {
      role: "user",
      content: "Create a simple landing page for a dog petting café.",
    },
    // All items returned from previous requests are included here, like reasoning, message, function call, etc.
    {
      id: "msg_030d085c0b53e67e0069332e3a72d4819c96c6f2c4adc15d33",
      type: "message",
      status: "completed",
      content: [
        {
          type: "output_text",
          annotations: [],
          logprobs: [],
          text: "Below is a single file, ready-to-use landing page for a dog petting café:...",
        },
      ],
      role: "assistant",
    },
  ],
});

// Pass the compactedResponse.output as input to the next request
console.log(compactedResponse);
```

#### Response example

```json
{
  "id": "resp_001",
  "object": "response.compaction",
  "created_at": 1764967971,
  "output": [
    {
      "id": "msg_000",
      "type": "message",
      "status": "completed",
      "content": [
        {
          "type": "input_text",
          "text": "Create a simple landing page for a dog petting cafe."
        }
      ],
      "role": "user"
    },
    {
      "id": "cmp_001",
      "type": "compaction",
      "encrypted_content": "gAAAAABpM0Yj-...="
    }
  ],
  "usage": {
    "input_tokens": 139,
    "input_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0
    },
    "output_tokens": 438,
    "output_tokens_details": {
      "reasoning_tokens": 64
    },
    "total_tokens": 577
  }
}
```

## Connect

Connect to a persistent Responses API WebSocket. Send `response.create` events to create responses and `response.steer` events to queue user input containing text, images, or files for a continuation. Receive response stream events and steering acceptance, pending, or failure events over the socket.

**WebSocket** `wss://api.openai.com/v1/responses`

### Example

```typescript
import OpenAI from 'openai';
import { ResponsesWS } from 'openai/resources/beta/responses/ws';

async function main() {
  const connection = new ResponsesWS(new OpenAI(), {
    headers: { 'OpenAI-Beta': 'responses_multi_agent=v1' },
  });
  const deadline = setTimeout(() => connection.close(), 60_000);
  try {
    for await (const item of connection) {
      if (item.type === 'open') {
        connection.send({
          type: 'response.create',
          model: 'gpt-6-astra',
          input: 'Say hello in one sentence.',
        });
      } else if (item.type === 'error') {
        throw item.error;
      } else if (item.type === 'message') {
        const event = item.message;
        if (event.type === 'response.output_text.delta') {
          process.stdout.write(event.delta);
        } else if (event.type === 'response.completed') {
          process.stdout.write('\n');
          return;
        } else if (event.type === 'response.failed' || event.type === 'response.incomplete') {
          throw new Error(`Response ended: ${event.type}`);
        }
      }
    }
    throw new Error('Connection closed or timed out before the response completed.');
  } finally {
    clearTimeout(deadline);
    connection.close();
  }
}

await main();
```

## Create a model response

`client.beta.responses.create(ResponseCreateParamsparams, RequestOptionsoptions?): BetaResponse | Stream<BetaResponseStreamEvent>`

**post** `/responses?beta=true`

Creates a model response. Provide [text](/api/docs/guides/text) or
[image](/api/docs/guides/images-vision) inputs to generate [text](/api/docs/guides/text)
or [JSON](/api/docs/guides/structured-outputs) outputs. Have the model call
your own [custom code](/api/docs/guides/function-calling) or use built-in
[tools](/api/docs/guides/tools) like [web search](/api/docs/guides/tools-web-search)
or [file search](/api/docs/guides/tools-file-search) to use your own data
as input for the model's response.

### Parameters

- `ResponseCreateParams = ResponseCreateParamsNonStreaming | ResponseCreateParamsStreaming`

  - `ResponseCreateParamsBase`

    - `access_programs?: AccessPrograms`

      Body param: Domain-specific access programs to use for this request.

      - `cyber?: "standard" | "daybreak_blue" | "daybreak_red"`

        The Cyber access program to use for this request. Supported values are `standard`, `daybreak_blue`, and `daybreak_red`. If omitted, the API resolves the program from the model's Cyber tier and your organization and project access, subject to model-specific eligibility restrictions. By default, models without a Cyber tier use Standard. Blue-tier models use Daybreak Blue when authorized; otherwise they fall back to Standard unless the model requires Daybreak access. Red-tier models use Daybreak Red and require authorization. Requests that require unavailable Daybreak access return 403. An implicit Standard fallback is represented by null in the response's access_programs field, rather than an explicit Standard selection.

        - `"standard"`

        - `"daybreak_blue"`

        - `"daybreak_red"`

    - `background?: boolean | null`

      Body param: Whether to run the model response in the background.
      [Learn more](/api/docs/guides/background).

    - `context_management?: Array<ContextManagement> | null`

      Body param: Context management configuration for this request.

      `minItems: 1`

      - `type: string`

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

      - `compact_threshold?: number | null`

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

        `minimum: 1000`

    - `conversation?: string | BetaResponseConversationParam | null`

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

      - `string`

      - `BetaResponseConversationParam`

        The conversation that this response belongs to.

        - `id: string`

          The unique ID of the conversation.

    - `image?: Image`

      Body param: Request level image options.

      - `context_compression?: "auto" | "enabled" | "disabled"`

        Controls image context optimization. Defaults to `auto`, which uses the model, transport, and input to select a policy. Use `enabled` to require compression support or `disabled` to turn it off.

        - `"auto"`

        - `"enabled"`

        - `"disabled"`

    - `include?: Array<BetaResponseIncludable> | null`

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

      - `web_search_call.action.sources`: Include the sources of the web search tool call.
      - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items.
      - `computer_call_output.output.image_url`: Include image urls from the computer call output.
      - `file_search_call.results`: Include the search results of the file search tool call.
      - `message.input_image.image_url`: Include image urls from the input message.
      - `message.output_text.logprobs`: Include logprobs with assistant messages.
      - `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program).

      - `"file_search_call.results"`

      - `"web_search_call.results"`

      - `"web_search_call.action.sources"`

      - `"message.input_image.image_url"`

      - `"computer_call_output.output.image_url"`

      - `"code_interpreter_call.outputs"`

      - `"reasoning.encrypted_content"`

      - `"message.output_text.logprobs"`

    - `input?: string | BetaResponseInput`

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

      Learn more:

      - [Text inputs and outputs](/api/docs/guides/text)
      - [Image inputs](/api/docs/guides/images-vision)
      - [File inputs](/api/docs/guides/file-inputs)
      - [Conversation state](/api/docs/guides/conversation-state)
      - [Function calling](/api/docs/guides/function-calling)

      - `string`

      - `BetaResponseInput = Array<BetaResponseInputItem>`

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

        - `BetaEasyInputMessage`

          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.

            - `string`

            - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

              A list of one or many input items to the model, containing different content
              types.

              - `BetaResponseInputText`

                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`.

                  - `"input_text"`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImage`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

                - `detail: BetaImageDetail`

                  The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                  - `"low"`

                  - `"high"`

                  - `"auto"`

                  - `"original"`

                - `type: "input_image"`

                  The type of the input item. Always `input_image`.

                  - `"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.

                  `format: uri`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFile`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"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`.

                  - `"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.

                  `format: uri`

                - `filename?: string`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

          - `role: "user" | "assistant" | "system" | "developer"`

            The role of the message input. One of `user`, `assistant`, `system`, or
            `developer`.

            - `"user"`

            - `"assistant"`

            - `"system"`

            - `"developer"`

          - `phase?: "commentary" | "final_answer" | 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.

            - `"commentary"`

            - `"final_answer"`

          - `type?: "message"`

            The type of the message input. Always `message`.

            - `"message"`

        - `Message`

          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.

          - `content: BetaResponseInputMessageContentList`

            A list of one or many input items to the model, containing different content
            types.

          - `role: "user" | "system" | "developer"`

            The role of the message input. One of `user`, `system`, or `developer`.

            - `"user"`

            - `"system"`

            - `"developer"`

          - `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"`

            The status of item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type?: "message"`

            The type of the message input. Always set to `message`.

            - `"message"`

        - `BetaResponseOutputMessage`

          An output message from the model.

          - `id: string`

            The unique ID of the output message.

          - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

            The content of the output message.

            - `BetaResponseOutputText`

              A text output from the model.

              - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

                The annotations of the text output.

                - `FileCitation`

                  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 in the output text at which to insert the file citation.

                  - `type: "file_citation"`

                    The type of the file citation. Always `file_citation`.

                    - `"file_citation"`

                - `URLCitation`

                  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_citation"`

                  - `url: string`

                    The URL of the web resource.

                    `format: uri`

                - `ContainerFileCitation`

                  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`.

                    - `"container_file_citation"`

                - `FilePath`

                  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`.

                    - `"file_path"`

              - `text: string`

                The text output from the model.

              - `type: "output_text"`

                The type of the output text. Always `output_text`.

                - `"output_text"`

              - `logprobs?: Array<Logprob>`

                - `token: string`

                - `bytes: Array<number>`

                - `logprob: number`

                - `top_logprobs: Array<TopLogprob>`

                  - `token: string`

                  - `bytes: Array<number>`

                  - `logprob: number`

            - `BetaResponseOutputRefusal`

              A refusal from the model.

              - `refusal: string`

                The refusal explanation from the model.

              - `type: "refusal"`

                The type of the refusal. Always `refusal`.

                - `"refusal"`

          - `role: "assistant"`

            The role of the output message. Always `assistant`.

            - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "message"`

            The type of the output message. Always `message`.

            - `"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" | "final_answer" | 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.

            - `"commentary"`

            - `"final_answer"`

        - `BetaResponseFileSearchToolCall`

          The results of a file search tool call. See the
          [file search guide](/api/docs/guides/tools-file-search) 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`,

            - `"in_progress"`

            - `"searching"`

            - `"completed"`

            - `"incomplete"`

            - `"failed"`

          - `type: "file_search_call"`

            The type of the file search tool call. Always `file_search_call`.

            - `"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.

              - `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.

              `format: float`

            - `text?: string`

              The text that was retrieved from the file.

        - `BetaResponseComputerToolCall`

          A tool call to a computer use tool. See the
          [computer use guide](/api/docs/guides/tools-computer-use) 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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "computer_call"`

            The type of the computer call. Always `computer_call`.

            - `"computer_call"`

          - `action?: BetaComputerAction`

            A click action.

            - `Click`

              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`.

                - `"left"`

                - `"right"`

                - `"wheel"`

                - `"back"`

                - `"forward"`

              - `type: "click"`

                Specifies the event type. For a click action, this property is always `click`.

                - `"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`

              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`.

                - `"double_click"`

              - `x: number`

                The x-coordinate where the double click occurred.

              - `y: number`

                The y-coordinate where the double click occurred.

            - `Drag`

              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`.

                - `"drag"`

              - `keys?: Array<string> | null`

                The keys being held while dragging the mouse.

            - `Keypress`

              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`.

                - `"keypress"`

            - `Move`

              A mouse move action.

              - `type: "move"`

                Specifies the event type. For a move action, this property is always set to `move`.

                - `"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`

              A screenshot action.

              - `type: "screenshot"`

                Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

                - `"screenshot"`

            - `Scroll`

              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`.

                - `"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`

              An action to type in text.

              - `text: string`

                The text to type.

              - `type: "type"`

                Specifies the event type. For a type action, this property is always set to `type`.

                - `"type"`

            - `Wait`

              A wait action.

              - `type: "wait"`

                Specifies the event type. For a wait action, this property is always set to `wait`.

                - `"wait"`

          - `actions?: BetaComputerActionList`

            Flattened batched actions for `computer_use`. Each action includes an
            `type` discriminator and action-specific fields.

            - `Click`

              A click action.

            - `DoubleClick`

              A double click action.

            - `Drag`

              A drag action.

            - `Keypress`

              A collection of keypresses the model would like to perform.

            - `Move`

              A mouse move action.

            - `Screenshot`

              A screenshot action.

            - `Scroll`

              A scroll action.

            - `Type`

              An action to type in text.

            - `Wait`

              A wait action.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCallOutput`

          The output of a computer tool call.

          - `call_id: string`

            The ID of the computer tool call that produced the output.

            `minLength: 1`, `maxLength: 64`

          - `output: BetaResponseComputerToolCallOutputScreenshot`

            A computer screenshot image used with the computer use tool.

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is
              always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `file_id?: string`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url?: string`

              The URL of the screenshot image.

              `format: uri`

          - `type: "computer_call_output"`

            The type of the computer tool call output. Always `computer_call_output`.

            - `"computer_call_output"`

          - `id?: string | null`

            The ID of the computer tool call output.

          - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

            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.

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseFunctionWebSearch`

          The results of a web search tool call. See the
          [web search guide](/api/docs/guides/tools-web-search) for more information.

          - `id: string`

            The unique ID of the web search tool call.

          - `action: Search | OpenPage | FindInPage`

            An object describing the specific action taken in this web search call.
            Includes details on how the model used the web (search, open_page, find_in_page).

            - `Search`

              Action type "search" - Performs a web search query.

              - `type: "search"`

                The action type.

                - `"search"`

              - `queries?: Array<string>`

                The search queries.

              - `query?: string`

                The search query.

              - `sources?: Array<Source>`

                The sources used in the search.

                - `type: "url"`

                  The type of source. Always `url`.

                  - `"url"`

                - `url: string`

                  The URL of the source.

                  `format: uri`

            - `OpenPage`

              Action type "open_page" - Opens a specific URL from search results.

              - `type: "open_page"`

                The action type.

                - `"open_page"`

              - `url?: string | null`

                The URL opened by the model.

                `format: uri`

            - `FindInPage`

              Action type "find_in_page": Searches for a pattern within a loaded page.

              - `pattern: string`

                The pattern or text to search for within the page.

              - `type: "find_in_page"`

                The action type.

                - `"find_in_page"`

              - `url: string`

                The URL of the page searched for the pattern.

                `format: uri`

          - `status: "in_progress" | "searching" | "completed" | 2 more`

            The status of the web search tool call.

            - `"in_progress"`

            - `"searching"`

            - `"completed"`

            - `"failed"`

            - `"incomplete"`

          - `type: "web_search_call"`

            The type of the web search tool call. Always `web_search_call`.

            - `"web_search_call"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `BetaResponseFunctionToolCall`

          A tool call to run a function. See the
          [function calling guide](/api/docs/guides/function-calling) 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`.

            - `"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.

          - `async?: boolean`

            Whether the function tool call runs asynchronously.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `FunctionCallOutput`

          The output of a function tool call.

          - `output: string | BetaResponseFunctionCallOutputItemList`

            Text, image, or file output of the function tool call.

            - `string`

            - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                  `maxLength: 10485760`

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImageContent`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

                - `type: "input_image"`

                  The type of the input item. Always `input_image`.

                  - `"input_image"`

                - `detail?: BetaImageDetail | null`

                  The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                - `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.

                  `maxLength: 20971520`, `format: uri`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFileContent`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"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`.

                  - `"auto"`

                  - `"low"`

                  - `"high"`

                - `file_data?: string | null`

                  The base64-encoded data of the file to be sent to the model.

                  `maxLength: 73400320`

                - `file_id?: string | null`

                  The ID of the file to be sent to the model.

                - `file_url?: string | null`

                  The URL of the file to be sent to the model.

                  `format: uri`

                - `filename?: string | null`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

          - `type: "function_call_output"`

            The type of the function tool call output. Always `function_call_output`.

            - `"function_call_output"`

          - `id?: string | null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the function tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name?: string | null`

            The name of the tool that produced the output.

            `minLength: 1`, `maxLength: 128`

          - `namespace?: string | null`

            The namespace of the tool that produced the output.

            `minLength: 1`, `maxLength: 128`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AgentMessage`

          A message routed between agents.

          - `author: string`

            The sending agent identity.

          - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

            Plaintext, image, or encrypted content sent between agents.

            - `BetaResponseInputTextContent`

              A text input to the model.

            - `BetaResponseInputImageContent`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `EncryptedContent`

              Opaque encrypted content that Responses API decrypts inside trusted model execution.

              - `encrypted_content: string`

                Opaque encrypted content.

                `maxLength: 10485760`

              - `type: "encrypted_content"`

                The type of the input item. Always `encrypted_content`.

                - `"encrypted_content"`

          - `recipient: string`

            The destination agent identity.

          - `type: "agent_message"`

            The item type. Always `agent_message`.

            - `"agent_message"`

          - `id?: string | null`

            The unique ID of this agent message item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCall`

          - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

            The multi-agent action that was executed.

            - `"spawn_agent"`

            - `"interrupt_agent"`

            - `"list_agents"`

            - `"send_message"`

            - `"followup_task"`

            - `"wait_agent"`

          - `arguments: string`

            The action arguments as a JSON string.

          - `call_id: string`

            The unique ID linking this call to its output.

            `minLength: 1`, `maxLength: 64`

          - `type: "multi_agent_call"`

            The item type. Always `multi_agent_call`.

            - `"multi_agent_call"`

          - `id?: string | null`

            The unique ID of this multi-agent call.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCallOutput`

          - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

            The multi-agent action that produced this result.

            - `"spawn_agent"`

            - `"interrupt_agent"`

            - `"list_agents"`

            - `"send_message"`

            - `"followup_task"`

            - `"wait_agent"`

          - `call_id: string`

            The unique ID of the multi-agent call.

            `minLength: 1`, `maxLength: 64`

          - `output: Array<Output>`

            Text output returned by the multi-agent action.

            - `text: string`

              The text content.

              `maxLength: 10485760`

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

            - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

              Citations associated with the text content.

              - `FileCitation`

                - `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.

                  `minimum: 0`

                - `type: "file_citation"`

                  The citation type. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation`

                - `end_index: number`

                  The index of the last character of the citation in the message.

                  `minimum: 0`

                - `start_index: number`

                  The index of the first character of the citation in the message.

                  `minimum: 0`

                - `title: string`

                  The title of the cited resource.

                - `type: "url_citation"`

                  The citation type. Always `url_citation`.

                  - `"url_citation"`

                - `url: string`

                  The URL of the cited resource.

                  `format: uri`

              - `ContainerFileCitation`

                - `container_id: string`

                  The ID of the container.

                - `end_index: number`

                  The index of the last character of the citation in the message.

                  `minimum: 0`

                - `file_id: string`

                  The ID of the container file.

                - `filename: string`

                  The filename of the container file cited.

                - `start_index: number`

                  The index of the first character of the citation in the message.

                  `minimum: 0`

                - `type: "container_file_citation"`

                  The citation type. Always `container_file_citation`.

                  - `"container_file_citation"`

          - `type: "multi_agent_call_output"`

            The item type. Always `multi_agent_call_output`.

            - `"multi_agent_call_output"`

          - `id?: string | null`

            The unique ID of this multi-agent call output.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ToolSearchCall`

          - `arguments: unknown`

            The arguments supplied to the tool search call.

          - `type: "tool_search_call"`

            The item type. Always `tool_search_call`.

            - `"tool_search_call"`

          - `id?: string | null`

            The unique ID of this tool search call.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the tool search call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `execution?: "server" | "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the tool search call.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseToolSearchOutputItemParam`

          - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

            The loaded tool definitions returned by the tool search output.

            - `BetaFunctionTool`

              Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

                - `"function"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

              - `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`

              A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

              - `type: "file_search"`

                The type of the file search tool. Always `file_search`.

                - `"file_search"`

              - `vector_store_ids: Array<string>`

                The IDs of the vector stores to search.

              - `filters?: ComparisonFilter | CompoundFilter | null`

                A filter to apply.

                - `ComparisonFilter`

                  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

                    - `"eq"`

                    - `"ne"`

                    - `"gt"`

                    - `"gte"`

                    - `"lt"`

                    - `"lte"`

                    - `"in"`

                    - `"nin"`

                  - `value: string | number | boolean | Array<string | number>`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `Array<string | number>`

                      - `string`

                      - `number`

                - `CompoundFilter`

                  Combine multiple filters using `and` or `or`.

                  - `filters: Array<ComparisonFilter | unknown>`

                    Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

                    - `ComparisonFilter`

                      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

                        - `"eq"`

                        - `"ne"`

                        - `"gt"`

                        - `"gte"`

                        - `"lt"`

                        - `"lte"`

                        - `"in"`

                        - `"nin"`

                      - `value: string | number | boolean | Array<string | number>`

                        The value to compare against the attribute key; supports string, number, or boolean types.

                        - `string`

                        - `number`

                        - `boolean`

                        - `Array<string | number>`

                          - `string`

                          - `number`

                    - `unknown`

                  - `type: "and" | "or"`

                    Type of operation: `and` or `or`.

                    - `"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`

                Ranking options for search.

                - `hybrid_search?: HybridSearch`

                  Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

                  - `embedding_weight: number`

                    The weight of the embedding in the reciprocal ranking fusion.

                  - `text_weight: number`

                    The weight of the text in the reciprocal ranking fusion.

                - `ranker?: "auto" | "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"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`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

              - `type: "computer"`

                The type of the computer tool. Always `computer`.

                - `"computer"`

            - `BetaComputerUsePreviewTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

              - `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.

                - `"windows"`

                - `"mac"`

                - `"linux"`

                - `"ubuntu"`

                - `"browser"`

              - `type: "computer_use_preview"`

                The type of the computer use tool. Always `computer_use_preview`.

                - `"computer_use_preview"`

            - `BetaWebSearchTool`

              Search the Internet for sources related to the prompt. Learn more about the
              [web search tool](/api/docs/guides/tools-web-search).

              - `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`.

                - `"web_search"`

                - `"web_search_2025_08_26"`

              - `external_web_access?: boolean`

                Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

              - `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.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `user_location?: UserLocation | null`

                The approximate location of the user. If omitted or null, defaults to the
                United States. To avoid this fallback, pass `{"type": "approximate"}` without
                location fields. To localize results, provide the relevant location fields.

                - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type?: "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

                - `"mcp"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools?: Array<string> | McpToolFilter | null`

                List of allowed tool names or a filter object.

                - `Array<string>`

                - `McpToolFilter`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

                This field is deprecated for models released after September 1, 2026.
                Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
                connect through a Secure MCP Tunnel.

                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`

                - `"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" | null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter`

                  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`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                      it will match this filter.

                    - `tool_names?: Array<string>`

                      List of allowed tool names.

                  - `never?: Never`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

                `format: uri`

              - `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`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string | CodeInterpreterToolAuto`

                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.

                - `string`

                - `CodeInterpreterToolAuto`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                      - `type: "disabled"`

                        Disable outbound network access. Always `disabled`.

                        - `"disabled"`

                    - `BetaContainerNetworkPolicyAllowlist`

                      - `allowed_domains: Array<string>`

                        A list of allowed domains when type is `allowlist`.

                        `minItems: 1`

                      - `type: "allowlist"`

                        Allow outbound network access only to specified domains. Always `allowlist`.

                        - `"allowlist"`

                      - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                        Optional domain-scoped secrets for allowlisted domains.

                        `minItems: 1`

                        - `domain: string`

                          The domain associated with the secret.

                          `minLength: 1`

                        - `name: string`

                          The name of the secret to inject for the domain.

                          `minLength: 1`

                        - `value: string`

                          The secret value to inject for the domain.

                          `minLength: 1`, `maxLength: 10485760`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action?: "generate" | "edit" | "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background?: "transparent" | "opaque" | "auto"`

                Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
                `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
                Transparent backgrounds are available for supported GPT Image models. For
                `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
                using `transparent`, set the output format to `png` or `webp`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `complexity?: "low" | "medium" | "high"`

                Computation spent planning the image, independently of rendering quality.
                Overrides the outer response's `reasoning.effort` for image generation.
                When omitted, inherits a supported outer reasoning effort or uses the
                image model's configured default.
                For SVG output, controls the reference image, not the SVG author's
                reasoning.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `frame_count?: number`

                Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

                `minimum: 2`, `maximum: 16`

              - `frame_duration_ms?: number`

                Duration of each GIF frame in milliseconds, rounded to 10 ms.
                Requires `output_format` to be `gif`. Default: 200.

                `minimum: 20`, `maximum: 2000`

              - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

                - `"high"`

                - `"low"`

              - `input_image_mask?: InputImageMask`

                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" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                Deprecated values:

                - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

                - `(string & {})`

                - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                  The image generation model to use. One of `gpt-image-1-mini`,
                  `gpt-image-1.5`, `gpt-image-2`,
                  `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                  `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                  `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                  `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                  `gpt-image-2`.

                  `gpt-image-1` was shut down on October 23, 2026. Use
                  `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                  - `"gpt-image-1"`

                  - `"gpt-image-1-mini"`

                  - `"gpt-image-2"`

                  - `"gpt-image-2-2026-04-21"`

                  - `"gpt-image-2.5-sunburst"`

                  - `"gpt-image-2.5-sunburst-2026-09-08"`

                  - `"gpt-image-2.5-flare"`

                  - `"gpt-image-2.5-flare-2026-09-08"`

                  - `"gpt-image-2.6-sunburst"`

                  - `"gpt-image-2.6-flare"`

                  - `"gpt-image-1.5"`

                  - `"chatgpt-image-latest"`

              - `moderation?: "auto" | "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression?: number`

                Compression level for the output image. Default: 100.

                `minimum: 0`, `maximum: 100`

              - `output_format?: "png" | "webp" | "jpeg" | 2 more`

                The output format of the generated image. One of `png`, `webp`, `jpeg`,
                `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
                that supports the selected format. GIF output does not support
                partial image streaming (`partial_images` greater than `0`),
                `input_image_mask`, or custom `output_compression`.
                Responses lifecycle events can still be streamed for GIF output.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

                - `"gif"`

                - `"svg"`

              - `partial_images?: number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

                `minimum: 0`, `maximum: 3`

              - `quality?: "low" | "medium" | "high" | 3 more`

                The quality of the generated image. The GPT image models support `low`,
                `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
                including their `2026-09-08` snapshots, also support `xhigh` and `max`.
                Default: `auto`.

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

                - `"auto"`

              - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

                - `(string & {})`

                - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

              - `svg?: Svg`

                SVG author model settings. Requires `output_format` to be `svg`.
                When SVG model selection is enabled, omitting this object uses the
                outer response model. Otherwise, the default SVG author is used and
                explicit model overrides are unavailable.

                - `model?: string`

                  `minLength: 1`

                - `reasoning?: Reasoning | null`

                  Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                  - `effort?: "none" | "minimal" | "low" | 4 more`

                    Controls how much effort the model should spend on reasoning for this request.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

            - `LocalShell`

              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`.

                - `"local_shell"`

            - `BetaFunctionShellTool`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

                - `BetaContainerAuto`

                  - `type: "container_auto"`

                    Automatically creates a container for this request

                    - `"container_auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                    - `BetaContainerNetworkPolicyAllowlist`

                  - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

                    An optional list of skills referenced by id or inline data.

                    `maxItems: 200`

                    - `BetaSkillReference`

                      - `skill_id: string`

                        The ID of the referenced skill.

                        `minLength: 1`, `maxLength: 64`

                      - `type: "skill_reference"`

                        References a skill created with the /v1/skills endpoint.

                        - `"skill_reference"`

                      - `version?: string`

                        Optional skill version. Use a positive integer or 'latest'. Omit for default.

                    - `BetaInlineSkill`

                      - `description: string`

                        The description of the skill.

                      - `name: string`

                        The name of the skill.

                      - `source: BetaInlineSkillSource`

                        Inline skill payload

                        - `data: string`

                          Base64-encoded skill zip bundle.

                          `minLength: 1`, `maxLength: 70254592`

                        - `media_type: "application/zip"`

                          The media type of the inline skill payload. Must be `application/zip`.

                          - `"application/zip"`

                        - `type: "base64"`

                          The type of the inline skill source. Must be `base64`.

                          - `"base64"`

                      - `type: "inline"`

                        Defines an inline skill for this request.

                        - `"inline"`

                - `BetaLocalEnvironment`

                  - `type: "local"`

                    Use a local computer environment.

                    - `"local"`

                  - `skills?: Array<BetaLocalSkill>`

                    An optional list of skills.

                    `maxItems: 200`

                    - `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: string`

                    The ID of the referenced container.

                  - `type: "container_reference"`

                    References a container created with the /v1/containers endpoint

                    - `"container_reference"`

            - `BetaCustomTool`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

                - `"custom"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `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 | Grammar`

                The input format for the custom tool. Default is unconstrained text.

                - `Text`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar`

                  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`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `BetaToolSearchOutputNamespaceTool`

              Groups function/custom tools under a shared namespace.

              - `description: string`

                A description of the namespace shown to the model.

              - `name: string`

                The namespace name used in tool calls (for example, `crm`).

                `minLength: 1`

              - `tools: Array<Function | BetaCustomTool>`

                The function/custom tools loaded inside this namespace.

                `minItems: 1`

                - `Function`

                  - `name: string`

                    The name of the loaded function tool.

                    `minLength: 1`, `maxLength: 128`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                    The tool invocation context(s).

                    `minItems: 1`

                    - `"direct"`

                    - `"programmatic"`

                  - `async?: boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `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`

                  A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

              - `type: "namespace"`

                The type of the tool. Always `namespace`.

                - `"namespace"`

            - `BetaToolSearchTool`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"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.

                - `"server"`

                - `"client"`

              - `parameters?: unknown`

                Parameter schema for a client-executed tool search tool.

            - `BetaWebSearchPreviewTool`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `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`.

                - `"web_search_preview"`

                - `"web_search_preview_2025_03_11"`

              - `search_content_types?: Array<"text" | "image">`

                - `"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.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `user_location?: UserLocation | null`

                The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

                - `type: "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `BetaApplyPatchTool`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

          - `type: "tool_search_output"`

            The item type. Always `tool_search_output`.

            - `"tool_search_output"`

          - `id?: string | null`

            The unique ID of this tool search output.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the tool search call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `execution?: "server" | "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the tool search output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AdditionalTools`

          - `role: "developer"`

            The role that provided the additional tools. Only `developer` is supported.

            - `"developer"`

          - `tools: Array<BetaTool>`

            A list of additional tools made available at this item.

            - `BetaFunctionTool`

              Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

            - `BetaFileSearchTool`

              A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

            - `BetaComputerTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `BetaComputerUsePreviewTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `BetaWebSearchTool`

              Search the Internet for sources related to the prompt. Learn more about the
              [web search tool](/api/docs/guides/tools-web-search).

            - `Mcp`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

                - `"mcp"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools?: Array<string> | McpToolFilter | null`

                List of allowed tool names or a filter object.

                - `Array<string>`

                - `McpToolFilter`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

                This field is deprecated for models released after September 1, 2026.
                Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
                connect through a Secure MCP Tunnel.

                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`

                - `"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" | null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter`

                  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`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                      it will match this filter.

                    - `tool_names?: Array<string>`

                      List of allowed tool names.

                  - `never?: Never`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

                `format: uri`

              - `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`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string | CodeInterpreterToolAuto`

                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.

                - `string`

                - `CodeInterpreterToolAuto`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                    - `BetaContainerNetworkPolicyAllowlist`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action?: "generate" | "edit" | "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background?: "transparent" | "opaque" | "auto"`

                Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
                `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
                Transparent backgrounds are available for supported GPT Image models. For
                `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
                using `transparent`, set the output format to `png` or `webp`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `complexity?: "low" | "medium" | "high"`

                Computation spent planning the image, independently of rendering quality.
                Overrides the outer response's `reasoning.effort` for image generation.
                When omitted, inherits a supported outer reasoning effort or uses the
                image model's configured default.
                For SVG output, controls the reference image, not the SVG author's
                reasoning.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `frame_count?: number`

                Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

                `minimum: 2`, `maximum: 16`

              - `frame_duration_ms?: number`

                Duration of each GIF frame in milliseconds, rounded to 10 ms.
                Requires `output_format` to be `gif`. Default: 200.

                `minimum: 20`, `maximum: 2000`

              - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

                - `"high"`

                - `"low"`

              - `input_image_mask?: InputImageMask`

                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" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                Deprecated values:

                - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

                - `(string & {})`

                - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                  The image generation model to use. One of `gpt-image-1-mini`,
                  `gpt-image-1.5`, `gpt-image-2`,
                  `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                  `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                  `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                  `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                  `gpt-image-2`.

                  `gpt-image-1` was shut down on October 23, 2026. Use
                  `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                  - `"gpt-image-1"`

                  - `"gpt-image-1-mini"`

                  - `"gpt-image-2"`

                  - `"gpt-image-2-2026-04-21"`

                  - `"gpt-image-2.5-sunburst"`

                  - `"gpt-image-2.5-sunburst-2026-09-08"`

                  - `"gpt-image-2.5-flare"`

                  - `"gpt-image-2.5-flare-2026-09-08"`

                  - `"gpt-image-2.6-sunburst"`

                  - `"gpt-image-2.6-flare"`

                  - `"gpt-image-1.5"`

                  - `"chatgpt-image-latest"`

              - `moderation?: "auto" | "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression?: number`

                Compression level for the output image. Default: 100.

                `minimum: 0`, `maximum: 100`

              - `output_format?: "png" | "webp" | "jpeg" | 2 more`

                The output format of the generated image. One of `png`, `webp`, `jpeg`,
                `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
                that supports the selected format. GIF output does not support
                partial image streaming (`partial_images` greater than `0`),
                `input_image_mask`, or custom `output_compression`.
                Responses lifecycle events can still be streamed for GIF output.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

                - `"gif"`

                - `"svg"`

              - `partial_images?: number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

                `minimum: 0`, `maximum: 3`

              - `quality?: "low" | "medium" | "high" | 3 more`

                The quality of the generated image. The GPT image models support `low`,
                `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
                including their `2026-09-08` snapshots, also support `xhigh` and `max`.
                Default: `auto`.

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

                - `"auto"`

              - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

                - `(string & {})`

                - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

              - `svg?: Svg`

                SVG author model settings. Requires `output_format` to be `svg`.
                When SVG model selection is enabled, omitting this object uses the
                outer response model. Otherwise, the default SVG author is used and
                explicit model overrides are unavailable.

                - `model?: string`

                  `minLength: 1`

                - `reasoning?: Reasoning | null`

                  Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                  - `effort?: "none" | "minimal" | "low" | 4 more`

                    Controls how much effort the model should spend on reasoning for this request.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

            - `LocalShell`

              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`.

                - `"local_shell"`

            - `BetaFunctionShellTool`

              A tool that allows the model to execute shell commands.

            - `BetaCustomTool`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `BetaNamespaceTool`

              Groups function/custom tools under a shared namespace.

              - `description: string`

                A description of the namespace shown to the model.

              - `name: string`

                The namespace name used in tool calls (for example, `crm`).

                `minLength: 1`

              - `tools: Array<Function | BetaCustomTool>`

                The function/custom tools available inside this namespace.

                `minItems: 1`

                - `Function`

                  - `name: string`

                    `minLength: 1`, `maxLength: 128`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                    The tool invocation context(s).

                    `minItems: 1`

                    - `"direct"`

                    - `"programmatic"`

                  - `async?: boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `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`

                  A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

              - `type: "namespace"`

                The type of the tool. Always `namespace`.

                - `"namespace"`

            - `BetaToolSearchTool`

              Hosted or BYOT tool search configuration for deferred tools.

            - `BetaWebSearchPreviewTool`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `BetaApplyPatchTool`

              Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "additional_tools"`

            The item type. Always `additional_tools`.

            - `"additional_tools"`

          - `id?: string | null`

            The unique ID of this additional tools item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `BetaResponseConfigurationUpdateItemParam`

          An update to the conversation's response configuration. Supply reasoning,
          text, or both. Each setting stays in effect until a later update replaces it.

          - `type: "configuration_update"`

            The item type. Always `configuration_update`.

            - `"configuration_update"`

          - `id?: string | null`

            The unique ID of the configuration update item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reasoning?: Reasoning`

            Updates to reasoning configuration. Only effort is supported.

            - `effort?: "none" | "minimal" | "low" | 4 more | null`

              The reasoning effort to use for subsequent responses until another
              configuration update replaces it.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

          - `text?: Text`

            The text output configuration for subsequent responses.

            - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

              Use a JSON schema for structured output or text to return to plain text.

              - `Text`

                Default response format. Used to generate text responses.

                - `type: "text"`

                  The type of response format being defined. Always `text`.

                  - `"text"`

              - `BetaResponseFormatTextJSONSchemaConfig`

                JSON Schema response format. Used to generate structured JSON responses.
                Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

                - `name: string`

                  The name of the response format. Must be a-z, A-Z, 0-9, or contain
                  underscores and dashes, with a maximum length of 64.

                - `schema: Record<string, unknown>`

                  The schema for the response format, described as a JSON Schema object.
                  Learn how to build JSON schemas [here](https://json-schema.org/).

                - `type: "json_schema"`

                  The type of response format being defined. Always `json_schema`.

                  - `"json_schema"`

                - `description?: string`

                  A description of what the response format is for, used by the model to
                  determine how to respond in the format.

                - `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](/api/docs/guides/structured-outputs).

        - `BetaResponseReasoningItem`

          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](/api/docs/guides/conversation-state).

          - `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`.

              - `"summary_text"`

          - `type: "reasoning"`

            The type of the object. Always `reasoning`.

            - `"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`.

              - `"reasoning_text"`

          - `encrypted_content?: string | null`

            The encrypted content of the reasoning item. This is populated by default
            for reasoning items returned by `POST /v1/responses` and WebSocket
            `response.create` requests.

            When streaming, use the completed reasoning item and its
            `encrypted_content` from the `response.output_item.done` event in
            subsequent requests. The `encrypted_content` in
            `response.output_item.added` may be incomplete. This is especially
            important when `store` is `false` or when using Zero Data Retention.

          - `status?: "in_progress" | "completed" | "incomplete"`

            The status of the item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseCompactionItemParam`

          A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

          - `encrypted_content: string`

            The encrypted content of the compaction summary.

            `maxLength: 104857600`

          - `type: "compaction"`

            The type of the item. Always `compaction`.

            - `"compaction"`

          - `id?: string | null`

            The ID of the compaction item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ImageGenerationCall`

          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.

            - `"in_progress"`

            - `"completed"`

            - `"generating"`

            - `"failed"`

          - `type: "image_generation_call"`

            The type of the image generation call. Always `image_generation_call`.

            - `"image_generation_call"`

          - `action?: "generate" | "edit" | "auto" | null`

            The action used for image generation.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `background?: "transparent" | "opaque" | "auto" | null`

            The background setting used for generation.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `error?: Error`

            Details of a moderation failure, when available.

            - `code: string | null`

              The error code.

            - `message: string`

              A description of the error.

            - `param: string | null`

              The related request parameter.

            - `type: string`

              The error type.

            - `moderation_details?: ModerationDetails`

              Public details for a `moderation_blocked` error, when available.

              - `categories: Array<string>`

                Public moderation categories. New category values may be added over time.

              - `moderation_stage: "input" | "output" | "unknown"`

                The stage where moderation blocked the image generation call.

                - `"input"`

                - `"output"`

                - `"unknown"`

          - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

            The output format used for generation.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

            - `"gif"`

            - `"svg"`

          - `quality?: "low" | "medium" | "high" | 3 more | null`

            The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

            - `"auto"`

          - `revised_prompt?: string | null`

            The prompt that was used after any model prompt rewriting.

          - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `(string & {})`

            - `"1024x1024" | "1024x1536" | "1536x1024"`

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

          - `svg_usage?: SvgUsage`

            - `input_tokens: number`

            - `model: string`

            - `output_tokens: number`

            - `reasoning_tokens: number`

            - `total_tokens: number`

        - `BetaResponseCodeInterpreterToolCall`

          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 | Image> | null`

            The outputs generated by the code interpreter, such as logs or images.
            Can be null if no outputs are available.

            - `Logs`

              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`.

                - `"logs"`

            - `Image`

              The image output from the code interpreter.

              - `type: "image"`

                The type of the output. Always `image`.

                - `"image"`

              - `url: string`

                The URL of the image output from the code interpreter.

                `format: uri`

          - `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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"interpreting"`

            - `"failed"`

          - `type: "code_interpreter_call"`

            The type of the code interpreter tool call. Always `code_interpreter_call`.

            - `"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`

          A tool call to run a command on the local shell.

          - `id: string`

            The unique ID of the local shell call.

          - `action: Action`

            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`.

              - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "local_shell_call"`

            The type of the local shell call. Always `local_shell_call`.

            - `"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`

          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`.

            - `"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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCall`

          A tool representing a request to execute one or more shell commands.

          - `action: Action`

            The shell commands and limits that describe how to run the tool call.

            - `commands: Array<string>`

              Ordered shell commands for the execution environment to run.

            - `max_output_length?: number | null`

              Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

            - `timeout_ms?: number | null`

              Maximum wall-clock time in milliseconds to allow the shell commands to run.

          - `call_id: string`

            The unique ID of the shell tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `type: "shell_call"`

            The type of the item. Always `shell_call`.

            - `"shell_call"`

          - `id?: string | null`

            The unique ID of the shell tool call. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

            The environment to execute the shell commands in.

            - `BetaLocalEnvironment`

            - `BetaContainerReference`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCallOutput`

          The streamed output items emitted by a shell tool call.

          - `call_id: string`

            The unique ID of the shell tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `output: Array<BetaResponseFunctionShellCallOutputContent>`

            Captured chunks of stdout and stderr output, along with their associated outcomes.

            - `outcome: Timeout | Exit`

              The exit or timeout outcome associated with this shell call.

              - `Timeout`

                Indicates that the shell call exceeded its configured time limit.

                - `type: "timeout"`

                  The outcome type. Always `timeout`.

                  - `"timeout"`

              - `Exit`

                Indicates that the shell commands finished and returned an exit code.

                - `exit_code: number`

                  The exit code returned by the shell process.

                - `type: "exit"`

                  The outcome type. Always `exit`.

                  - `"exit"`

            - `stderr: string`

              Captured stderr output for the shell call.

              `maxLength: 10485760`

            - `stdout: string`

              Captured stdout output for the shell call.

              `maxLength: 10485760`

          - `type: "shell_call_output"`

            The type of the item. Always `shell_call_output`.

            - `"shell_call_output"`

          - `id?: string | null`

            The unique ID of the shell tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `max_output_length?: number | null`

            The maximum number of UTF-8 characters captured for this shell call's combined output.

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the shell call output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ApplyPatchCall`

          A tool call representing a request to create, delete, or update files using diff patches.

          - `call_id: string`

            The unique ID of the apply patch tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `operation: CreateFile | DeleteFile | UpdateFile`

            The specific create, delete, or update instruction for the apply_patch tool call.

            - `CreateFile`

              Instruction for creating a new file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply when creating the file.

                `maxLength: 10485760`

              - `path: string`

                Path of the file to create relative to the workspace root.

                `minLength: 1`

              - `type: "create_file"`

                The operation type. Always `create_file`.

                - `"create_file"`

            - `DeleteFile`

              Instruction for deleting an existing file via the apply_patch tool.

              - `path: string`

                Path of the file to delete relative to the workspace root.

                `minLength: 1`

              - `type: "delete_file"`

                The operation type. Always `delete_file`.

                - `"delete_file"`

            - `UpdateFile`

              Instruction for updating an existing file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply to the existing file.

                `maxLength: 10485760`

              - `path: string`

                Path of the file to update relative to the workspace root.

                `minLength: 1`

              - `type: "update_file"`

                The operation type. Always `update_file`.

                - `"update_file"`

          - `status: "in_progress" | "completed"`

            The status of the apply patch tool call. One of `in_progress` or `completed`.

            - `"in_progress"`

            - `"completed"`

          - `type: "apply_patch_call"`

            The type of the item. Always `apply_patch_call`.

            - `"apply_patch_call"`

          - `id?: string | null`

            The unique ID of the apply patch tool call. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `ApplyPatchCallOutput`

          The streamed output emitted by an apply patch tool call.

          - `call_id: string`

            The unique ID of the apply patch tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `status: "completed" | "failed"`

            The status of the apply patch tool call output. One of `completed` or `failed`.

            - `"completed"`

            - `"failed"`

          - `type: "apply_patch_call_output"`

            The type of the item. Always `apply_patch_call_output`.

            - `"apply_patch_call_output"`

          - `id?: string | null`

            The unique ID of the apply patch tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `output?: string | null`

            Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

            `maxLength: 10485760`

        - `McpListTools`

          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`.

            - `"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`

          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`.

            - `"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`

          A response to an MCP approval request.

          - `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`.

            - `"mcp_approval_response"`

          - `id?: string | null`

            The unique ID of the 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.

        - `McpCall`

          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`.

            - `"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?: BetaMcpToolCallError | null`

            The error from the tool call, if any.

            - `McpProtocolError`

              - `code: number`

              - `message: string`

              - `type: "mcp_protocol_error"`

                - `"mcp_protocol_error"`

            - `McpToolExecutionError`

              - `content: unknown`

              - `type: "mcp_tool_execution_error"`

                - `"mcp_tool_execution_error"`

            - `HTTPError`

              - `code: number`

              - `message: string`

              - `type: "http_error"`

                - `"http_error"`

          - `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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"calling"`

            - `"failed"`

        - `BetaResponseCustomToolCallOutput`

          The output of a custom tool call from your code, being sent back to the model.

          - `call_id: string`

            The call ID, used to map this custom tool call output to a custom tool call.

          - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            The output from the custom tool call generated by your code.
            Can be a string or an list of output content.

            - `string`

            - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

              - `BetaResponseInputText`

                A text input to the model.

              - `BetaResponseInputImage`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile`

                A file input to the model.

          - `type: "custom_tool_call_output"`

            The type of the custom tool call output. Always `custom_tool_call_output`.

            - `"custom_tool_call_output"`

          - `id?: string`

            The unique ID of the custom tool call output 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 | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `BetaResponseCustomToolCall`

          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`.

            - `"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.

          - `async?: boolean`

            Whether the custom tool call runs asynchronously.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace?: string`

            The namespace of the custom tool being called.

        - `CompactionTrigger`

          Compacts the current context. Must be the final input item.

          - `type: "compaction_trigger"`

            The type of the item. Always `compaction_trigger`.

            - `"compaction_trigger"`

          - `id?: string | null`

            The unique ID of this compaction trigger.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ItemReference`

          An internal identifier for an item to reference.

          - `id: string`

            The ID of the item to reference.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `type?: "item_reference" | null`

            The type of item to reference. Always `item_reference`.

            - `"item_reference"`

        - `Program`

          - `id: string`

            The unique ID of this program item.

          - `call_id: string`

            The stable call ID of the program item.

            `minLength: 1`, `maxLength: 64`

          - `code: string`

            The JavaScript source executed by programmatic tool calling.

            `maxLength: 10485760`

          - `fingerprint: string`

            Opaque program replay fingerprint that must be round-tripped.

            `maxLength: 10485760`

          - `type: "program"`

            The item type. Always `program`.

            - `"program"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ProgramOutput`

          - `id: string`

            The unique ID of this program output item.

          - `call_id: string`

            The call ID of the program item.

            `minLength: 1`, `maxLength: 64`

          - `result: string`

            The result produced by the program item.

            `maxLength: 10485760`

          - `status: "completed" | "incomplete"`

            The terminal status of the program output.

            - `"completed"`

            - `"incomplete"`

          - `type: "program_output"`

            The item type. Always `program_output`.

            - `"program_output"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

    - `instructions?: string | null`

      Body param: A system (or developer) message inserted into the model's context.

      When using along with `previous_response_id`, the instructions from a previous
      response will not be carried over to the next response. This makes it simple
      to swap out system (or developer) messages in new responses.

    - `max_output_tokens?: number | null`

      Body param: An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/api/docs/guides/reasoning).

      `minimum: 16`

    - `max_tool_calls?: number | null`

      Body param: The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

    - `metadata?: Record<string, string> | null`

      Body param: 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?: "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more | (string & {})`

      Body param: Model ID used to generate the response, like `gpt-6-astra`. OpenAI
      offers a wide range of models with different capabilities, performance
      characteristics, and price points. Refer to the [model guide](/api/docs/models)
      to browse and compare available models.

      - `"gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more`

        Model ID used to generate the response, like `gpt-6-astra`. OpenAI
        offers a wide range of models with different capabilities, performance
        characteristics, and price points. Refer to the [model guide](/api/docs/models)
        to browse and compare available models.

        - `"gpt-6-astra"`

        - `"gpt-6.1-sol"`

        - `"gpt-6.1-terra"`

        - `"gpt-6-sol"`

        - `"gpt-6-luna"`

        - `"gpt-5.6-sol"`

        - `"gpt-5.6-terra"`

        - `"gpt-5.6-luna"`

        - `"gpt-5.5"`

        - `"gpt-5.5-2026-04-23"`

        - `"gpt-5.4"`

        - `"gpt-5.4-mini"`

        - `"gpt-5.4-nano"`

        - `"gpt-5.4-mini-2026-03-17"`

        - `"gpt-5.4-nano-2026-03-17"`

        - `"gpt-5.3-chat-latest"`

        - `"gpt-5.2"`

        - `"gpt-5.2-2025-12-11"`

        - `"gpt-5.2-chat-latest"`

        - `"gpt-5.2-pro"`

        - `"gpt-5.2-pro-2025-12-11"`

        - `"gpt-5.1"`

        - `"gpt-5.1-2025-11-13"`

        - `"gpt-5.1-codex"`

        - `"gpt-5.1-mini"`

        - `"gpt-5.1-chat-latest"`

        - `"gpt-5"`

        - `"gpt-5-mini"`

        - `"gpt-5-nano"`

        - `"gpt-5-2025-08-07"`

        - `"gpt-5-mini-2025-08-07"`

        - `"gpt-5-nano-2025-08-07"`

        - `"gpt-5-chat-latest"`

        - `"gpt-4.1"`

        - `"gpt-4.1-mini"`

        - `"gpt-4.1-nano"`

        - `"gpt-4.1-2025-04-14"`

        - `"gpt-4.1-mini-2025-04-14"`

        - `"gpt-4.1-nano-2025-04-14"`

        - `"o4-mini"`

        - `"o4-mini-2025-04-16"`

        - `"o3"`

        - `"o3-2025-04-16"`

        - `"o3-mini"`

        - `"o3-mini-2025-01-31"`

        - `"o1"`

        - `"o1-2024-12-17"`

        - `"o1-preview"`

        - `"o1-preview-2024-09-12"`

        - `"o1-mini"`

        - `"o1-mini-2024-09-12"`

        - `"gpt-4o"`

        - `"gpt-4o-2024-11-20"`

        - `"gpt-4o-2024-08-06"`

        - `"gpt-4o-2024-05-13"`

        - `"gpt-audio-mini"`

        - `"gpt-audio-mini-2025-12-15"`

        - `"gpt-4o-audio-preview"`

        - `"gpt-4o-audio-preview-2024-10-01"`

        - `"gpt-4o-audio-preview-2024-12-17"`

        - `"gpt-4o-audio-preview-2025-06-03"`

        - `"gpt-4o-mini-audio-preview"`

        - `"gpt-4o-mini-audio-preview-2024-12-17"`

        - `"gpt-4o-search-preview"`

        - `"gpt-4o-mini-search-preview"`

        - `"gpt-4o-search-preview-2025-03-11"`

        - `"gpt-4o-mini-search-preview-2025-03-11"`

        - `"chatgpt-4o-latest"`

        - `"codex-mini-latest"`

        - `"gpt-4o-mini"`

        - `"gpt-4o-mini-2024-07-18"`

        - `"gpt-4-turbo"`

        - `"gpt-4-turbo-2024-04-09"`

        - `"gpt-4-0125-preview"`

        - `"gpt-4-turbo-preview"`

        - `"gpt-4-1106-preview"`

        - `"gpt-4-vision-preview"`

        - `"gpt-4"`

        - `"gpt-4-0314"`

        - `"gpt-4-0613"`

        - `"gpt-4-32k"`

        - `"gpt-4-32k-0314"`

        - `"gpt-4-32k-0613"`

        - `"gpt-3.5-turbo"`

        - `"gpt-3.5-turbo-16k"`

        - `"gpt-3.5-turbo-0301"`

        - `"gpt-3.5-turbo-0613"`

        - `"gpt-3.5-turbo-1106"`

        - `"gpt-3.5-turbo-0125"`

        - `"gpt-3.5-turbo-16k-0613"`

        - `"o1-pro"`

        - `"o1-pro-2025-03-19"`

        - `"o3-pro"`

        - `"o3-pro-2025-06-10"`

        - `"o3-deep-research"`

        - `"o3-deep-research-2025-06-26"`

        - `"o4-mini-deep-research"`

        - `"o4-mini-deep-research-2025-06-26"`

        - `"computer-use-preview"`

        - `"computer-use-preview-2025-03-11"`

        - `"gpt-5.5-pro"`

        - `"gpt-5.5-pro-2026-04-23"`

        - `"gpt-5-codex"`

        - `"gpt-5-pro"`

        - `"gpt-5-pro-2025-10-06"`

        - `"gpt-5.1-codex-max"`

        - `"gpt-daybreak-blue-latest"`

        - `"gpt-daybreak-red-latest"`

        - `"gpt-5.6-cyber"`

        - `"gpt-6-cyber"`

        - `"gpt-rosalind-research"`

        - `"gpt-6-rosalind"`

      - `(string & {})`

    - `moderation?: Moderation | null`

      Body param: Configuration for running moderation on the input and output of this response.

      - `model: string`

        The moderation model to use for moderated completions, e.g. 'omni-moderation-latest'.

      - `policy?: Policy | null`

        The policy to apply to moderated response input and output.

        - `input?: Input | null`

          The moderation policy for the response input.

          - `mode: "score" | "block"`

            - `"score"`

            - `"block"`

        - `output?: Output | null`

          The moderation policy for the response output.

          - `mode: "score" | "block"`

            - `"score"`

            - `"block"`

    - `multi_agent?: MultiAgent | null`

      Body param: Configuration for server-hosted multi-agent execution.

      - `enabled: boolean`

        Whether to enable server-hosted multi-agent execution for this response.

      - `max_concurrent_subagents?: number`

        `max_concurrent_subagents` sets the maximum number of subagents that can be active simultaneously across the entire agent tree. It includes all descendants—children, grandchildren, and deeper subagents—but excludes the root agent.
        The API does not impose a fixed upper bound on this setting. The default is `3`, which is recommended for most workloads. Multi-agent runs also have no fixed limit on tree depth or the total number of subagents created during a run.

        `minimum: 1`

    - `parallel_tool_calls?: boolean | null`

      Body param: Whether to allow the model to run tool calls in parallel.

    - `previous_response_id?: string | null`

      Body param: The unique ID of the previous response to the model. Use this to
      create multi-turn conversations. Learn more about
      [conversation state](/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.

    - `prompt?: BetaResponsePrompt | null`

      Body param: Reference to a prompt template and its variables.
      [Learn more](/api/docs/guides/text?api-mode=responses#version-prompts-in-code).

      - `id: string`

        The unique identifier of the prompt template to use.

      - `variables?: Record<string, string | BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile> | null`

        Optional map of values to substitute in for variables in your
        prompt. The substitution values can either be strings, or other
        Response input types like images or files.

        - `string`

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile`

          A file input to the model.

      - `version?: string | null`

        Optional version of the prompt template.

    - `prompt_cache_key?: string | null`

      Body param: Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/api/docs/guides/prompt-caching).

    - `prompt_cache_options?: PromptCacheOptions`

      Body param: Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the [prompt caching guide](/api/docs/guides/prompt-caching) for current details.

      - `comparison_response_id?: string | null`

        The ID of a response to compare when diagnosing prompt cache reuse. Supplying this field requests prompt cache diagnostics when the feature is enabled.

      - `mode?: "implicit" | "explicit"`

        Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching.

        - `"implicit"`

        - `"explicit"`

      - `prewarm?: boolean`

        Prepares the prompt cache without generating output. Defaults to `false`. When set to `true`, overrides the `generate` field to `false`.

      - `ttl?: "30m" | "12h"`

        The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Supported values are `30m` (the default) and `12h`. The backend may retain cache entries for longer.

        - `"30m"`

        - `"12h"`

    - `prompt_cache_retention?: "in_memory" | "24h" | null`

      Body param: Deprecated. Use `prompt_cache_options.ttl` instead.

      The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/api/docs/guides/prompt-caching#prompt-cache-retention).
      This field expresses a maximum retention policy, while
      `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two
      fields are independent and do not interact.
      For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported.

      For older models that support both `in_memory` and `24h`, the default depends on your organization's data retention policy:

      - Organizations without ZDR enabled default to `24h`.
      - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified.

      - `"in_memory"`

      - `"24h"`

    - `reasoning?: Reasoning | null`

      Body param: Configuration options for
      [reasoning models](/api/docs/guides/reasoning).

      - `context?: "auto" | "current_turn" | "all_turns" | null`

        Controls which reasoning items are rendered back to the model on later turns.
        If omitted or set to `auto`, the model determines the context mode. The
        `gpt-5.6` model family defaults to `all_turns`; earlier models default to
        `current_turn`.

        When returned on a response, this is the effective reasoning context mode
        used for the response.

        - `"auto"`

        - `"current_turn"`

        - `"all_turns"`

      - `effort?: "none" | "minimal" | "low" | 4 more | null`

        Constrains effort on reasoning for reasoning models. Currently supported
        values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
        Reducing reasoning effort can result in faster responses and fewer tokens
        used on reasoning in a response. Not all reasoning models support every
        value. See the
        [reasoning guide](/api/docs/guides/reasoning)
        for model-specific support.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `generate_summary?: "auto" | "concise" | "detailed" | null`

        **Deprecated:** use `summary` instead.

        A summary of the reasoning performed by the model. This can be
        useful for debugging and understanding the model's reasoning process.
        One of `auto`, `concise`, or `detailed`.

        - `"auto"`

        - `"concise"`

        - `"detailed"`

      - `mode?: (string & {}) | "standard" | "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `(string & {})`

        - `"standard" | "pro"`

          - `"standard"`

          - `"pro"`

      - `summary?: "auto" | "concise" | "detailed" | null`

        A summary of the reasoning performed by the model. This can be
        useful for debugging and understanding the model's reasoning process.
        One of `auto`, `concise`, or `detailed`.

        `concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.

        - `"auto"`

        - `"concise"`

        - `"detailed"`

    - `safety_identifier?: string | null`

      Body param: A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.
      The IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

      `maxLength: 128`

    - `service_tier?: BetaServiceTier | null`

      Body param: Specifies the processing type used for serving the request.

      - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
      - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
      - If set to '[flex](/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.
      - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.
      - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for `gpt-5.6-sol`; a response served through it will show `service_tier=ultrafast`.
      - When not set, the default behavior is 'auto'.

      When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

      - `"auto"`

      - `"default"`

      - `"flex"`

      - `"scale"`

      - `"priority"`

      - `"fast"`

      - `"ultrafast"`

    - `store?: boolean | null`

      Body param: Whether to store the generated model response for later retrieval via
      API.
      Defaults to true when omitted.
      If set to true, response data will be stored for at least 30 days, subject to the [data retention exceptions](/api/docs/guides/your-data#v1responses).

    - `stream?: false | null`

      Body param: If set to true, the model response data will be streamed to the client
      as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
      See the [Streaming section below](/api/reference/resources/responses/streaming-events)
      for more information.

      - `false`

    - `stream_options?: StreamOptions | null`

      Body param: Options for streaming responses. Only set this when you set `stream: true`.

      - `include_obfuscation?: boolean`

        When true, stream obfuscation will be enabled. Stream obfuscation adds
        random characters to an `obfuscation` field on streaming delta events to
        normalize payload sizes as a mitigation to certain side-channel attacks.
        These obfuscation fields are included by default, but add a small amount
        of overhead to the data stream. You can set `include_obfuscation` to
        false to optimize for bandwidth if you trust the network links between
        your application and the OpenAI API.

    - `temperature?: number | null`

      Body param: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
      We generally recommend altering this or `top_p` but not both.

      `minimum: 0`, `maximum: 2`

    - `text?: BetaResponseTextConfig`

      Body param: Configuration options for a text response from the model. Can be plain
      text or structured JSON data. Learn more:

      - [Text inputs and outputs](/api/docs/guides/text)
      - [Structured Outputs](/api/docs/guides/structured-outputs)

      - `format?: BetaResponseFormatTextConfig`

        An object specifying the format that the model must output.

        Configuring `{ "type": "json_schema" }` enables Structured Outputs,
        which ensures the model will match your supplied JSON schema. Learn more in the
        [Structured Outputs guide](/api/docs/guides/structured-outputs).

        The default format is `{ "type": "text" }` with no additional options.

        **Not recommended for gpt-4o and newer models:**

        Setting to `{ "type": "json_object" }` enables the older JSON mode, which
        ensures the message the model generates is valid JSON. Using `json_schema`
        is preferred for models that support it.

        - `Text`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig`

          JSON Schema response format. Used to generate structured JSON responses.
          Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

        - `JSONObject`

          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`.

            - `"json_object"`

      - `verbosity?: "low" | "medium" | "high" | null`

        Constrains the verbosity of the model's response. Lower values will result in
        more concise responses, while higher values will result in more verbose responses.
        Currently supported values are `low`, `medium`, and `high`. The default is
        `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tool_choice?: BetaToolChoiceOptions | BetaToolChoiceAllowed | BetaToolChoiceTypes | 6 more`

      Body param: How the model should select which tool (or tools) to use when generating
      a response. See the `tools` parameter to see how to specify which tools
      the model can call.

      - `BetaToolChoiceOptions = "none" | "auto" | "required"`

        Controls which (if any) tool is called by the model.

        `none` means the model will not call any tool and instead generates a message.

        `auto` means the model can pick between generating a message or calling one or
        more tools.

        `required` means the model must call one or more tools.

        - `"none"`

        - `"auto"`

        - `"required"`

      - `BetaToolChoiceAllowed`

        Constrains the tools available to the model to a pre-defined set.

        - `mode: "auto" | "required"`

          Constrains the tools available to the model to a pre-defined set.

          `auto` allows the model to pick from among the allowed tools and generate a
          message.

          `required` requires the model to call one or more of the allowed tools.

          - `"auto"`

          - `"required"`

        - `tools: Array<Record<string, unknown>>`

          A list of tool definitions that the model should be allowed to call.

          For the Responses API, the list of tool definitions might look like:

          ```json
          [
            { "type": "function", "name": "get_weather" },
            { "type": "mcp", "server_label": "deepwiki" },
            { "type": "image_generation" }
          ]
          ```

        - `type: "allowed_tools"`

          Allowed tool configuration type. Always `allowed_tools`.

          - `"allowed_tools"`

      - `BetaToolChoiceTypes`

        Indicates that the model should use a built-in tool to generate a response.
        [Learn more about built-in tools](/api/docs/guides/tools).

        - `type: "file_search" | "web_search_preview" | "computer" | 5 more`

          The type of hosted tool the model should to use. Learn more about
          [built-in tools](/api/docs/guides/tools).

          Allowed values are:

          - `file_search`
          - `web_search_preview`
          - `computer`
          - `computer_use_preview`
          - `computer_use`
          - `code_interpreter`
          - `image_generation`

          - `"file_search"`

          - `"web_search_preview"`

          - `"computer"`

          - `"computer_use_preview"`

          - `"computer_use"`

          - `"web_search_preview_2025_03_11"`

          - `"image_generation"`

          - `"code_interpreter"`

      - `BetaToolChoiceFunction`

        Use this option to force the model to call a specific function.

        - `name: string`

          The name of the function to call.

        - `type: "function"`

          For function calling, the type is always `function`.

          - `"function"`

      - `BetaToolChoiceMcp`

        Use this option to force the model to call a specific tool on a remote MCP server.

        - `server_label: string`

          The label of the MCP server to use.

        - `type: "mcp"`

          For MCP tools, the type is always `mcp`.

          - `"mcp"`

        - `name?: string | null`

          The name of the tool to call on the server.

      - `BetaToolChoiceCustom`

        Use this option to force the model to call a specific custom tool.

        - `name: string`

          The name of the custom tool to call.

        - `type: "custom"`

          For custom tool calling, the type is always `custom`.

          - `"custom"`

      - `BetaSpecificProgrammaticToolCallingParam`

        - `type: "programmatic_tool_calling"`

          The tool to call. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `BetaToolChoiceApplyPatch`

        Forces the model to call the apply_patch tool when executing a tool call.

        - `type: "apply_patch"`

          The tool to call. Always `apply_patch`.

          - `"apply_patch"`

      - `BetaToolChoiceShell`

        Forces the model to call the shell tool when a tool call is required.

        - `type: "shell"`

          The tool to call. Always `shell`.

          - `"shell"`

    - `tools?: Array<BetaTool>`

      Body param: An array of tools the model may call while generating a response. You
      can specify which tool to use by setting the `tool_choice` parameter.

      We support the following categories of tools:

      - **Built-in tools**: Tools that are provided by OpenAI that extend the
        model's capabilities, like [web search](/api/docs/guides/tools-web-search)
        or [file search](/api/docs/guides/tools-file-search). Learn more about
        [built-in tools](/api/docs/guides/tools).
      - **MCP Tools**: Integrations with third-party systems via custom MCP servers
        or predefined connectors such as Google Drive and SharePoint. Learn more about
        [MCP Tools](/api/docs/guides/tools-connectors-mcp).
      - **Function calls (custom tools)**: Functions that are defined by you,
        enabling the model to call your own code with strongly typed arguments
        and outputs. Learn more about
        [function calling](/api/docs/guides/function-calling). You can also use
        custom tools to call your own code.

      - `BetaFunctionTool`

        Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

      - `BetaFileSearchTool`

        A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

      - `BetaComputerTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaComputerUsePreviewTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaWebSearchTool`

        Search the Internet for sources related to the prompt. Learn more about the
        [web search tool](/api/docs/guides/tools-web-search).

      - `Mcp`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

      - `CodeInterpreter`

        A tool that runs Python code to help generate a response to a prompt.

      - `ProgrammaticToolCalling`

      - `ImageGeneration`

        A tool that generates images using the GPT image models.

      - `LocalShell`

        A tool that allows the model to execute shell commands in a local environment.

      - `BetaFunctionShellTool`

        A tool that allows the model to execute shell commands.

      - `BetaCustomTool`

        A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

      - `BetaNamespaceTool`

        Groups function/custom tools under a shared namespace.

      - `BetaToolSearchTool`

        Hosted or BYOT tool search configuration for deferred tools.

      - `BetaWebSearchPreviewTool`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

      - `BetaApplyPatchTool`

        Allows the assistant to create, delete, or update files using unified diffs.

    - `top_logprobs?: number | null`

      Body param: An integer between 0 and 20 specifying the maximum number of most likely
      tokens to return at each token position, each with an associated log
      probability. In some cases, the number of returned tokens may be fewer than
      requested.

      `minimum: 0`, `maximum: 20`

    - `top_p?: number | null`

      Body param: 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.

      `minimum: 0`, `maximum: 1`

    - `truncation?: "auto" | "disabled" | null`

      Body param: The truncation strategy to use for the model response.

      - `auto`: If the input to this Response exceeds
        the model's context window size, the model will truncate the
        response to fit the context window by dropping items from the beginning of the conversation.
        On some models, trimming can begin earlier because the API subtracts the model's
        maximum output allowance from its input limit, even if you set a lower `max_output_tokens`.
      - `disabled` (default): If the input size will exceed the context window
        size for a model, the request will fail with a 400 error.

      - `"auto"`

      - `"disabled"`

    - `user?: string`

      Body param: This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.
      A stable identifier for your end-users.
      Used to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

    - `betas?: Array<"responses_multi_agent=v1">`

      Header param: Optional beta features to enable for this request.

      - `"responses_multi_agent=v1"`

  - `ResponseCreateParamsNonStreaming extends ResponseCreateParamsBase`

    - `stream?: false | null`

      Body param: If set to true, the model response data will be streamed to the client
      as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
      See the [Streaming section below](/api/reference/resources/responses/streaming-events)
      for more information.

  - `ResponseCreateParamsStreaming extends ResponseCreateParamsBase`

    - `stream: true`

      Body param: If set to true, the model response data will be streamed to the client
      as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
      See the [Streaming section below](/api/reference/resources/responses/streaming-events)
      for more information.

      - `true`

### Returns

- `BetaResponse`

  - `id: string`

    Unique identifier for this Response.

  - `access_programs: AccessPrograms | null`

    - `cyber: "standard" | "daybreak_blue" | "daybreak_red"`

      The effective Cyber access program used for this response.

      - `"standard"`

      - `"daybreak_blue"`

      - `"daybreak_red"`

  - `created_at: number`

    Unix timestamp (in seconds) of when this Response was created.

    `format: unixtime`

  - `error: BetaResponseError | null`

    An error object returned when the model fails to generate a Response.

    - `code: "server_error" | "rate_limit_exceeded" | "invalid_prompt" | 18 more`

      The error code for the response.

      - `"server_error"`

      - `"rate_limit_exceeded"`

      - `"invalid_prompt"`

      - `"data_residency_mismatch"`

      - `"bio_policy"`

      - `"misalignment_policy_violation"`

      - `"vector_store_timeout"`

      - `"invalid_image"`

      - `"invalid_image_format"`

      - `"invalid_base64_image"`

      - `"invalid_image_url"`

      - `"image_too_large"`

      - `"image_too_small"`

      - `"image_parse_error"`

      - `"image_content_policy_violation"`

      - `"invalid_image_mode"`

      - `"image_file_too_large"`

      - `"unsupported_image_media_type"`

      - `"empty_image_file"`

      - `"failed_to_download_image"`

      - `"image_file_not_found"`

    - `message: string`

      A human-readable description of the error.

    - `misalignment?: Misalignment`

      - `detailed_explanation?: string`

        The public explanation for this block.

      - `error_type?: (string & {}) | "potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

        An optional classification; clients must accept additional values.

        - `(string & {})`

        - `"potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

          - `"potentially_unintended_data_transfer"`

          - `"potentially_unintended_data_access"`

          - `"potentially_unintended_destructive_activity"`

          - `"other"`

      - `review_target?: string | null`

        An opaque target for explicitly continuing this review, or null when unavailable.

        `minLength: 1`, `maxLength: 96`

      - `steer?: Steer`

        An optional public continuation instruction.

        - `message: string`

          The public continuation instruction.

    - `param?: string | null`

      The request parameter associated with the error, or null if none was recorded.

    - `type?: string | null`

      The original error type, or null if it was not recorded.

  - `incomplete_details: IncompleteDetails | null`

    Details about why the response is incomplete.

    - `reason?: "max_output_tokens" | "max_messages" | "content_filter" | "steered"`

      The reason why the response is incomplete. `steered` means
      the response stopped at a safe output boundary after a
      WebSocket `response.steer` event. The server can then create
      a successor response automatically with the queued input.

      - `"max_output_tokens"`

      - `"max_messages"`

      - `"content_filter"`

      - `"steered"`

  - `instructions: string | Array<BetaResponseInputItem> | null`

    A system (or developer) message inserted into the model's context.

    When using along with `previous_response_id`, the instructions from a previous
    response will not be carried over to the next response. This makes it simple
    to swap out system (or developer) messages in new responses.

    - `string`

    - `Array<BetaResponseInputItem>`

      - `BetaEasyInputMessage`

        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.

          - `string`

          - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

            A list of one or many input items to the model, containing different content
            types.

            - `BetaResponseInputText`

              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`.

                - `"input_text"`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `detail: BetaImageDetail`

                The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                - `"low"`

                - `"high"`

                - `"auto"`

                - `"original"`

              - `type: "input_image"`

                The type of the input item. Always `input_image`.

                - `"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.

                `format: uri`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFile`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"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`.

                - `"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.

                `format: uri`

              - `filename?: string`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

        - `role: "user" | "assistant" | "system" | "developer"`

          The role of the message input. One of `user`, `assistant`, `system`, or
          `developer`.

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"developer"`

        - `phase?: "commentary" | "final_answer" | 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.

          - `"commentary"`

          - `"final_answer"`

        - `type?: "message"`

          The type of the message input. Always `message`.

          - `"message"`

      - `Message`

        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.

        - `content: BetaResponseInputMessageContentList`

          A list of one or many input items to the model, containing different content
          types.

        - `role: "user" | "system" | "developer"`

          The role of the message input. One of `user`, `system`, or `developer`.

          - `"user"`

          - `"system"`

          - `"developer"`

        - `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"`

          The status of item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type?: "message"`

          The type of the message input. Always set to `message`.

          - `"message"`

      - `BetaResponseOutputMessage`

        An output message from the model.

        - `id: string`

          The unique ID of the output message.

        - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

          The content of the output message.

          - `BetaResponseOutputText`

            A text output from the model.

            - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

              The annotations of the text output.

              - `FileCitation`

                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 in the output text at which to insert the file citation.

                - `type: "file_citation"`

                  The type of the file citation. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation`

                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_citation"`

                - `url: string`

                  The URL of the web resource.

                  `format: uri`

              - `ContainerFileCitation`

                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`.

                  - `"container_file_citation"`

              - `FilePath`

                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`.

                  - `"file_path"`

            - `text: string`

              The text output from the model.

            - `type: "output_text"`

              The type of the output text. Always `output_text`.

              - `"output_text"`

            - `logprobs?: Array<Logprob>`

              - `token: string`

              - `bytes: Array<number>`

              - `logprob: number`

              - `top_logprobs: Array<TopLogprob>`

                - `token: string`

                - `bytes: Array<number>`

                - `logprob: number`

          - `BetaResponseOutputRefusal`

            A refusal from the model.

            - `refusal: string`

              The refusal explanation from the model.

            - `type: "refusal"`

              The type of the refusal. Always `refusal`.

              - `"refusal"`

        - `role: "assistant"`

          The role of the output message. Always `assistant`.

          - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "message"`

          The type of the output message. Always `message`.

          - `"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" | "final_answer" | 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.

          - `"commentary"`

          - `"final_answer"`

      - `BetaResponseFileSearchToolCall`

        The results of a file search tool call. See the
        [file search guide](/api/docs/guides/tools-file-search) 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`,

          - `"in_progress"`

          - `"searching"`

          - `"completed"`

          - `"incomplete"`

          - `"failed"`

        - `type: "file_search_call"`

          The type of the file search tool call. Always `file_search_call`.

          - `"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.

            - `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.

            `format: float`

          - `text?: string`

            The text that was retrieved from the file.

      - `BetaResponseComputerToolCall`

        A tool call to a computer use tool. See the
        [computer use guide](/api/docs/guides/tools-computer-use) 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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "computer_call"`

          The type of the computer call. Always `computer_call`.

          - `"computer_call"`

        - `action?: BetaComputerAction`

          A click action.

          - `Click`

            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`.

              - `"left"`

              - `"right"`

              - `"wheel"`

              - `"back"`

              - `"forward"`

            - `type: "click"`

              Specifies the event type. For a click action, this property is always `click`.

              - `"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`

            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`.

              - `"double_click"`

            - `x: number`

              The x-coordinate where the double click occurred.

            - `y: number`

              The y-coordinate where the double click occurred.

          - `Drag`

            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`.

              - `"drag"`

            - `keys?: Array<string> | null`

              The keys being held while dragging the mouse.

          - `Keypress`

            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`.

              - `"keypress"`

          - `Move`

            A mouse move action.

            - `type: "move"`

              Specifies the event type. For a move action, this property is always set to `move`.

              - `"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`

            A screenshot action.

            - `type: "screenshot"`

              Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

              - `"screenshot"`

          - `Scroll`

            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`.

              - `"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`

            An action to type in text.

            - `text: string`

              The text to type.

            - `type: "type"`

              Specifies the event type. For a type action, this property is always set to `type`.

              - `"type"`

          - `Wait`

            A wait action.

            - `type: "wait"`

              Specifies the event type. For a wait action, this property is always set to `wait`.

              - `"wait"`

        - `actions?: BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

          - `Click`

            A click action.

          - `DoubleClick`

            A double click action.

          - `Drag`

            A drag action.

          - `Keypress`

            A collection of keypresses the model would like to perform.

          - `Move`

            A mouse move action.

          - `Screenshot`

            A screenshot action.

          - `Scroll`

            A scroll action.

          - `Type`

            An action to type in text.

          - `Wait`

            A wait action.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput`

        The output of a computer tool call.

        - `call_id: string`

          The ID of the computer tool call that produced the output.

          `minLength: 1`, `maxLength: 64`

        - `output: BetaResponseComputerToolCallOutputScreenshot`

          A computer screenshot image used with the computer use tool.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is
            always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `file_id?: string`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url?: string`

            The URL of the screenshot image.

            `format: uri`

        - `type: "computer_call_output"`

          The type of the computer tool call output. Always `computer_call_output`.

          - `"computer_call_output"`

        - `id?: string | null`

          The ID of the computer tool call output.

        - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

          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.

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseFunctionWebSearch`

        The results of a web search tool call. See the
        [web search guide](/api/docs/guides/tools-web-search) for more information.

        - `id: string`

          The unique ID of the web search tool call.

        - `action: Search | OpenPage | FindInPage`

          An object describing the specific action taken in this web search call.
          Includes details on how the model used the web (search, open_page, find_in_page).

          - `Search`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries?: Array<string>`

              The search queries.

            - `query?: string`

              The search query.

            - `sources?: Array<Source>`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

                `format: uri`

          - `OpenPage`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url?: string | null`

              The URL opened by the model.

              `format: uri`

          - `FindInPage`

            Action type "find_in_page": Searches for a pattern within a loaded page.

            - `pattern: string`

              The pattern or text to search for within the page.

            - `type: "find_in_page"`

              The action type.

              - `"find_in_page"`

            - `url: string`

              The URL of the page searched for the pattern.

              `format: uri`

        - `status: "in_progress" | "searching" | "completed" | 2 more`

          The status of the web search tool call.

          - `"in_progress"`

          - `"searching"`

          - `"completed"`

          - `"failed"`

          - `"incomplete"`

        - `type: "web_search_call"`

          The type of the web search tool call. Always `web_search_call`.

          - `"web_search_call"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseFunctionToolCall`

        A tool call to run a function. See the
        [function calling guide](/api/docs/guides/function-calling) 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`.

          - `"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.

        - `async?: boolean`

          Whether the function tool call runs asynchronously.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `FunctionCallOutput`

        The output of a function tool call.

        - `output: string | BetaResponseFunctionCallOutputItemList`

          Text, image, or file output of the function tool call.

          - `string`

          - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

            An array of content outputs (text, image, file) for the function tool call.

            - `BetaResponseInputTextContent`

              A text input to the model.

              - `text: string`

                The text input to the model.

                `maxLength: 10485760`

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImageContent`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

              - `type: "input_image"`

                The type of the input item. Always `input_image`.

                - `"input_image"`

              - `detail?: BetaImageDetail | null`

                The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

              - `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.

                `maxLength: 20971520`, `format: uri`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFileContent`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"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`.

                - `"auto"`

                - `"low"`

                - `"high"`

              - `file_data?: string | null`

                The base64-encoded data of the file to be sent to the model.

                `maxLength: 73400320`

              - `file_id?: string | null`

                The ID of the file to be sent to the model.

              - `file_url?: string | null`

                The URL of the file to be sent to the model.

                `format: uri`

              - `filename?: string | null`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

        - `type: "function_call_output"`

          The type of the function tool call output. Always `function_call_output`.

          - `"function_call_output"`

        - `id?: string | null`

          The unique ID of the function tool call output. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

          The unique ID of the function tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `name?: string | null`

          The name of the tool that produced the output.

          `minLength: 1`, `maxLength: 128`

        - `namespace?: string | null`

          The namespace of the tool that produced the output.

          `minLength: 1`, `maxLength: 128`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AgentMessage`

        A message routed between agents.

        - `author: string`

          The sending agent identity.

        - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

          Plaintext, image, or encrypted content sent between agents.

          - `BetaResponseInputTextContent`

            A text input to the model.

          - `BetaResponseInputImageContent`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

          - `EncryptedContent`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

              `maxLength: 10485760`

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

        - `id?: string | null`

          The unique ID of this agent message item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall`

        - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

          The multi-agent action that was executed.

          - `"spawn_agent"`

          - `"interrupt_agent"`

          - `"list_agents"`

          - `"send_message"`

          - `"followup_task"`

          - `"wait_agent"`

        - `arguments: string`

          The action arguments as a JSON string.

        - `call_id: string`

          The unique ID linking this call to its output.

          `minLength: 1`, `maxLength: 64`

        - `type: "multi_agent_call"`

          The item type. Always `multi_agent_call`.

          - `"multi_agent_call"`

        - `id?: string | null`

          The unique ID of this multi-agent call.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput`

        - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

          The multi-agent action that produced this result.

          - `"spawn_agent"`

          - `"interrupt_agent"`

          - `"list_agents"`

          - `"send_message"`

          - `"followup_task"`

          - `"wait_agent"`

        - `call_id: string`

          The unique ID of the multi-agent call.

          `minLength: 1`, `maxLength: 64`

        - `output: Array<Output>`

          Text output returned by the multi-agent action.

          - `text: string`

            The text content.

            `maxLength: 10485760`

          - `type: "output_text"`

            The content type. Always `output_text`.

            - `"output_text"`

          - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

            Citations associated with the text content.

            - `FileCitation`

              - `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.

                `minimum: 0`

              - `type: "file_citation"`

                The citation type. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation`

              - `end_index: number`

                The index of the last character of the citation in the message.

                `minimum: 0`

              - `start_index: number`

                The index of the first character of the citation in the message.

                `minimum: 0`

              - `title: string`

                The title of the cited resource.

              - `type: "url_citation"`

                The citation type. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the cited resource.

                `format: uri`

            - `ContainerFileCitation`

              - `container_id: string`

                The ID of the container.

              - `end_index: number`

                The index of the last character of the citation in the message.

                `minimum: 0`

              - `file_id: string`

                The ID of the container file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

                The index of the first character of the citation in the message.

                `minimum: 0`

              - `type: "container_file_citation"`

                The citation type. Always `container_file_citation`.

                - `"container_file_citation"`

        - `type: "multi_agent_call_output"`

          The item type. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `id?: string | null`

          The unique ID of this multi-agent call output.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall`

        - `arguments: unknown`

          The arguments supplied to the tool search call.

        - `type: "tool_search_call"`

          The item type. Always `tool_search_call`.

          - `"tool_search_call"`

        - `id?: string | null`

          The unique ID of this tool search call.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

          The unique ID of the tool search call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `execution?: "server" | "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the tool search call.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseToolSearchOutputItemParam`

        - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

          The loaded tool definitions returned by the tool search output.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

              - `"function"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

            - `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`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

            - `type: "file_search"`

              The type of the file search tool. Always `file_search`.

              - `"file_search"`

            - `vector_store_ids: Array<string>`

              The IDs of the vector stores to search.

            - `filters?: ComparisonFilter | CompoundFilter | null`

              A filter to apply.

              - `ComparisonFilter`

                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

                  - `"eq"`

                  - `"ne"`

                  - `"gt"`

                  - `"gte"`

                  - `"lt"`

                  - `"lte"`

                  - `"in"`

                  - `"nin"`

                - `value: string | number | boolean | Array<string | number>`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `Array<string | number>`

                    - `string`

                    - `number`

              - `CompoundFilter`

                Combine multiple filters using `and` or `or`.

                - `filters: Array<ComparisonFilter | unknown>`

                  Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

                  - `ComparisonFilter`

                    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

                      - `"eq"`

                      - `"ne"`

                      - `"gt"`

                      - `"gte"`

                      - `"lt"`

                      - `"lte"`

                      - `"in"`

                      - `"nin"`

                    - `value: string | number | boolean | Array<string | number>`

                      The value to compare against the attribute key; supports string, number, or boolean types.

                      - `string`

                      - `number`

                      - `boolean`

                      - `Array<string | number>`

                        - `string`

                        - `number`

                  - `unknown`

                - `type: "and" | "or"`

                  Type of operation: `and` or `or`.

                  - `"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`

              Ranking options for search.

              - `hybrid_search?: HybridSearch`

                Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

                - `embedding_weight: number`

                  The weight of the embedding in the reciprocal ranking fusion.

                - `text_weight: number`

                  The weight of the text in the reciprocal ranking fusion.

              - `ranker?: "auto" | "default-2024-11-15"`

                The ranker to use for the file search.

                - `"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`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `type: "computer"`

              The type of the computer tool. Always `computer`.

              - `"computer"`

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `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.

              - `"windows"`

              - `"mac"`

              - `"linux"`

              - `"ubuntu"`

              - `"browser"`

            - `type: "computer_use_preview"`

              The type of the computer use tool. Always `computer_use_preview`.

              - `"computer_use_preview"`

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

            - `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`.

              - `"web_search"`

              - `"web_search_2025_08_26"`

            - `external_web_access?: boolean`

              Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

            - `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.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `user_location?: UserLocation | null`

              The approximate location of the user. If omitted or null, defaults to the
              United States. To avoid this fallback, pass `{"type": "approximate"}` without
              location fields. To localize results, provide the relevant location fields.

              - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type?: "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

              - `"mcp"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools?: Array<string> | McpToolFilter | null`

              List of allowed tool names or a filter object.

              - `Array<string>`

              - `McpToolFilter`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

              This field is deprecated for models released after September 1, 2026.
              Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
              connect through a Secure MCP Tunnel.

              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`

              - `"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" | null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter`

                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`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                    it will match this filter.

                  - `tool_names?: Array<string>`

                    List of allowed tool names.

                - `never?: Never`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

              `format: uri`

            - `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`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string | CodeInterpreterToolAuto`

              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.

              - `string`

              - `CodeInterpreterToolAuto`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids?: Array<string>`

                  An optional list of uploaded files to make available to your code.

                  `maxItems: 50`

                - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                    - `type: "disabled"`

                      Disable outbound network access. Always `disabled`.

                      - `"disabled"`

                  - `BetaContainerNetworkPolicyAllowlist`

                    - `allowed_domains: Array<string>`

                      A list of allowed domains when type is `allowlist`.

                      `minItems: 1`

                    - `type: "allowlist"`

                      Allow outbound network access only to specified domains. Always `allowlist`.

                      - `"allowlist"`

                    - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                      Optional domain-scoped secrets for allowlisted domains.

                      `minItems: 1`

                      - `domain: string`

                        The domain associated with the secret.

                        `minLength: 1`

                      - `name: string`

                        The name of the secret to inject for the domain.

                        `minLength: 1`

                      - `value: string`

                        The secret value to inject for the domain.

                        `minLength: 1`, `maxLength: 10485760`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action?: "generate" | "edit" | "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background?: "transparent" | "opaque" | "auto"`

              Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
              `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
              Transparent backgrounds are available for supported GPT Image models. For
              `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
              using `transparent`, set the output format to `png` or `webp`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `complexity?: "low" | "medium" | "high"`

              Computation spent planning the image, independently of rendering quality.
              Overrides the outer response's `reasoning.effort` for image generation.
              When omitted, inherits a supported outer reasoning effort or uses the
              image model's configured default.
              For SVG output, controls the reference image, not the SVG author's
              reasoning.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `frame_count?: number`

              Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

              `minimum: 2`, `maximum: 16`

            - `frame_duration_ms?: number`

              Duration of each GIF frame in milliseconds, rounded to 10 ms.
              Requires `output_format` to be `gif`. Default: 200.

              `minimum: 20`, `maximum: 2000`

            - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

              - `"high"`

              - `"low"`

            - `input_image_mask?: InputImageMask`

              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" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              Deprecated values:

              - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

              - `(string & {})`

              - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                - `"gpt-image-1"`

                - `"gpt-image-1-mini"`

                - `"gpt-image-2"`

                - `"gpt-image-2-2026-04-21"`

                - `"gpt-image-2.5-sunburst"`

                - `"gpt-image-2.5-sunburst-2026-09-08"`

                - `"gpt-image-2.5-flare"`

                - `"gpt-image-2.5-flare-2026-09-08"`

                - `"gpt-image-2.6-sunburst"`

                - `"gpt-image-2.6-flare"`

                - `"gpt-image-1.5"`

                - `"chatgpt-image-latest"`

            - `moderation?: "auto" | "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression?: number`

              Compression level for the output image. Default: 100.

              `minimum: 0`, `maximum: 100`

            - `output_format?: "png" | "webp" | "jpeg" | 2 more`

              The output format of the generated image. One of `png`, `webp`, `jpeg`,
              `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
              that supports the selected format. GIF output does not support
              partial image streaming (`partial_images` greater than `0`),
              `input_image_mask`, or custom `output_compression`.
              Responses lifecycle events can still be streamed for GIF output.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

              - `"gif"`

              - `"svg"`

            - `partial_images?: number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              `minimum: 0`, `maximum: 3`

            - `quality?: "low" | "medium" | "high" | 3 more`

              The quality of the generated image. The GPT image models support `low`,
              `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
              including their `2026-09-08` snapshots, also support `xhigh` and `max`.
              Default: `auto`.

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

              - `"auto"`

            - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

              - `(string & {})`

              - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

            - `svg?: Svg`

              SVG author model settings. Requires `output_format` to be `svg`.
              When SVG model selection is enabled, omitting this object uses the
              outer response model. Otherwise, the default SVG author is used and
              explicit model overrides are unavailable.

              - `model?: string`

                `minLength: 1`

              - `reasoning?: Reasoning | null`

                Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                - `effort?: "none" | "minimal" | "low" | 4 more`

                  Controls how much effort the model should spend on reasoning for this request.

                  - `"none"`

                  - `"minimal"`

                  - `"low"`

                  - `"medium"`

                  - `"high"`

                  - `"xhigh"`

                  - `"max"`

          - `LocalShell`

            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`.

              - `"local_shell"`

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

              - `BetaContainerAuto`

                - `type: "container_auto"`

                  Automatically creates a container for this request

                  - `"container_auto"`

                - `file_ids?: Array<string>`

                  An optional list of uploaded files to make available to your code.

                  `maxItems: 50`

                - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                  The memory limit for the container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                  - `BetaContainerNetworkPolicyAllowlist`

                - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

                  An optional list of skills referenced by id or inline data.

                  `maxItems: 200`

                  - `BetaSkillReference`

                    - `skill_id: string`

                      The ID of the referenced skill.

                      `minLength: 1`, `maxLength: 64`

                    - `type: "skill_reference"`

                      References a skill created with the /v1/skills endpoint.

                      - `"skill_reference"`

                    - `version?: string`

                      Optional skill version. Use a positive integer or 'latest'. Omit for default.

                  - `BetaInlineSkill`

                    - `description: string`

                      The description of the skill.

                    - `name: string`

                      The name of the skill.

                    - `source: BetaInlineSkillSource`

                      Inline skill payload

                      - `data: string`

                        Base64-encoded skill zip bundle.

                        `minLength: 1`, `maxLength: 70254592`

                      - `media_type: "application/zip"`

                        The media type of the inline skill payload. Must be `application/zip`.

                        - `"application/zip"`

                      - `type: "base64"`

                        The type of the inline skill source. Must be `base64`.

                        - `"base64"`

                    - `type: "inline"`

                      Defines an inline skill for this request.

                      - `"inline"`

              - `BetaLocalEnvironment`

                - `type: "local"`

                  Use a local computer environment.

                  - `"local"`

                - `skills?: Array<BetaLocalSkill>`

                  An optional list of skills.

                  `maxItems: 200`

                  - `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: string`

                  The ID of the referenced container.

                - `type: "container_reference"`

                  References a container created with the /v1/containers endpoint

                  - `"container_reference"`

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

              - `"custom"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `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 | Grammar`

              The input format for the custom tool. Default is unconstrained text.

              - `Text`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar`

                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`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `BetaToolSearchOutputNamespaceTool`

            Groups function/custom tools under a shared namespace.

            - `description: string`

              A description of the namespace shown to the model.

            - `name: string`

              The namespace name used in tool calls (for example, `crm`).

              `minLength: 1`

            - `tools: Array<Function | BetaCustomTool>`

              The function/custom tools loaded inside this namespace.

              `minItems: 1`

              - `Function`

                - `name: string`

                  The name of the loaded function tool.

                  `minLength: 1`, `maxLength: 128`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                  The tool invocation context(s).

                  `minItems: 1`

                  - `"direct"`

                  - `"programmatic"`

                - `async?: boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `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`

                A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `type: "namespace"`

              The type of the tool. Always `namespace`.

              - `"namespace"`

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"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.

              - `"server"`

              - `"client"`

            - `parameters?: unknown`

              Parameter schema for a client-executed tool search tool.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `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`.

              - `"web_search_preview"`

              - `"web_search_preview_2025_03_11"`

            - `search_content_types?: Array<"text" | "image">`

              - `"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.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `user_location?: UserLocation | null`

              The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

              - `type: "approximate"`

                The type of location approximation. Always `approximate`.

                - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The item type. Always `tool_search_output`.

          - `"tool_search_output"`

        - `id?: string | null`

          The unique ID of this tool search output.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

          The unique ID of the tool search call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `execution?: "server" | "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the tool search output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AdditionalTools`

        - `role: "developer"`

          The role that provided the additional tools. Only `developer` is supported.

          - `"developer"`

        - `tools: Array<BetaTool>`

          A list of additional tools made available at this item.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

              - `"mcp"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools?: Array<string> | McpToolFilter | null`

              List of allowed tool names or a filter object.

              - `Array<string>`

              - `McpToolFilter`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

              This field is deprecated for models released after September 1, 2026.
              Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
              connect through a Secure MCP Tunnel.

              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`

              - `"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" | null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter`

                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`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                    it will match this filter.

                  - `tool_names?: Array<string>`

                    List of allowed tool names.

                - `never?: Never`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

              `format: uri`

            - `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`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string | CodeInterpreterToolAuto`

              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.

              - `string`

              - `CodeInterpreterToolAuto`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids?: Array<string>`

                  An optional list of uploaded files to make available to your code.

                  `maxItems: 50`

                - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                  - `BetaContainerNetworkPolicyAllowlist`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action?: "generate" | "edit" | "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background?: "transparent" | "opaque" | "auto"`

              Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
              `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
              Transparent backgrounds are available for supported GPT Image models. For
              `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
              using `transparent`, set the output format to `png` or `webp`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `complexity?: "low" | "medium" | "high"`

              Computation spent planning the image, independently of rendering quality.
              Overrides the outer response's `reasoning.effort` for image generation.
              When omitted, inherits a supported outer reasoning effort or uses the
              image model's configured default.
              For SVG output, controls the reference image, not the SVG author's
              reasoning.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `frame_count?: number`

              Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

              `minimum: 2`, `maximum: 16`

            - `frame_duration_ms?: number`

              Duration of each GIF frame in milliseconds, rounded to 10 ms.
              Requires `output_format` to be `gif`. Default: 200.

              `minimum: 20`, `maximum: 2000`

            - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

              - `"high"`

              - `"low"`

            - `input_image_mask?: InputImageMask`

              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" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              Deprecated values:

              - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

              - `(string & {})`

              - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                - `"gpt-image-1"`

                - `"gpt-image-1-mini"`

                - `"gpt-image-2"`

                - `"gpt-image-2-2026-04-21"`

                - `"gpt-image-2.5-sunburst"`

                - `"gpt-image-2.5-sunburst-2026-09-08"`

                - `"gpt-image-2.5-flare"`

                - `"gpt-image-2.5-flare-2026-09-08"`

                - `"gpt-image-2.6-sunburst"`

                - `"gpt-image-2.6-flare"`

                - `"gpt-image-1.5"`

                - `"chatgpt-image-latest"`

            - `moderation?: "auto" | "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression?: number`

              Compression level for the output image. Default: 100.

              `minimum: 0`, `maximum: 100`

            - `output_format?: "png" | "webp" | "jpeg" | 2 more`

              The output format of the generated image. One of `png`, `webp`, `jpeg`,
              `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
              that supports the selected format. GIF output does not support
              partial image streaming (`partial_images` greater than `0`),
              `input_image_mask`, or custom `output_compression`.
              Responses lifecycle events can still be streamed for GIF output.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

              - `"gif"`

              - `"svg"`

            - `partial_images?: number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              `minimum: 0`, `maximum: 3`

            - `quality?: "low" | "medium" | "high" | 3 more`

              The quality of the generated image. The GPT image models support `low`,
              `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
              including their `2026-09-08` snapshots, also support `xhigh` and `max`.
              Default: `auto`.

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

              - `"auto"`

            - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

              - `(string & {})`

              - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

            - `svg?: Svg`

              SVG author model settings. Requires `output_format` to be `svg`.
              When SVG model selection is enabled, omitting this object uses the
              outer response model. Otherwise, the default SVG author is used and
              explicit model overrides are unavailable.

              - `model?: string`

                `minLength: 1`

              - `reasoning?: Reasoning | null`

                Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                - `effort?: "none" | "minimal" | "low" | 4 more`

                  Controls how much effort the model should spend on reasoning for this request.

                  - `"none"`

                  - `"minimal"`

                  - `"low"`

                  - `"medium"`

                  - `"high"`

                  - `"xhigh"`

                  - `"max"`

          - `LocalShell`

            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`.

              - `"local_shell"`

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

            - `description: string`

              A description of the namespace shown to the model.

            - `name: string`

              The namespace name used in tool calls (for example, `crm`).

              `minLength: 1`

            - `tools: Array<Function | BetaCustomTool>`

              The function/custom tools available inside this namespace.

              `minItems: 1`

              - `Function`

                - `name: string`

                  `minLength: 1`, `maxLength: 128`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                  The tool invocation context(s).

                  `minItems: 1`

                  - `"direct"`

                  - `"programmatic"`

                - `async?: boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `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`

                A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `type: "namespace"`

              The type of the tool. Always `namespace`.

              - `"namespace"`

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "additional_tools"`

          The item type. Always `additional_tools`.

          - `"additional_tools"`

        - `id?: string | null`

          The unique ID of this additional tools item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseConfigurationUpdateItemParam`

        An update to the conversation's response configuration. Supply reasoning,
        text, or both. Each setting stays in effect until a later update replaces it.

        - `type: "configuration_update"`

          The item type. Always `configuration_update`.

          - `"configuration_update"`

        - `id?: string | null`

          The unique ID of the configuration update item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reasoning?: Reasoning`

          Updates to reasoning configuration. Only effort is supported.

          - `effort?: "none" | "minimal" | "low" | 4 more | null`

            The reasoning effort to use for subsequent responses until another
            configuration update replaces it.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

        - `text?: Text`

          The text output configuration for subsequent responses.

          - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

            Use a JSON schema for structured output or text to return to plain text.

            - `Text`

              Default response format. Used to generate text responses.

              - `type: "text"`

                The type of response format being defined. Always `text`.

                - `"text"`

            - `BetaResponseFormatTextJSONSchemaConfig`

              JSON Schema response format. Used to generate structured JSON responses.
              Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

              - `name: string`

                The name of the response format. Must be a-z, A-Z, 0-9, or contain
                underscores and dashes, with a maximum length of 64.

              - `schema: Record<string, unknown>`

                The schema for the response format, described as a JSON Schema object.
                Learn how to build JSON schemas [here](https://json-schema.org/).

              - `type: "json_schema"`

                The type of response format being defined. Always `json_schema`.

                - `"json_schema"`

              - `description?: string`

                A description of what the response format is for, used by the model to
                determine how to respond in the format.

              - `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](/api/docs/guides/structured-outputs).

      - `BetaResponseReasoningItem`

        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](/api/docs/guides/conversation-state).

        - `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`.

            - `"summary_text"`

        - `type: "reasoning"`

          The type of the object. Always `reasoning`.

          - `"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`.

            - `"reasoning_text"`

        - `encrypted_content?: string | null`

          The encrypted content of the reasoning item. This is populated by default
          for reasoning items returned by `POST /v1/responses` and WebSocket
          `response.create` requests.

          When streaming, use the completed reasoning item and its
          `encrypted_content` from the `response.output_item.done` event in
          subsequent requests. The `encrypted_content` in
          `response.output_item.added` may be incomplete. This is especially
          important when `store` is `false` or when using Zero Data Retention.

        - `status?: "in_progress" | "completed" | "incomplete"`

          The status of the item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseCompactionItemParam`

        A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

        - `encrypted_content: string`

          The encrypted content of the compaction summary.

          `maxLength: 104857600`

        - `type: "compaction"`

          The type of the item. Always `compaction`.

          - `"compaction"`

        - `id?: string | null`

          The ID of the compaction item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ImageGenerationCall`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"generating"`

          - `"failed"`

        - `type: "image_generation_call"`

          The type of the image generation call. Always `image_generation_call`.

          - `"image_generation_call"`

        - `action?: "generate" | "edit" | "auto" | null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background?: "transparent" | "opaque" | "auto" | null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error?: Error`

          Details of a moderation failure, when available.

          - `code: string | null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string | null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details?: ModerationDetails`

            Public details for a `moderation_blocked` error, when available.

            - `categories: Array<string>`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" | "output" | "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `quality?: "low" | "medium" | "high" | 3 more | null`

          The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `revised_prompt?: string | null`

          The prompt that was used after any model prompt rewriting.

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

        - `svg_usage?: SvgUsage`

          - `input_tokens: number`

          - `model: string`

          - `output_tokens: number`

          - `reasoning_tokens: number`

          - `total_tokens: number`

      - `BetaResponseCodeInterpreterToolCall`

        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 | Image> | null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs`

            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`.

              - `"logs"`

          - `Image`

            The image output from the code interpreter.

            - `type: "image"`

              The type of the output. Always `image`.

              - `"image"`

            - `url: string`

              The URL of the image output from the code interpreter.

              `format: uri`

        - `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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"interpreting"`

          - `"failed"`

        - `type: "code_interpreter_call"`

          The type of the code interpreter tool call. Always `code_interpreter_call`.

          - `"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`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: Action`

          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`.

            - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "local_shell_call"`

          The type of the local shell call. Always `local_shell_call`.

          - `"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`

        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`.

          - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall`

        A tool representing a request to execute one or more shell commands.

        - `action: Action`

          The shell commands and limits that describe how to run the tool call.

          - `commands: Array<string>`

            Ordered shell commands for the execution environment to run.

          - `max_output_length?: number | null`

            Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

          - `timeout_ms?: number | null`

            Maximum wall-clock time in milliseconds to allow the shell commands to run.

        - `call_id: string`

          The unique ID of the shell tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `id?: string | null`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

          The environment to execute the shell commands in.

          - `BetaLocalEnvironment`

          - `BetaContainerReference`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCallOutput`

        The streamed output items emitted by a shell tool call.

        - `call_id: string`

          The unique ID of the shell tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `output: Array<BetaResponseFunctionShellCallOutputContent>`

          Captured chunks of stdout and stderr output, along with their associated outcomes.

          - `outcome: Timeout | Exit`

            The exit or timeout outcome associated with this shell call.

            - `Timeout`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit`

              Indicates that the shell commands finished and returned an exit code.

              - `exit_code: number`

                The exit code returned by the shell process.

              - `type: "exit"`

                The outcome type. Always `exit`.

                - `"exit"`

          - `stderr: string`

            Captured stderr output for the shell call.

            `maxLength: 10485760`

          - `stdout: string`

            Captured stdout output for the shell call.

            `maxLength: 10485760`

        - `type: "shell_call_output"`

          The type of the item. Always `shell_call_output`.

          - `"shell_call_output"`

        - `id?: string | null`

          The unique ID of the shell tool call output. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `max_output_length?: number | null`

          The maximum number of UTF-8 characters captured for this shell call's combined output.

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the shell call output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ApplyPatchCall`

        A tool call representing a request to create, delete, or update files using diff patches.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `operation: CreateFile | DeleteFile | UpdateFile`

          The specific create, delete, or update instruction for the apply_patch tool call.

          - `CreateFile`

            Instruction for creating a new file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply when creating the file.

              `maxLength: 10485760`

            - `path: string`

              Path of the file to create relative to the workspace root.

              `minLength: 1`

            - `type: "create_file"`

              The operation type. Always `create_file`.

              - `"create_file"`

          - `DeleteFile`

            Instruction for deleting an existing file via the apply_patch tool.

            - `path: string`

              Path of the file to delete relative to the workspace root.

              `minLength: 1`

            - `type: "delete_file"`

              The operation type. Always `delete_file`.

              - `"delete_file"`

          - `UpdateFile`

            Instruction for updating an existing file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply to the existing file.

              `maxLength: 10485760`

            - `path: string`

              Path of the file to update relative to the workspace root.

              `minLength: 1`

            - `type: "update_file"`

              The operation type. Always `update_file`.

              - `"update_file"`

        - `status: "in_progress" | "completed"`

          The status of the apply patch tool call. One of `in_progress` or `completed`.

          - `"in_progress"`

          - `"completed"`

        - `type: "apply_patch_call"`

          The type of the item. Always `apply_patch_call`.

          - `"apply_patch_call"`

        - `id?: string | null`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `ApplyPatchCallOutput`

        The streamed output emitted by an apply patch tool call.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `status: "completed" | "failed"`

          The status of the apply patch tool call output. One of `completed` or `failed`.

          - `"completed"`

          - `"failed"`

        - `type: "apply_patch_call_output"`

          The type of the item. Always `apply_patch_call_output`.

          - `"apply_patch_call_output"`

        - `id?: string | null`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `output?: string | null`

          Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

          `maxLength: 10485760`

      - `McpListTools`

        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`.

          - `"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`

        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`.

          - `"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`

        A response to an MCP approval request.

        - `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`.

          - `"mcp_approval_response"`

        - `id?: string | null`

          The unique ID of the 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.

      - `McpCall`

        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`.

          - `"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?: BetaMcpToolCallError | null`

          The error from the tool call, if any.

          - `McpProtocolError`

            - `code: number`

            - `message: string`

            - `type: "mcp_protocol_error"`

              - `"mcp_protocol_error"`

          - `McpToolExecutionError`

            - `content: unknown`

            - `type: "mcp_tool_execution_error"`

              - `"mcp_tool_execution_error"`

          - `HTTPError`

            - `code: number`

            - `message: string`

            - `type: "http_error"`

              - `"http_error"`

        - `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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `BetaResponseCustomToolCallOutput`

        The output of a custom tool call from your code, being sent back to the model.

        - `call_id: string`

          The call ID, used to map this custom tool call output to a custom tool call.

        - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `string`

          - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            - `BetaResponseInputText`

              A text input to the model.

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile`

              A file input to the model.

        - `type: "custom_tool_call_output"`

          The type of the custom tool call output. Always `custom_tool_call_output`.

          - `"custom_tool_call_output"`

        - `id?: string`

          The unique ID of the custom tool call output 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 | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `BetaResponseCustomToolCall`

        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`.

          - `"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.

        - `async?: boolean`

          Whether the custom tool call runs asynchronously.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace?: string`

          The namespace of the custom tool being called.

      - `CompactionTrigger`

        Compacts the current context. Must be the final input item.

        - `type: "compaction_trigger"`

          The type of the item. Always `compaction_trigger`.

          - `"compaction_trigger"`

        - `id?: string | null`

          The unique ID of this compaction trigger.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ItemReference`

        An internal identifier for an item to reference.

        - `id: string`

          The ID of the item to reference.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `type?: "item_reference" | null`

          The type of item to reference. Always `item_reference`.

          - `"item_reference"`

      - `Program`

        - `id: string`

          The unique ID of this program item.

        - `call_id: string`

          The stable call ID of the program item.

          `minLength: 1`, `maxLength: 64`

        - `code: string`

          The JavaScript source executed by programmatic tool calling.

          `maxLength: 10485760`

        - `fingerprint: string`

          Opaque program replay fingerprint that must be round-tripped.

          `maxLength: 10485760`

        - `type: "program"`

          The item type. Always `program`.

          - `"program"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput`

        - `id: string`

          The unique ID of this program output item.

        - `call_id: string`

          The call ID of the program item.

          `minLength: 1`, `maxLength: 64`

        - `result: string`

          The result produced by the program item.

          `maxLength: 10485760`

        - `status: "completed" | "incomplete"`

          The terminal status of the program output.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The item type. Always `program_output`.

          - `"program_output"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

  - `metadata: Record<string, string> | 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: "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more | (string & {})`

    Model ID used to generate the response, like `gpt-6-astra`. OpenAI
    offers a wide range of models with different capabilities, performance
    characteristics, and price points. Refer to the [model guide](/api/docs/models)
    to browse and compare available models.

    Deprecated values:

    - "gpt-5.4-nano", "gpt-5.4-nano-2026-03-17", "gpt-5.1", "gpt-5.1-2025-11-13": Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-5.3-chat-latest", "gpt-5.2-chat-latest": Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-5.1-codex", "gpt-5.1-chat-latest", "gpt-5-chat-latest", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", "o3-deep-research", "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5-codex", "gpt-5.1-codex-max": Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-5.1-mini": Not a supported model ID. Retained for SDK compatibility.
    - "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "o3", "o3-2025-04-16", "o3-pro", "o3-pro-2025-06-10", "gpt-5-pro", "gpt-5-pro-2025-10-06": Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-mini", "gpt-4o-mini-2024-07-18": Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4.1-nano", "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3-mini", "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "gpt-4o-2024-05-13", "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-1106-preview", "gpt-4", "gpt-4-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-0125", "o1-pro", "o1-pro-2025-03-19": Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "o1-preview", "o1-preview-2024-09-12": Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "o1-mini", "o1-mini-2024-09-12": Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-audio-mini", "gpt-audio-mini-2025-12-15": Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-12-17", "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", "gpt-4o-mini-audio-preview-2024-12-17": Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4o-audio-preview-2024-10-01": Announced shutdown date: 2025-10-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "chatgpt-4o-latest": Announced shutdown date: 2026-02-17. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "codex-mini-latest": Announced shutdown date: 2026-02-12. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4-0125-preview", "gpt-4-turbo-preview", "gpt-4-0314": Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4-vision-preview": Announced shutdown date: 2024-12-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-0613": Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k-0613": Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-3.5-turbo-1106": Announced shutdown date: 2026-09-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.

    - `"gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more`

      Model ID used to generate the response, like `gpt-6-astra`. OpenAI
      offers a wide range of models with different capabilities, performance
      characteristics, and price points. Refer to the [model guide](/api/docs/models)
      to browse and compare available models.

      - `"gpt-6-astra"`

      - `"gpt-6.1-sol"`

      - `"gpt-6.1-terra"`

      - `"gpt-6-sol"`

      - `"gpt-6-luna"`

      - `"gpt-5.6-sol"`

      - `"gpt-5.6-terra"`

      - `"gpt-5.6-luna"`

      - `"gpt-5.5"`

      - `"gpt-5.5-2026-04-23"`

      - `"gpt-5.4"`

      - `"gpt-5.4-mini"`

      - `"gpt-5.4-nano"`

      - `"gpt-5.4-mini-2026-03-17"`

      - `"gpt-5.4-nano-2026-03-17"`

      - `"gpt-5.3-chat-latest"`

      - `"gpt-5.2"`

      - `"gpt-5.2-2025-12-11"`

      - `"gpt-5.2-chat-latest"`

      - `"gpt-5.2-pro"`

      - `"gpt-5.2-pro-2025-12-11"`

      - `"gpt-5.1"`

      - `"gpt-5.1-2025-11-13"`

      - `"gpt-5.1-codex"`

      - `"gpt-5.1-mini"`

      - `"gpt-5.1-chat-latest"`

      - `"gpt-5"`

      - `"gpt-5-mini"`

      - `"gpt-5-nano"`

      - `"gpt-5-2025-08-07"`

      - `"gpt-5-mini-2025-08-07"`

      - `"gpt-5-nano-2025-08-07"`

      - `"gpt-5-chat-latest"`

      - `"gpt-4.1"`

      - `"gpt-4.1-mini"`

      - `"gpt-4.1-nano"`

      - `"gpt-4.1-2025-04-14"`

      - `"gpt-4.1-mini-2025-04-14"`

      - `"gpt-4.1-nano-2025-04-14"`

      - `"o4-mini"`

      - `"o4-mini-2025-04-16"`

      - `"o3"`

      - `"o3-2025-04-16"`

      - `"o3-mini"`

      - `"o3-mini-2025-01-31"`

      - `"o1"`

      - `"o1-2024-12-17"`

      - `"o1-preview"`

      - `"o1-preview-2024-09-12"`

      - `"o1-mini"`

      - `"o1-mini-2024-09-12"`

      - `"gpt-4o"`

      - `"gpt-4o-2024-11-20"`

      - `"gpt-4o-2024-08-06"`

      - `"gpt-4o-2024-05-13"`

      - `"gpt-audio-mini"`

      - `"gpt-audio-mini-2025-12-15"`

      - `"gpt-4o-audio-preview"`

      - `"gpt-4o-audio-preview-2024-10-01"`

      - `"gpt-4o-audio-preview-2024-12-17"`

      - `"gpt-4o-audio-preview-2025-06-03"`

      - `"gpt-4o-mini-audio-preview"`

      - `"gpt-4o-mini-audio-preview-2024-12-17"`

      - `"gpt-4o-search-preview"`

      - `"gpt-4o-mini-search-preview"`

      - `"gpt-4o-search-preview-2025-03-11"`

      - `"gpt-4o-mini-search-preview-2025-03-11"`

      - `"chatgpt-4o-latest"`

      - `"codex-mini-latest"`

      - `"gpt-4o-mini"`

      - `"gpt-4o-mini-2024-07-18"`

      - `"gpt-4-turbo"`

      - `"gpt-4-turbo-2024-04-09"`

      - `"gpt-4-0125-preview"`

      - `"gpt-4-turbo-preview"`

      - `"gpt-4-1106-preview"`

      - `"gpt-4-vision-preview"`

      - `"gpt-4"`

      - `"gpt-4-0314"`

      - `"gpt-4-0613"`

      - `"gpt-4-32k"`

      - `"gpt-4-32k-0314"`

      - `"gpt-4-32k-0613"`

      - `"gpt-3.5-turbo"`

      - `"gpt-3.5-turbo-16k"`

      - `"gpt-3.5-turbo-0301"`

      - `"gpt-3.5-turbo-0613"`

      - `"gpt-3.5-turbo-1106"`

      - `"gpt-3.5-turbo-0125"`

      - `"gpt-3.5-turbo-16k-0613"`

      - `"o1-pro"`

      - `"o1-pro-2025-03-19"`

      - `"o3-pro"`

      - `"o3-pro-2025-06-10"`

      - `"o3-deep-research"`

      - `"o3-deep-research-2025-06-26"`

      - `"o4-mini-deep-research"`

      - `"o4-mini-deep-research-2025-06-26"`

      - `"computer-use-preview"`

      - `"computer-use-preview-2025-03-11"`

      - `"gpt-5.5-pro"`

      - `"gpt-5.5-pro-2026-04-23"`

      - `"gpt-5-codex"`

      - `"gpt-5-pro"`

      - `"gpt-5-pro-2025-10-06"`

      - `"gpt-5.1-codex-max"`

      - `"gpt-daybreak-blue-latest"`

      - `"gpt-daybreak-red-latest"`

      - `"gpt-5.6-cyber"`

      - `"gpt-6-cyber"`

      - `"gpt-rosalind-research"`

      - `"gpt-6-rosalind"`

    - `(string & {})`

  - `object: "response"`

    The object type of this resource - always set to `response`.

    - `"response"`

  - `output: Array<BetaResponseOutputItem>`

    An array of content items generated by the model.

    - The length and order of items in the `output` array is dependent
      on the model's response.
    - Rather than accessing the first item in the `output` array and
      assuming it's an `assistant` message with the content generated by
      the model, you might consider using the `output_text` property where
      supported in SDKs.

    - `BetaResponseOutputMessage`

      An output message from the model.

    - `BetaResponseFileSearchToolCall`

      The results of a file search tool call. See the
      [file search guide](/api/docs/guides/tools-file-search) for more information.

    - `BetaResponseFunctionToolCall`

      A tool call to run a function. See the
      [function calling guide](/api/docs/guides/function-calling) for more information.

    - `BetaResponseFunctionToolCallOutputItem`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `string`

        - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          - `BetaResponseInputText`

            A text input to the model.

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile`

            A file input to the model.

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "function_call_output"`

        The type of the function tool call output. Always `function_call_output`.

        - `"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.

      - `call_id?: string`

        The unique ID of the function tool call generated by the model.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

      - `name?: string`

        The name of the tool that produced the output.

      - `namespace?: string`

        The namespace of the tool that produced the output.

    - `AgentMessage`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

        Encrypted content sent between agents.

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseOutputText`

          A text output from the model.

        - `Text`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText`

          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`.

            - `"summary_text"`

        - `ReasoningText`

          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`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal`

          A refusal from the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot`

          A screenshot of a computer.

          - `detail: BetaImageDetail`

            The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

          - `file_id: string | null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string | null`

            The URL of the screenshot image.

            `format: uri`

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputFile`

          A file input to the model.

        - `EncryptedContent`

          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`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall`

      - `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.

        - `"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`.

        - `"multi_agent_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput`

      - `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.

        - `"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>`

        Text output returned by the multi-agent action.

        - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

          The annotations of the text output.

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

        - `logprobs?: Array<Logprob>`

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseFunctionWebSearch`

      The results of a web search tool call. See the
      [web search guide](/api/docs/guides/tools-web-search) for more information.

    - `BetaResponseComputerToolCall`

      A tool call to a computer use tool. See the
      [computer use guide](/api/docs/guides/tools-computer-use) for more information.

    - `BetaResponseComputerToolCallOutputItem`

      - `id: string`

        The ID of the computer tool call output.

      - `call_id: string`

        The ID of the computer tool call that produced the output.

      - `output: BetaResponseComputerToolCallOutputScreenshot`

        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.

        - `"completed"`

        - `"incomplete"`

        - `"failed"`

        - `"in_progress"`

      - `type: "computer_call_output"`

        The type of the computer tool call output. Always `computer_call_output`.

        - `"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`

      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](/api/docs/guides/conversation-state).

    - `Program`

      - `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`.

        - `"program"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput`

      - `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.

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The type of the item. Always `program_output`.

        - `"program_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseToolSearchCall`

      - `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.

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the tool search call item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "tool_search_call"`

        The type of the item. Always `tool_search_call`.

        - `"tool_search_call"`

      - `agent?: Agent`

        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: 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.

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: Array<BetaTool>`

        The loaded tool definitions returned by tool search.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

        - `BetaFileSearchTool`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `BetaComputerTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

        - `CodeInterpreter`

          A tool that runs Python code to help generate a response to a prompt.

        - `ProgrammaticToolCalling`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

        - `LocalShell`

          A tool that allows the model to execute shell commands in a local environment.

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `BetaApplyPatchTool`

          Allows the assistant to create, delete, or update files using unified diffs.

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent?: Agent`

        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: string`

        The unique ID of the additional tools item.

      - `role: "unknown" | "user" | "assistant" | 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: Array<BetaTool>`

        The additional tool definitions made available at this item.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

        - `BetaFileSearchTool`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `BetaComputerTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

        - `CodeInterpreter`

          A tool that runs Python code to help generate a response to a prompt.

        - `ProgrammaticToolCalling`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

        - `LocalShell`

          A tool that allows the model to execute shell commands in a local environment.

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `BetaApplyPatchTool`

          Allows the assistant to create, delete, or update files using unified diffs.

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseCompactionItem`

      A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

      - `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`.

        - `"compaction"`

      - `agent?: Agent`

        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`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"generating"`

        - `"failed"`

      - `type: "image_generation_call"`

        The type of the image generation call. Always `image_generation_call`.

        - `"image_generation_call"`

      - `action?: "generate" | "edit" | "auto" | null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background?: "transparent" | "opaque" | "auto" | null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error?: Error`

        Details of a moderation failure, when available.

        - `code: string | null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string | null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details?: ModerationDetails`

          Public details for a `moderation_blocked` error, when available.

          - `categories: Array<string>`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" | "output" | "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

        - `"gif"`

        - `"svg"`

      - `quality?: "low" | "medium" | "high" | 3 more | null`

        The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

        - `"auto"`

      - `revised_prompt?: string | null`

        The prompt that was used after any model prompt rewriting.

      - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `(string & {})`

        - `"1024x1024" | "1024x1536" | "1536x1024"`

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

      - `svg_usage?: SvgUsage`

        - `input_tokens: number`

        - `model: string`

        - `output_tokens: number`

        - `reasoning_tokens: number`

        - `total_tokens: number`

    - `BetaResponseCodeInterpreterToolCall`

      A tool call to run code.

    - `LocalShellCall`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: Action`

        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`.

          - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "local_shell_call"`

        The type of the local shell call. Always `local_shell_call`.

        - `"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`

      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`.

        - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseFunctionShellToolCall`

      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`

        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 | BetaResponseContainerReference | null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "shell_call"`

        The type of the item. Always `shell_call`.

        - `"shell_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The ID of the entity that created this tool call.

    - `BetaResponseFunctionShellToolCallOutput`

      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 | Exit`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit`

            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`.

              - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "shell_call_output"`

        The type of the shell call output. Always `shell_call_output`.

        - `"shell_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

    - `BetaResponseApplyPatchToolCall`

      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 | DeleteFile | UpdateFile`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile`

          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.

            - `"create_file"`

        - `DeleteFile`

          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.

            - `"delete_file"`

        - `UpdateFile`

          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.

            - `"update_file"`

      - `status: "in_progress" | "completed"`

        The status of the apply patch tool call. One of `in_progress` or `completed`.

        - `"in_progress"`

        - `"completed"`

      - `type: "apply_patch_call"`

        The type of the item. Always `apply_patch_call`.

        - `"apply_patch_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The ID of the entity that created this tool call.

    - `BetaResponseApplyPatchToolCallOutput`

      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`.

        - `"completed"`

        - `"failed"`

      - `type: "apply_patch_call_output"`

        The type of the item. Always `apply_patch_call_output`.

        - `"apply_patch_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"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`

      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`.

        - `"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?: BetaMcpToolCallError | 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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `McpListTools`

      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`.

        - `"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`

      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`.

        - `"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`

      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`.

        - `"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`

      A call to a custom tool created by the model.

    - `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `created_by?: string`

        The identifier of the actor that created the item.

  - `parallel_tool_calls: boolean`

    Whether to allow the model to run tool calls in parallel.

  - `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.
    We generally recommend altering this or `top_p` but not both.

    `minimum: 0`, `maximum: 2`

  - `tool_choice: BetaToolChoiceOptions | BetaToolChoiceAllowed | BetaToolChoiceTypes | 6 more`

    How the model should select which tool (or tools) to use when generating
    a response. See the `tools` parameter to see how to specify which tools
    the model can call.

    - `BetaToolChoiceOptions = "none" | "auto" | "required"`

      Controls which (if any) tool is called by the model.

      `none` means the model will not call any tool and instead generates a message.

      `auto` means the model can pick between generating a message or calling one or
      more tools.

      `required` means the model must call one or more tools.

      - `"none"`

      - `"auto"`

      - `"required"`

    - `BetaToolChoiceAllowed`

      Constrains the tools available to the model to a pre-defined set.

      - `mode: "auto" | "required"`

        Constrains the tools available to the model to a pre-defined set.

        `auto` allows the model to pick from among the allowed tools and generate a
        message.

        `required` requires the model to call one or more of the allowed tools.

        - `"auto"`

        - `"required"`

      - `tools: Array<Record<string, unknown>>`

        A list of tool definitions that the model should be allowed to call.

        For the Responses API, the list of tool definitions might look like:

        ```json
        [
          { "type": "function", "name": "get_weather" },
          { "type": "mcp", "server_label": "deepwiki" },
          { "type": "image_generation" }
        ]
        ```

      - `type: "allowed_tools"`

        Allowed tool configuration type. Always `allowed_tools`.

        - `"allowed_tools"`

    - `BetaToolChoiceTypes`

      Indicates that the model should use a built-in tool to generate a response.
      [Learn more about built-in tools](/api/docs/guides/tools).

      - `type: "file_search" | "web_search_preview" | "computer" | 5 more`

        The type of hosted tool the model should to use. Learn more about
        [built-in tools](/api/docs/guides/tools).

        Allowed values are:

        - `file_search`
        - `web_search_preview`
        - `computer`
        - `computer_use_preview`
        - `computer_use`
        - `code_interpreter`
        - `image_generation`

        - `"file_search"`

        - `"web_search_preview"`

        - `"computer"`

        - `"computer_use_preview"`

        - `"computer_use"`

        - `"web_search_preview_2025_03_11"`

        - `"image_generation"`

        - `"code_interpreter"`

    - `BetaToolChoiceFunction`

      Use this option to force the model to call a specific function.

      - `name: string`

        The name of the function to call.

      - `type: "function"`

        For function calling, the type is always `function`.

        - `"function"`

    - `BetaToolChoiceMcp`

      Use this option to force the model to call a specific tool on a remote MCP server.

      - `server_label: string`

        The label of the MCP server to use.

      - `type: "mcp"`

        For MCP tools, the type is always `mcp`.

        - `"mcp"`

      - `name?: string | null`

        The name of the tool to call on the server.

    - `BetaToolChoiceCustom`

      Use this option to force the model to call a specific custom tool.

      - `name: string`

        The name of the custom tool to call.

      - `type: "custom"`

        For custom tool calling, the type is always `custom`.

        - `"custom"`

    - `BetaSpecificProgrammaticToolCallingParam`

      - `type: "programmatic_tool_calling"`

        The tool to call. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `BetaToolChoiceApplyPatch`

      Forces the model to call the apply_patch tool when executing a tool call.

      - `type: "apply_patch"`

        The tool to call. Always `apply_patch`.

        - `"apply_patch"`

    - `BetaToolChoiceShell`

      Forces the model to call the shell tool when a tool call is required.

      - `type: "shell"`

        The tool to call. Always `shell`.

        - `"shell"`

  - `tools: Array<BetaTool>`

    An array of tools the model may call while generating a response. You
    can specify which tool to use by setting the `tool_choice` parameter.

    We support the following categories of tools:

    - **Built-in tools**: Tools that are provided by OpenAI that extend the
      model's capabilities, like [web search](/api/docs/guides/tools-web-search)
      or [file search](/api/docs/guides/tools-file-search). Learn more about
      [built-in tools](/api/docs/guides/tools).
    - **MCP Tools**: Integrations with third-party systems via custom MCP servers
      or predefined connectors such as Google Drive and SharePoint. Learn more about
      [MCP Tools](/api/docs/guides/tools-connectors-mcp).
    - **Function calls (custom tools)**: Functions that are defined by you,
      enabling the model to call your own code with strongly typed arguments
      and outputs. Learn more about
      [function calling](/api/docs/guides/function-calling). You can also use
      custom tools to call your own code.

    - `BetaFunctionTool`

      Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

    - `BetaFileSearchTool`

      A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

    - `BetaComputerTool`

      A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

    - `BetaComputerUsePreviewTool`

      A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

    - `BetaWebSearchTool`

      Search the Internet for sources related to the prompt. Learn more about the
      [web search tool](/api/docs/guides/tools-web-search).

    - `Mcp`

      Give the model access to additional tools via remote Model Context Protocol
      (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

    - `CodeInterpreter`

      A tool that runs Python code to help generate a response to a prompt.

    - `ProgrammaticToolCalling`

    - `ImageGeneration`

      A tool that generates images using the GPT image models.

    - `LocalShell`

      A tool that allows the model to execute shell commands in a local environment.

    - `BetaFunctionShellTool`

      A tool that allows the model to execute shell commands.

    - `BetaCustomTool`

      A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

    - `BetaNamespaceTool`

      Groups function/custom tools under a shared namespace.

    - `BetaToolSearchTool`

      Hosted or BYOT tool search configuration for deferred tools.

    - `BetaWebSearchPreviewTool`

      This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

    - `BetaApplyPatchTool`

      Allows the assistant to create, delete, or update files using unified diffs.

  - `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.

    `minimum: 0`, `maximum: 1`

  - `background?: boolean | null`

    Whether to run the model response in the background.
    [Learn more](/api/docs/guides/background).

  - `completed_at?: number | null`

    Unix timestamp (in seconds) of when this Response was completed.
    Only present when the status is `completed`.

    `format: unixtime`

  - `conversation?: Conversation | null`

    The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation.

    - `id: string`

      The unique ID of the conversation that this response was associated with.

  - `image?: Image`

    - `context_compression: "enabled" | "disabled"`

      Effective image context optimization policy.

      - `"enabled"`

      - `"disabled"`

  - `max_output_tokens?: number | null`

    An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/api/docs/guides/reasoning).

  - `max_tool_calls?: number | null`

    The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

  - `moderation?: Moderation | null`

    Moderation results for the response input and output, if moderated completions were requested.

    - `input: ModerationResult | Error`

      Moderation for the response input.

      - `ModerationResult`

        A moderation result produced for the response input or output.

        - `categories: Record<string, boolean>`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: Record<string, Array<"text" | "image">>`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: Record<string, number>`

          A dictionary of moderation categories to scores.

        - `flagged: boolean`

          A boolean indicating whether the content was flagged by any category.

        - `model: string`

          The moderation model that produced this result.

        - `type: "moderation_result"`

          The object type, which was always `moderation_result` for successful moderation results.

          - `"moderation_result"`

      - `Error`

        An error produced while attempting moderation for the response input or output.

        - `code: string`

          The error code.

        - `message: string`

          The error message.

        - `type: "error"`

          The object type, which was always `error` for moderation failures.

          - `"error"`

    - `output: ModerationResult | Error`

      Moderation for the response output.

      - `ModerationResult`

        A moderation result produced for the response input or output.

        - `categories: Record<string, boolean>`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: Record<string, Array<"text" | "image">>`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: Record<string, number>`

          A dictionary of moderation categories to scores.

        - `flagged: boolean`

          A boolean indicating whether the content was flagged by any category.

        - `model: string`

          The moderation model that produced this result.

        - `type: "moderation_result"`

          The object type, which was always `moderation_result` for successful moderation results.

          - `"moderation_result"`

      - `Error`

        An error produced while attempting moderation for the response input or output.

        - `code: string`

          The error code.

        - `message: string`

          The error message.

        - `type: "error"`

          The object type, which was always `error` for moderation failures.

          - `"error"`

  - `previous_response_id?: string | null`

    The unique ID of the previous response to the model. Use this to
    create multi-turn conversations. Learn more about
    [conversation state](/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.

  - `prompt?: BetaResponsePrompt | null`

    Reference to a prompt template and its variables.
    [Learn more](/api/docs/guides/text?api-mode=responses#version-prompts-in-code).

    - `id: string`

      The unique identifier of the prompt template to use.

    - `variables?: Record<string, string | BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile> | null`

      Optional map of values to substitute in for variables in your
      prompt. The substitution values can either be strings, or other
      Response input types like images or files.

      - `string`

      - `BetaResponseInputText`

        A text input to the model.

      - `BetaResponseInputImage`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

      - `BetaResponseInputFile`

        A file input to the model.

    - `version?: string | null`

      Optional version of the prompt template.

  - `prompt_cache_diagnostics?: CacheMiss | CacheHit | ComparisonResponseNotFound | Unavailable`

    Prompt cache diagnostics requested for this response.

    - `CacheMiss`

      - `cache_missed_tokens: number`

        The estimated number of input tokens affected after the first detected divergence.

      - `reason: "model_changed" | "prompt_cache_key_changed" | "tools_changed" | 6 more`

        The reason prompt cache reuse did not occur.

        - `"model_changed"`

        - `"prompt_cache_key_changed"`

        - `"tools_changed"`

        - `"text_format_changed"`

        - `"reasoning_effort_changed"`

        - `"verbosity_changed"`

        - `"context_compacted"`

        - `"input_changed"`

        - `"service_tier_changed"`

      - `type: "cache_miss"`

        - `"cache_miss"`

      - `comparison_reusable_tokens?: number`

        The raw token count of the reusable prefix in the compared response.

    - `CacheHit`

      - `type: "cache_hit"`

        - `"cache_hit"`

    - `ComparisonResponseNotFound`

      - `type: "comparison_response_not_found"`

        - `"comparison_response_not_found"`

    - `Unavailable`

      - `type: "unavailable"`

        - `"unavailable"`

  - `prompt_cache_key?: string | null`

    Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/api/docs/guides/prompt-caching).

  - `prompt_cache_options?: PromptCacheOptions`

    The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

    - `mode: "implicit" | "explicit"`

      Whether implicit prompt-cache breakpoints were enabled.

      - `"implicit"`

      - `"explicit"`

    - `ttl: "30m" | "12h"`

      The minimum lifetime applied to each cache breakpoint.

      - `"30m"`

      - `"12h"`

    - `comparison_response_id?: string | null`

      The response ID supplied as the prompt cache diagnostics comparison.

  - `prompt_cache_retention?: "in_memory" | "24h" | null`

    Deprecated. Use `prompt_cache_options.ttl` instead.

    The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/api/docs/guides/prompt-caching#prompt-cache-retention).
    This field expresses a maximum retention policy, while
    `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two
    fields are independent and do not interact.
    For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported.

    For older models that support both `in_memory` and `24h`, the default depends on your organization's data retention policy:

    - Organizations without ZDR enabled default to `24h`.
    - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified.

    - `"in_memory"`

    - `"24h"`

  - `reasoning?: Reasoning | null`

    Configuration options for
    [reasoning models](/api/docs/guides/reasoning).

    - `context?: "auto" | "current_turn" | "all_turns" | null`

      Controls which reasoning items are rendered back to the model on later turns.
      If omitted or set to `auto`, the model determines the context mode. The
      `gpt-5.6` model family defaults to `all_turns`; earlier models default to
      `current_turn`.

      When returned on a response, this is the effective reasoning context mode
      used for the response.

      - `"auto"`

      - `"current_turn"`

      - `"all_turns"`

    - `effort?: "none" | "minimal" | "low" | 4 more | null`

      Constrains effort on reasoning for reasoning models. Currently supported
      values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
      Reducing reasoning effort can result in faster responses and fewer tokens
      used on reasoning in a response. Not all reasoning models support every
      value. See the
      [reasoning guide](/api/docs/guides/reasoning)
      for model-specific support.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `generate_summary?: "auto" | "concise" | "detailed" | null`

      **Deprecated:** use `summary` instead.

      A summary of the reasoning performed by the model. This can be
      useful for debugging and understanding the model's reasoning process.
      One of `auto`, `concise`, or `detailed`.

      - `"auto"`

      - `"concise"`

      - `"detailed"`

    - `mode?: (string & {}) | "standard" | "pro"`

      Controls the reasoning execution mode for the request.

      When returned on a response, this is the effective execution mode.

      - `(string & {})`

      - `"standard" | "pro"`

        - `"standard"`

        - `"pro"`

    - `summary?: "auto" | "concise" | "detailed" | null`

      A summary of the reasoning performed by the model. This can be
      useful for debugging and understanding the model's reasoning process.
      One of `auto`, `concise`, or `detailed`.

      `concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.

      - `"auto"`

      - `"concise"`

      - `"detailed"`

  - `safety_identifier?: string | null`

    A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.
    The IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

    `maxLength: 128`

  - `service_tier?: BetaServiceTier | null`

    Specifies the processing type used for serving the request.

    - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
    - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
    - If set to '[flex](/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.
    - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.
    - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for `gpt-5.6-sol`; a response served through it will show `service_tier=ultrafast`.
    - When not set, the default behavior is 'auto'.

    When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

    - `"auto"`

    - `"default"`

    - `"flex"`

    - `"scale"`

    - `"priority"`

    - `"fast"`

    - `"ultrafast"`

  - `status?: BetaResponseStatus`

    The status of the response generation. One of `completed`, `failed`,
    `in_progress`, `cancelled`, `queued`, or `incomplete`.

    - `"completed"`

    - `"failed"`

    - `"in_progress"`

    - `"cancelled"`

    - `"queued"`

    - `"incomplete"`

  - `text?: BetaResponseTextConfig`

    Configuration options for a text response from the model. Can be plain
    text or structured JSON data. Learn more:

    - [Text inputs and outputs](/api/docs/guides/text)
    - [Structured Outputs](/api/docs/guides/structured-outputs)

    - `format?: BetaResponseFormatTextConfig`

      An object specifying the format that the model must output.

      Configuring `{ "type": "json_schema" }` enables Structured Outputs,
      which ensures the model will match your supplied JSON schema. Learn more in the
      [Structured Outputs guide](/api/docs/guides/structured-outputs).

      The default format is `{ "type": "text" }` with no additional options.

      **Not recommended for gpt-4o and newer models:**

      Setting to `{ "type": "json_object" }` enables the older JSON mode, which
      ensures the message the model generates is valid JSON. Using `json_schema`
      is preferred for models that support it.

      - `Text`

        Default response format. Used to generate text responses.

        - `type: "text"`

          The type of response format being defined. Always `text`.

          - `"text"`

      - `BetaResponseFormatTextJSONSchemaConfig`

        JSON Schema response format. Used to generate structured JSON responses.
        Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `JSONObject`

        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`.

          - `"json_object"`

    - `verbosity?: "low" | "medium" | "high" | null`

      Constrains the verbosity of the model's response. Lower values will result in
      more concise responses, while higher values will result in more verbose responses.
      Currently supported values are `low`, `medium`, and `high`. The default is
      `medium`.

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tool_usage?: ToolUsage`

    Usage reported by hosted tools, separate from base model `usage`. The field
    can be omitted when tool usage is unavailable. When present, tool families
    with no recorded usage have zero counts.

    `image_gen` sums available token counts across image generation calls.
    Calls with missing or incomplete usage records may be skipped. Output
    token details and cached input counts can be omitted. An omitted cache
    count means cache usage is unknown.

    `web_search.num_requests` counts billable searches. Discounted searches
    and actions such as opening a page are excluded. Use billing records to
    reconcile final charges.

    - `image_gen: ImageGen`

      Aggregated usage statistics for image generation tool calls.

      - `input_tokens: number`

        The number of tokens (images and text) in the input prompt.

      - `input_tokens_details: InputTokensDetails`

        The input tokens detailed information for the image generation.

        - `image_tokens: number`

          The number of image tokens in the input prompt.

        - `text_tokens: number`

          The number of text tokens in the input prompt.

      - `output_tokens: number`

        The number of output tokens generated by the model.

      - `total_tokens: number`

        The total number of tokens (images and text) used for the image generation.

      - `cached_tokens?: number`

      - `cached_tokens_details?: CachedTokensDetails`

        - `cached_image_tokens: number`

        - `cached_text_tokens: number`

      - `output_tokens_details?: OutputTokensDetails`

        The output token details for the image generation.

        - `image_tokens: number`

          The number of image output tokens generated by the model.

        - `text_tokens: number`

          The number of text output tokens generated by the model.

    - `web_search: WebSearch`

      Aggregated billable usage statistics for web search tool calls.

      - `num_requests: number`

        The number of billable web search requests issued.

  - `top_logprobs?: number | null`

    An integer between 0 and 20 specifying the maximum number of most likely
    tokens to return at each token position, each with an associated log
    probability. In some cases, the number of returned tokens may be fewer than
    requested.

    `minimum: 0`, `maximum: 20`

  - `truncation?: "auto" | "disabled" | null`

    The truncation strategy to use for the model response.

    - `auto`: If the input to this Response exceeds
      the model's context window size, the model will truncate the
      response to fit the context window by dropping items from the beginning of the conversation.
      On some models, trimming can begin earlier because the API subtracts the model's
      maximum output allowance from its input limit, even if you set a lower `max_output_tokens`.
    - `disabled` (default): If the input size will exceed the context window
      size for a model, the request will fail with a 400 error.

    - `"auto"`

    - `"disabled"`

  - `usage?: BetaResponseUsage`

    Represents token usage details including input tokens, output tokens,
    a breakdown of output tokens, and the total tokens used.

    - `input_tokens: number`

      The number of input tokens.

    - `input_tokens_details: InputTokensDetails`

      A detailed breakdown of the input tokens.

      - `cache_write_tokens: number`

        The number of input tokens that were written to the cache.

      - `cached_tokens: number`

        The number of tokens that were retrieved from the cache.
        [More on prompt caching](/api/docs/guides/prompt-caching).

      - `cache_write_tokens_details?: CacheWriteTokensDetails`

        - `ttl_12h_tokens: number`

          The number of input tokens written with 12-hour retention.

        - `ttl_30m_tokens: number`

          The number of input tokens written with 30-minute retention.

    - `output_tokens: number`

      The number of output tokens.

    - `output_tokens_details: OutputTokensDetails`

      A detailed breakdown of the output tokens.

      - `reasoning_tokens: number`

        The number of reasoning tokens.

    - `total_tokens: number`

      The total number of tokens used.

  - `user?: string`

    This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.
    A stable identifier for your end-users.
    Used to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const betaResponse = await client.beta.responses.create();

console.log(betaResponse.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "access_programs": {
    "cyber": "standard"
  },
  "created_at": 0,
  "error": {
    "code": "server_error",
    "message": "message",
    "misalignment": {
      "detailed_explanation": "detailed_explanation",
      "error_type": "potentially_unintended_data_transfer",
      "review_target": "review_target",
      "steer": {
        "message": "message"
      }
    },
    "param": "param",
    "type": "type"
  },
  "incomplete_details": {
    "reason": "max_output_tokens"
  },
  "instructions": "string",
  "metadata": {
    "foo": "string"
  },
  "model": "gpt-6-astra",
  "object": "response",
  "output": [
    {
      "id": "id",
      "content": [
        {
          "annotations": [
            {
              "file_id": "file_id",
              "filename": "filename",
              "index": 0,
              "type": "file_citation"
            }
          ],
          "text": "text",
          "type": "output_text",
          "logprobs": [
            {
              "token": "token",
              "bytes": [
                0
              ],
              "logprob": 0,
              "top_logprobs": [
                {
                  "token": "token",
                  "bytes": [
                    0
                  ],
                  "logprob": 0
                }
              ]
            }
          ]
        }
      ],
      "role": "assistant",
      "status": "in_progress",
      "type": "message",
      "agent": {
        "agent_name": "agent_name"
      },
      "phase": "commentary"
    }
  ],
  "parallel_tool_calls": true,
  "temperature": 1,
  "tool_choice": "none",
  "tools": [
    {
      "name": "name",
      "parameters": {
        "foo": "bar"
      },
      "strict": true,
      "type": "function",
      "allowed_callers": [
        "direct"
      ],
      "async": true,
      "defer_loading": true,
      "description": "description",
      "output_schema": {
        "foo": "bar"
      }
    }
  ],
  "top_p": 1,
  "background": true,
  "completed_at": 0,
  "conversation": {
    "id": "id"
  },
  "image": {
    "context_compression": "enabled"
  },
  "max_output_tokens": 0,
  "max_tool_calls": 0,
  "moderation": {
    "input": {
      "categories": {
        "foo": true
      },
      "category_applied_input_types": {
        "foo": [
          "text"
        ]
      },
      "category_scores": {
        "foo": 0
      },
      "flagged": true,
      "model": "model",
      "type": "moderation_result"
    },
    "output": {
      "categories": {
        "foo": true
      },
      "category_applied_input_types": {
        "foo": [
          "text"
        ]
      },
      "category_scores": {
        "foo": 0
      },
      "flagged": true,
      "model": "model",
      "type": "moderation_result"
    }
  },
  "output_text": "output_text",
  "previous_response_id": "previous_response_id",
  "prompt": {
    "id": "id",
    "variables": {
      "foo": "string"
    },
    "version": "version"
  },
  "prompt_cache_diagnostics": {
    "cache_missed_tokens": 0,
    "reason": "model_changed",
    "type": "cache_miss",
    "comparison_reusable_tokens": 0
  },
  "prompt_cache_key": "prompt-cache-key-1234",
  "prompt_cache_options": {
    "mode": "implicit",
    "ttl": "30m",
    "comparison_response_id": "comparison_response_id"
  },
  "prompt_cache_retention": "in_memory",
  "reasoning": {
    "context": "auto",
    "effort": "none",
    "generate_summary": "auto",
    "mode": "standard",
    "summary": "auto"
  },
  "safety_identifier": "safety-identifier-1234",
  "service_tier": "auto",
  "status": "completed",
  "text": {
    "format": {
      "type": "text"
    },
    "verbosity": "low"
  },
  "tool_usage": {
    "image_gen": {
      "input_tokens": 0,
      "input_tokens_details": {
        "image_tokens": 0,
        "text_tokens": 0
      },
      "output_tokens": 0,
      "total_tokens": 0,
      "cached_tokens": 0,
      "cached_tokens_details": {
        "cached_image_tokens": 0,
        "cached_text_tokens": 0
      },
      "output_tokens_details": {
        "image_tokens": 0,
        "text_tokens": 0
      }
    },
    "web_search": {
      "num_requests": 0
    }
  },
  "top_logprobs": 0,
  "truncation": "auto",
  "usage": {
    "input_tokens": 0,
    "input_tokens_details": {
      "cache_write_tokens": 0,
      "cached_tokens": 0,
      "cache_write_tokens_details": {
        "ttl_12h_tokens": 0,
        "ttl_30m_tokens": 0
      }
    },
    "output_tokens": 0,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 0
  },
  "user": "user-1234"
}
```

### File input

```typescript
import OpenAI from "openai";

const openai = new OpenAI();

const response = await openai.responses.create({
    model: "gpt-6-astra",
    input: [
        {
            role: "user",
            content: [
                { type: "input_text", text: "what is in this file?" },
                {
                    type: "input_file",
                    file_url: "https://www.berkshirehathaway.com/letters/2024ltr.pdf",
                    detail: "auto",
                },
            ],
        },
    ],
});

console.log(response);
```

#### Response example

```json
{
  "id": "resp_686eef60237881a2bd1180bb8b13de430e34c516d176ff86",
  "object": "response",
  "access_programs": null,
  "created_at": 1752100704,
  "status": "completed",
  "completed_at": 1752100705,
  "background": false,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "max_tool_calls": null,
  "model": "gpt-6-astra",
  "output": [
    {
      "id": "msg_686eef60d3e081a29283bdcbc4322fd90e34c516d176ff86",
      "type": "message",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "annotations": [],
          "logprobs": [],
          "text": "The file seems to contain excerpts from a letter to the shareholders of Berkshire Hathaway Inc., likely written by Warren Buffett. It covers several topics:\n\n1. **Communication Philosophy**: Buffett emphasizes the importance of transparency and candidness in reporting mistakes and successes to shareholders.\n\n2. **Mistakes and Learnings**: The letter acknowledges past mistakes in business assessments and management hires, highlighting the importance of correcting errors promptly.\n\n3. **CEO Succession**: Mention of Greg Abel stepping in as the new CEO and continuing the tradition of honest communication.\n\n4. **Pete Liegl Story**: A detailed account of acquiring Forest River and the relationship with its founder, highlighting trust and effective business decisions.\n\n5. **2024 Performance**: Overview of business performance, particularly in insurance and investment activities, with a focus on GEICO's improvement.\n\n6. **Tax Contributions**: Discussion of significant tax payments to the U.S. Treasury, credited to shareholders' reinvestments.\n\n7. **Investment Strategy**: A breakdown of Berkshire\u2019s investments in both controlled subsidiaries and marketable equities, along with a focus on long-term holding strategies.\n\n8. **American Capitalism**: Reflections on America\u2019s economic development and Berkshire\u2019s role within it.\n\n9. **Property-Casualty Insurance**: Insights into the P/C insurance business model and its challenges and benefits.\n\n10. **Japanese Investments**: Information about Berkshire\u2019s investments in Japanese companies and future plans.\n\n11. **Annual Meeting**: Details about the upcoming annual gathering in Omaha, including schedule changes and new book releases.\n\n12. **Personal Anecdotes**: Light-hearted stories about family and interactions, conveying Buffett's personable approach.\n\n13. **Financial Performance Data**: Tables comparing Berkshire\u2019s annual performance to the S&P 500, showing impressive long-term gains.\n\nOverall, the letter reinforces Berkshire Hathaway's commitment to transparency, investment in both its businesses and the wider economy, and emphasizes strong leadership and prudent financial management."
        }
      ],
      "role": "assistant"
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "service_tier": "default",
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_logprobs": 0,
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 8438,
    "input_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0
    },
    "output_tokens": 398,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 8836
  },
  "user": null,
  "metadata": {}
}
```

### File search

```typescript
import OpenAI from "openai";

const openai = new OpenAI();

const response = await openai.responses.create({
    model: "gpt-6-astra",
    tools: [{
      type: "file_search",
      vector_store_ids: ["vs_1234567890"],
      max_num_results: 20
    }],
    input: "What are the attributes of an ancient brown dragon?",
});

console.log(response);
```

#### Response example

```json
{
  "id": "resp_67ccf4c55fc48190b71bd0463ad3306d09504fb6872380d7",
  "object": "response",
  "access_programs": null,
  "created_at": 1741485253,
  "status": "completed",
  "completed_at": 1741485254,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-6-astra",
  "output": [
    {
      "type": "file_search_call",
      "id": "fs_67ccf4c63cd08190887ef6464ba5681609504fb6872380d7",
      "status": "completed",
      "queries": [
        "attributes of an ancient brown dragon"
      ],
      "results": null
    },
    {
      "type": "message",
      "id": "msg_67ccf4c93e5c81909d595b369351a9d309504fb6872380d7",
      "status": "completed",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "The attributes of an ancient brown dragon include...",
          "annotations": [
            {
              "type": "file_citation",
              "index": 320,
              "file_id": "file-4wDz5b167pAf72nx1h9eiN",
              "filename": "dragons.pdf"
            },
            {
              "type": "file_citation",
              "index": 576,
              "file_id": "file-4wDz5b167pAf72nx1h9eiN",
              "filename": "dragons.pdf"
            },
            {
              "type": "file_citation",
              "index": 815,
              "file_id": "file-4wDz5b167pAf72nx1h9eiN",
              "filename": "dragons.pdf"
            },
            {
              "type": "file_citation",
              "index": 815,
              "file_id": "file-4wDz5b167pAf72nx1h9eiN",
              "filename": "dragons.pdf"
            },
            {
              "type": "file_citation",
              "index": 1030,
              "file_id": "file-4wDz5b167pAf72nx1h9eiN",
              "filename": "dragons.pdf"
            },
            {
              "type": "file_citation",
              "index": 1030,
              "file_id": "file-4wDz5b167pAf72nx1h9eiN",
              "filename": "dragons.pdf"
            },
            {
              "type": "file_citation",
              "index": 1156,
              "file_id": "file-4wDz5b167pAf72nx1h9eiN",
              "filename": "dragons.pdf"
            },
            {
              "type": "file_citation",
              "index": 1225,
              "file_id": "file-4wDz5b167pAf72nx1h9eiN",
              "filename": "dragons.pdf"
            }
          ],
          "logprobs": []
        }
      ]
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [
    {
      "type": "file_search",
      "filters": null,
      "max_num_results": 20,
      "ranking_options": {
        "ranker": "auto",
        "score_threshold": 0.0
      },
      "vector_store_ids": [
        "vs_1234567890"
      ]
    }
  ],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 18307,
    "input_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0
    },
    "output_tokens": 348,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 18655
  },
  "user": null,
  "metadata": {}
}
```

### Functions

```typescript
import OpenAI from "openai";

const openai = new OpenAI();

const tools = [
    {
        type: "function",
        name: "get_current_weather",
        description: "Get the current weather in a given location",
        parameters: {
            type: "object",
            properties: {
                location: {
                    type: "string",
                    description: "The city and state, e.g. San Francisco, CA",
                },
                unit: { type: "string", enum: ["celsius", "fahrenheit"] },
            },
            required: ["location", "unit"],
        },
    },
];

const response = await openai.responses.create({
    model: "gpt-6-astra",
    tools: tools,
    input: "What is the weather like in Boston today?",
    tool_choice: "auto",
});

console.log(response);
```

#### Response example

```json
{
  "id": "resp_67ca09c5efe0819096d0511c92b8c890096610f474011cc0",
  "object": "response",
  "access_programs": null,
  "created_at": 1741294021,
  "status": "completed",
  "completed_at": 1741294022,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-6-astra",
  "output": [
    {
      "type": "function_call",
      "id": "fc_67ca09c6bedc8190a7abfec07b1a1332096610f474011cc0",
      "call_id": "call_unLAR8MvFNptuiZK6K6HCy5k",
      "name": "get_current_weather",
      "arguments": "{\"location\":\"Boston, MA\",\"unit\":\"celsius\"}",
      "status": "completed"
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [
    {
      "type": "function",
      "description": "Get the current weather in a given location",
      "name": "get_current_weather",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "The city and state, e.g. San Francisco, CA"
          },
          "unit": {
            "type": "string",
            "enum": [
              "celsius",
              "fahrenheit"
            ]
          }
        },
        "required": [
          "location",
          "unit"
        ]
      },
      "strict": true
    }
  ],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 291,
    "output_tokens": 23,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 314,
    "input_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0
    }
  },
  "user": null,
  "metadata": {}
}
```

### Image input

```typescript
import OpenAI from "openai";

const openai = new OpenAI();

const response = await openai.responses.create({
    model: "gpt-6-astra",
    input: [
        {
            role: "user",
            content: [
                { type: "input_text", text: "what is in this image?" },
                {
                    type: "input_image",
                    image_url:
                        "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
                },
            ],
        },
    ],
});

console.log(response);
```

#### Response example

```json
{
  "id": "resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41",
  "object": "response",
  "access_programs": null,
  "created_at": 1741476777,
  "status": "completed",
  "completed_at": 1741476778,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-6-astra",
  "output": [
    {
      "type": "message",
      "id": "msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41",
      "status": "completed",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background.",
          "annotations": [],
          "logprobs": []
        }
      ]
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 328,
    "input_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0
    },
    "output_tokens": 52,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 380
  },
  "user": null,
  "metadata": {}
}
```

### Reasoning

```typescript
import OpenAI from "openai";
const openai = new OpenAI();

const response = await openai.responses.create({
    model: "gpt-6-astra",
    input: "How much wood would a woodchuck chuck?",
    reasoning: {
      effort: "high"
    }
});

console.log(response);
```

#### Response example

```json
{
  "id": "resp_67ccd7eca01881908ff0b5146584e408072912b2993db808",
  "object": "response",
  "access_programs": null,
  "created_at": 1741477868,
  "status": "completed",
  "completed_at": 1741477869,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-6-astra",
  "output": [
    {
      "type": "message",
      "id": "msg_67ccd7f7b5848190a6f3e95d809f6b44072912b2993db808",
      "status": "completed",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "The classic tongue twister...",
          "annotations": [],
          "logprobs": []
        }
      ]
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": "high",
    "summary": null
  },
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 81,
    "input_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0
    },
    "output_tokens": 1035,
    "output_tokens_details": {
      "reasoning_tokens": 832
    },
    "total_tokens": 1116
  },
  "user": null,
  "metadata": {}
}
```

### Streaming

```typescript
import OpenAI from "openai";

const openai = new OpenAI();

const response = await openai.responses.create({
    model: "gpt-6-astra",
    instructions: "You are a helpful assistant.",
    input: "Hello!",
    stream: true,
});

for await (const event of response) {
    console.log(event);
}
```

#### Response example

```json
event: response.created
data: {"type":"response.created","response":{"id":"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654","object":"response","access_programs":null,"created_at":1741290958,"status":"in_progress","error":null,"incomplete_details":null,"instructions":"You are a helpful assistant.","max_output_tokens":null,"model":"gpt-6-astra","output":[],"parallel_tool_calls":true,"previous_response_id":null,"reasoning":{"effort":null,"summary":null},"store":true,"temperature":1.0,"text":{"format":{"type":"text"}},"tool_choice":"auto","tools":[],"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0}

event: response.in_progress
data: {"type":"response.in_progress","response":{"id":"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654","object":"response","access_programs":null,"created_at":1741290958,"status":"in_progress","error":null,"incomplete_details":null,"instructions":"You are a helpful assistant.","max_output_tokens":null,"model":"gpt-6-astra","output":[],"parallel_tool_calls":true,"previous_response_id":null,"reasoning":{"effort":null,"summary":null},"store":true,"temperature":1.0,"text":{"format":{"type":"text"}},"tool_choice":"auto","tools":[],"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1}

event: response.output_item.added
data: {"type":"response.output_item.added","output_index":0,"item":{"id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","type":"message","status":"in_progress","role":"assistant","content":[]},"sequence_number":2}

event: response.content_part.added
data: {"type":"response.content_part.added","item_id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","output_index":0,"content_index":0,"part":{"type":"output_text","text":"","annotations":[],"logprobs":[]},"sequence_number":3}

event: response.output_text.delta
data: {"type":"response.output_text.delta","item_id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","output_index":0,"content_index":0,"delta":"Hi","sequence_number":4,"logprobs":[]}

: Intermediate response events omitted.

event: response.output_text.done
data: {"type":"response.output_text.done","item_id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","output_index":0,"content_index":0,"text":"Hi there! How can I assist you today?","sequence_number":10,"logprobs":[]}

event: response.content_part.done
data: {"type":"response.content_part.done","item_id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","output_index":0,"content_index":0,"part":{"type":"output_text","text":"Hi there! How can I assist you today?","annotations":[],"logprobs":[]},"sequence_number":11}

event: response.output_item.done
data: {"type":"response.output_item.done","output_index":0,"item":{"id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","type":"message","status":"completed","role":"assistant","content":[{"type":"output_text","text":"Hi there! How can I assist you today?","annotations":[],"logprobs":[]}]},"sequence_number":12}

event: response.completed
data: {"type":"response.completed","response":{"id":"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654","object":"response","access_programs":null,"created_at":1741290958,"status":"completed","error":null,"incomplete_details":null,"instructions":"You are a helpful assistant.","max_output_tokens":null,"model":"gpt-6-astra","output":[{"id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","type":"message","status":"completed","role":"assistant","content":[{"type":"output_text","text":"Hi there! How can I assist you today?","annotations":[],"logprobs":[]}]}],"parallel_tool_calls":true,"previous_response_id":null,"reasoning":{"effort":null,"summary":null},"store":true,"temperature":1.0,"text":{"format":{"type":"text"}},"tool_choice":"auto","tools":[],"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":37,"output_tokens":11,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":48,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0}},"user":null,"metadata":{}},"sequence_number":13}

```

### Text input

```typescript
import OpenAI from "openai";

const openai = new OpenAI();

const response = await openai.responses.create({
    model: "gpt-6-astra",
    input: "Tell me a three sentence bedtime story about a unicorn."
});

console.log(response);
```

#### Response example

```json
{
  "id": "resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b",
  "object": "response",
  "access_programs": null,
  "created_at": 1741476542,
  "status": "completed",
  "completed_at": 1741476543,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-6-astra",
  "output": [
    {
      "type": "message",
      "id": "msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
      "status": "completed",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "In a peaceful grove beneath a silver moon, a unicorn named Lumina discovered a hidden pool that reflected the stars. As she dipped her horn into the water, the pool began to shimmer, revealing a pathway to a magical realm of endless night skies. Filled with wonder, Lumina whispered a wish for all who dream to find their own hidden magic, and as she glanced back, her hoofprints sparkled like stardust.",
          "annotations": [],
          "logprobs": []
        }
      ]
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 36,
    "input_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0
    },
    "output_tokens": 87,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 123
  },
  "user": null,
  "metadata": {}
}
```

### Web search

```typescript
import OpenAI from "openai";

const openai = new OpenAI();

const response = await openai.responses.create({
    model: "gpt-6-astra",
    tools: [{ type: "web_search_preview" }],
    input: "What was a positive news story from today?",
});

console.log(response);
```

#### Response example

```json
{
  "id": "resp_67ccf18ef5fc8190b16dbee19bc54e5f087bb177ab789d5c",
  "object": "response",
  "access_programs": null,
  "created_at": 1741484430,
  "status": "completed",
  "completed_at": 1741484431,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-6-astra",
  "output": [
    {
      "type": "web_search_call",
      "id": "ws_67ccf18f64008190a39b619f4c8455ef087bb177ab789d5c",
      "status": "completed"
    },
    {
      "type": "message",
      "id": "msg_67ccf190ca3881909d433c50b1f6357e087bb177ab789d5c",
      "status": "completed",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "As of today, March 9, 2025, one notable positive news story...",
          "annotations": [
            {
              "type": "url_citation",
              "start_index": 442,
              "end_index": 557,
              "url": "https://.../?utm_source=chatgpt.com",
              "title": "..."
            },
            {
              "type": "url_citation",
              "start_index": 962,
              "end_index": 1077,
              "url": "https://.../?utm_source=chatgpt.com",
              "title": "..."
            },
            {
              "type": "url_citation",
              "start_index": 1336,
              "end_index": 1451,
              "url": "https://.../?utm_source=chatgpt.com",
              "title": "..."
            }
          ],
          "logprobs": []
        }
      ]
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [
    {
      "type": "web_search_preview",
      "domains": [],
      "search_context_size": "medium",
      "user_location": {
        "type": "approximate",
        "city": null,
        "country": "US",
        "region": null,
        "timezone": null
      }
    }
  ],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 328,
    "input_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0
    },
    "output_tokens": 356,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 684
  },
  "user": null,
  "metadata": {}
}
```

## Delete a model response

`client.beta.responses.delete(stringresponseID, ResponseDeleteParamsparams?, RequestOptionsoptions?): void`

**delete** `/responses/{response_id}?beta=true`

Deletes a model response with the given ID.

### Parameters

- `responseID: string`

- `params: ResponseDeleteParams`

  - `betas?: Array<"responses_multi_agent=v1">`

    Optional beta features to enable for this request.

    - `"responses_multi_agent=v1"`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

await client.beta.responses.delete('resp_677efb5139a88190b512bc3fef8e535d');
```

### Example

```typescript
import OpenAI from "openai";
const client = new OpenAI();

const response = await client.responses.delete("resp_123");
console.log(response);
```

#### Response example

```json
{
  "id": "resp_123",
  "object": "response.deleted",
  "deleted": true
}
```

## Get a model response

`client.beta.responses.retrieve(stringresponseID, ResponseRetrieveParamsparams?, RequestOptionsoptions?): BetaResponse | Stream<BetaResponseStreamEvent>`

**get** `/responses/{response_id}?beta=true`

Retrieves a model response with the given ID.

### Parameters

- `responseID: string`

- `ResponseRetrieveParams = ResponseRetrieveParamsNonStreaming | ResponseRetrieveParamsStreaming`

  - `ResponseRetrieveParamsBase`

    - `include?: Array<BetaResponseIncludable>`

      Query param: Additional fields to include in the response. See the `include`
      parameter for Response creation above for more information.

      - `"file_search_call.results"`

      - `"web_search_call.results"`

      - `"web_search_call.action.sources"`

      - `"message.input_image.image_url"`

      - `"computer_call_output.output.image_url"`

      - `"code_interpreter_call.outputs"`

      - `"reasoning.encrypted_content"`

      - `"message.output_text.logprobs"`

    - `include_obfuscation?: boolean`

      Query param: When true, stream obfuscation will be enabled. Stream obfuscation adds
      random characters to an `obfuscation` field on streaming delta events
      to normalize payload sizes as a mitigation to certain side-channel
      attacks. These obfuscation fields are included by default, but add a
      small amount of overhead to the data stream. You can set
      `include_obfuscation` to false to optimize for bandwidth if you trust
      the network links between your application and the OpenAI API.

    - `starting_after?: number`

      Query param: The sequence number of the event after which to start streaming.

    - `stream?: false`

      Query param: If set to true, the model response data will be streamed to the client
      as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
      See the [Streaming section below](/api/reference/resources/responses/streaming-events)
      for more information.

      - `false`

    - `betas?: Array<"responses_multi_agent=v1">`

      Header param: Optional beta features to enable for this request.

      - `"responses_multi_agent=v1"`

  - `ResponseRetrieveParamsNonStreaming extends ResponseRetrieveParamsBase`

    - `stream?: false`

      Query param: If set to true, the model response data will be streamed to the client
      as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
      See the [Streaming section below](/api/reference/resources/responses/streaming-events)
      for more information.

  - `ResponseRetrieveParamsStreaming extends ResponseRetrieveParamsBase`

    - `stream: true`

      Query param: If set to true, the model response data will be streamed to the client
      as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
      See the [Streaming section below](/api/reference/resources/responses/streaming-events)
      for more information.

      - `true`

### Returns

- `BetaResponse`

  - `id: string`

    Unique identifier for this Response.

  - `access_programs: AccessPrograms | null`

    - `cyber: "standard" | "daybreak_blue" | "daybreak_red"`

      The effective Cyber access program used for this response.

      - `"standard"`

      - `"daybreak_blue"`

      - `"daybreak_red"`

  - `created_at: number`

    Unix timestamp (in seconds) of when this Response was created.

    `format: unixtime`

  - `error: BetaResponseError | null`

    An error object returned when the model fails to generate a Response.

    - `code: "server_error" | "rate_limit_exceeded" | "invalid_prompt" | 18 more`

      The error code for the response.

      - `"server_error"`

      - `"rate_limit_exceeded"`

      - `"invalid_prompt"`

      - `"data_residency_mismatch"`

      - `"bio_policy"`

      - `"misalignment_policy_violation"`

      - `"vector_store_timeout"`

      - `"invalid_image"`

      - `"invalid_image_format"`

      - `"invalid_base64_image"`

      - `"invalid_image_url"`

      - `"image_too_large"`

      - `"image_too_small"`

      - `"image_parse_error"`

      - `"image_content_policy_violation"`

      - `"invalid_image_mode"`

      - `"image_file_too_large"`

      - `"unsupported_image_media_type"`

      - `"empty_image_file"`

      - `"failed_to_download_image"`

      - `"image_file_not_found"`

    - `message: string`

      A human-readable description of the error.

    - `misalignment?: Misalignment`

      - `detailed_explanation?: string`

        The public explanation for this block.

      - `error_type?: (string & {}) | "potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

        An optional classification; clients must accept additional values.

        - `(string & {})`

        - `"potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

          - `"potentially_unintended_data_transfer"`

          - `"potentially_unintended_data_access"`

          - `"potentially_unintended_destructive_activity"`

          - `"other"`

      - `review_target?: string | null`

        An opaque target for explicitly continuing this review, or null when unavailable.

        `minLength: 1`, `maxLength: 96`

      - `steer?: Steer`

        An optional public continuation instruction.

        - `message: string`

          The public continuation instruction.

    - `param?: string | null`

      The request parameter associated with the error, or null if none was recorded.

    - `type?: string | null`

      The original error type, or null if it was not recorded.

  - `incomplete_details: IncompleteDetails | null`

    Details about why the response is incomplete.

    - `reason?: "max_output_tokens" | "max_messages" | "content_filter" | "steered"`

      The reason why the response is incomplete. `steered` means
      the response stopped at a safe output boundary after a
      WebSocket `response.steer` event. The server can then create
      a successor response automatically with the queued input.

      - `"max_output_tokens"`

      - `"max_messages"`

      - `"content_filter"`

      - `"steered"`

  - `instructions: string | Array<BetaResponseInputItem> | null`

    A system (or developer) message inserted into the model's context.

    When using along with `previous_response_id`, the instructions from a previous
    response will not be carried over to the next response. This makes it simple
    to swap out system (or developer) messages in new responses.

    - `string`

    - `Array<BetaResponseInputItem>`

      - `BetaEasyInputMessage`

        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.

          - `string`

          - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

            A list of one or many input items to the model, containing different content
            types.

            - `BetaResponseInputText`

              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`.

                - `"input_text"`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `detail: BetaImageDetail`

                The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                - `"low"`

                - `"high"`

                - `"auto"`

                - `"original"`

              - `type: "input_image"`

                The type of the input item. Always `input_image`.

                - `"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.

                `format: uri`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFile`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"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`.

                - `"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.

                `format: uri`

              - `filename?: string`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

        - `role: "user" | "assistant" | "system" | "developer"`

          The role of the message input. One of `user`, `assistant`, `system`, or
          `developer`.

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"developer"`

        - `phase?: "commentary" | "final_answer" | 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.

          - `"commentary"`

          - `"final_answer"`

        - `type?: "message"`

          The type of the message input. Always `message`.

          - `"message"`

      - `Message`

        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.

        - `content: BetaResponseInputMessageContentList`

          A list of one or many input items to the model, containing different content
          types.

        - `role: "user" | "system" | "developer"`

          The role of the message input. One of `user`, `system`, or `developer`.

          - `"user"`

          - `"system"`

          - `"developer"`

        - `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"`

          The status of item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type?: "message"`

          The type of the message input. Always set to `message`.

          - `"message"`

      - `BetaResponseOutputMessage`

        An output message from the model.

        - `id: string`

          The unique ID of the output message.

        - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

          The content of the output message.

          - `BetaResponseOutputText`

            A text output from the model.

            - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

              The annotations of the text output.

              - `FileCitation`

                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 in the output text at which to insert the file citation.

                - `type: "file_citation"`

                  The type of the file citation. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation`

                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_citation"`

                - `url: string`

                  The URL of the web resource.

                  `format: uri`

              - `ContainerFileCitation`

                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`.

                  - `"container_file_citation"`

              - `FilePath`

                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`.

                  - `"file_path"`

            - `text: string`

              The text output from the model.

            - `type: "output_text"`

              The type of the output text. Always `output_text`.

              - `"output_text"`

            - `logprobs?: Array<Logprob>`

              - `token: string`

              - `bytes: Array<number>`

              - `logprob: number`

              - `top_logprobs: Array<TopLogprob>`

                - `token: string`

                - `bytes: Array<number>`

                - `logprob: number`

          - `BetaResponseOutputRefusal`

            A refusal from the model.

            - `refusal: string`

              The refusal explanation from the model.

            - `type: "refusal"`

              The type of the refusal. Always `refusal`.

              - `"refusal"`

        - `role: "assistant"`

          The role of the output message. Always `assistant`.

          - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "message"`

          The type of the output message. Always `message`.

          - `"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" | "final_answer" | 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.

          - `"commentary"`

          - `"final_answer"`

      - `BetaResponseFileSearchToolCall`

        The results of a file search tool call. See the
        [file search guide](/api/docs/guides/tools-file-search) 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`,

          - `"in_progress"`

          - `"searching"`

          - `"completed"`

          - `"incomplete"`

          - `"failed"`

        - `type: "file_search_call"`

          The type of the file search tool call. Always `file_search_call`.

          - `"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.

            - `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.

            `format: float`

          - `text?: string`

            The text that was retrieved from the file.

      - `BetaResponseComputerToolCall`

        A tool call to a computer use tool. See the
        [computer use guide](/api/docs/guides/tools-computer-use) 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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "computer_call"`

          The type of the computer call. Always `computer_call`.

          - `"computer_call"`

        - `action?: BetaComputerAction`

          A click action.

          - `Click`

            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`.

              - `"left"`

              - `"right"`

              - `"wheel"`

              - `"back"`

              - `"forward"`

            - `type: "click"`

              Specifies the event type. For a click action, this property is always `click`.

              - `"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`

            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`.

              - `"double_click"`

            - `x: number`

              The x-coordinate where the double click occurred.

            - `y: number`

              The y-coordinate where the double click occurred.

          - `Drag`

            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`.

              - `"drag"`

            - `keys?: Array<string> | null`

              The keys being held while dragging the mouse.

          - `Keypress`

            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`.

              - `"keypress"`

          - `Move`

            A mouse move action.

            - `type: "move"`

              Specifies the event type. For a move action, this property is always set to `move`.

              - `"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`

            A screenshot action.

            - `type: "screenshot"`

              Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

              - `"screenshot"`

          - `Scroll`

            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`.

              - `"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`

            An action to type in text.

            - `text: string`

              The text to type.

            - `type: "type"`

              Specifies the event type. For a type action, this property is always set to `type`.

              - `"type"`

          - `Wait`

            A wait action.

            - `type: "wait"`

              Specifies the event type. For a wait action, this property is always set to `wait`.

              - `"wait"`

        - `actions?: BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

          - `Click`

            A click action.

          - `DoubleClick`

            A double click action.

          - `Drag`

            A drag action.

          - `Keypress`

            A collection of keypresses the model would like to perform.

          - `Move`

            A mouse move action.

          - `Screenshot`

            A screenshot action.

          - `Scroll`

            A scroll action.

          - `Type`

            An action to type in text.

          - `Wait`

            A wait action.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput`

        The output of a computer tool call.

        - `call_id: string`

          The ID of the computer tool call that produced the output.

          `minLength: 1`, `maxLength: 64`

        - `output: BetaResponseComputerToolCallOutputScreenshot`

          A computer screenshot image used with the computer use tool.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is
            always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `file_id?: string`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url?: string`

            The URL of the screenshot image.

            `format: uri`

        - `type: "computer_call_output"`

          The type of the computer tool call output. Always `computer_call_output`.

          - `"computer_call_output"`

        - `id?: string | null`

          The ID of the computer tool call output.

        - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

          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.

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseFunctionWebSearch`

        The results of a web search tool call. See the
        [web search guide](/api/docs/guides/tools-web-search) for more information.

        - `id: string`

          The unique ID of the web search tool call.

        - `action: Search | OpenPage | FindInPage`

          An object describing the specific action taken in this web search call.
          Includes details on how the model used the web (search, open_page, find_in_page).

          - `Search`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries?: Array<string>`

              The search queries.

            - `query?: string`

              The search query.

            - `sources?: Array<Source>`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

                `format: uri`

          - `OpenPage`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url?: string | null`

              The URL opened by the model.

              `format: uri`

          - `FindInPage`

            Action type "find_in_page": Searches for a pattern within a loaded page.

            - `pattern: string`

              The pattern or text to search for within the page.

            - `type: "find_in_page"`

              The action type.

              - `"find_in_page"`

            - `url: string`

              The URL of the page searched for the pattern.

              `format: uri`

        - `status: "in_progress" | "searching" | "completed" | 2 more`

          The status of the web search tool call.

          - `"in_progress"`

          - `"searching"`

          - `"completed"`

          - `"failed"`

          - `"incomplete"`

        - `type: "web_search_call"`

          The type of the web search tool call. Always `web_search_call`.

          - `"web_search_call"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseFunctionToolCall`

        A tool call to run a function. See the
        [function calling guide](/api/docs/guides/function-calling) 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`.

          - `"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.

        - `async?: boolean`

          Whether the function tool call runs asynchronously.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `FunctionCallOutput`

        The output of a function tool call.

        - `output: string | BetaResponseFunctionCallOutputItemList`

          Text, image, or file output of the function tool call.

          - `string`

          - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

            An array of content outputs (text, image, file) for the function tool call.

            - `BetaResponseInputTextContent`

              A text input to the model.

              - `text: string`

                The text input to the model.

                `maxLength: 10485760`

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImageContent`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

              - `type: "input_image"`

                The type of the input item. Always `input_image`.

                - `"input_image"`

              - `detail?: BetaImageDetail | null`

                The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

              - `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.

                `maxLength: 20971520`, `format: uri`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFileContent`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"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`.

                - `"auto"`

                - `"low"`

                - `"high"`

              - `file_data?: string | null`

                The base64-encoded data of the file to be sent to the model.

                `maxLength: 73400320`

              - `file_id?: string | null`

                The ID of the file to be sent to the model.

              - `file_url?: string | null`

                The URL of the file to be sent to the model.

                `format: uri`

              - `filename?: string | null`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

        - `type: "function_call_output"`

          The type of the function tool call output. Always `function_call_output`.

          - `"function_call_output"`

        - `id?: string | null`

          The unique ID of the function tool call output. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

          The unique ID of the function tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `name?: string | null`

          The name of the tool that produced the output.

          `minLength: 1`, `maxLength: 128`

        - `namespace?: string | null`

          The namespace of the tool that produced the output.

          `minLength: 1`, `maxLength: 128`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AgentMessage`

        A message routed between agents.

        - `author: string`

          The sending agent identity.

        - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

          Plaintext, image, or encrypted content sent between agents.

          - `BetaResponseInputTextContent`

            A text input to the model.

          - `BetaResponseInputImageContent`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

          - `EncryptedContent`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

              `maxLength: 10485760`

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

        - `id?: string | null`

          The unique ID of this agent message item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall`

        - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

          The multi-agent action that was executed.

          - `"spawn_agent"`

          - `"interrupt_agent"`

          - `"list_agents"`

          - `"send_message"`

          - `"followup_task"`

          - `"wait_agent"`

        - `arguments: string`

          The action arguments as a JSON string.

        - `call_id: string`

          The unique ID linking this call to its output.

          `minLength: 1`, `maxLength: 64`

        - `type: "multi_agent_call"`

          The item type. Always `multi_agent_call`.

          - `"multi_agent_call"`

        - `id?: string | null`

          The unique ID of this multi-agent call.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput`

        - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

          The multi-agent action that produced this result.

          - `"spawn_agent"`

          - `"interrupt_agent"`

          - `"list_agents"`

          - `"send_message"`

          - `"followup_task"`

          - `"wait_agent"`

        - `call_id: string`

          The unique ID of the multi-agent call.

          `minLength: 1`, `maxLength: 64`

        - `output: Array<Output>`

          Text output returned by the multi-agent action.

          - `text: string`

            The text content.

            `maxLength: 10485760`

          - `type: "output_text"`

            The content type. Always `output_text`.

            - `"output_text"`

          - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

            Citations associated with the text content.

            - `FileCitation`

              - `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.

                `minimum: 0`

              - `type: "file_citation"`

                The citation type. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation`

              - `end_index: number`

                The index of the last character of the citation in the message.

                `minimum: 0`

              - `start_index: number`

                The index of the first character of the citation in the message.

                `minimum: 0`

              - `title: string`

                The title of the cited resource.

              - `type: "url_citation"`

                The citation type. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the cited resource.

                `format: uri`

            - `ContainerFileCitation`

              - `container_id: string`

                The ID of the container.

              - `end_index: number`

                The index of the last character of the citation in the message.

                `minimum: 0`

              - `file_id: string`

                The ID of the container file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

                The index of the first character of the citation in the message.

                `minimum: 0`

              - `type: "container_file_citation"`

                The citation type. Always `container_file_citation`.

                - `"container_file_citation"`

        - `type: "multi_agent_call_output"`

          The item type. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `id?: string | null`

          The unique ID of this multi-agent call output.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall`

        - `arguments: unknown`

          The arguments supplied to the tool search call.

        - `type: "tool_search_call"`

          The item type. Always `tool_search_call`.

          - `"tool_search_call"`

        - `id?: string | null`

          The unique ID of this tool search call.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

          The unique ID of the tool search call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `execution?: "server" | "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the tool search call.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseToolSearchOutputItemParam`

        - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

          The loaded tool definitions returned by the tool search output.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

              - `"function"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

            - `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`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

            - `type: "file_search"`

              The type of the file search tool. Always `file_search`.

              - `"file_search"`

            - `vector_store_ids: Array<string>`

              The IDs of the vector stores to search.

            - `filters?: ComparisonFilter | CompoundFilter | null`

              A filter to apply.

              - `ComparisonFilter`

                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

                  - `"eq"`

                  - `"ne"`

                  - `"gt"`

                  - `"gte"`

                  - `"lt"`

                  - `"lte"`

                  - `"in"`

                  - `"nin"`

                - `value: string | number | boolean | Array<string | number>`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `Array<string | number>`

                    - `string`

                    - `number`

              - `CompoundFilter`

                Combine multiple filters using `and` or `or`.

                - `filters: Array<ComparisonFilter | unknown>`

                  Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

                  - `ComparisonFilter`

                    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

                      - `"eq"`

                      - `"ne"`

                      - `"gt"`

                      - `"gte"`

                      - `"lt"`

                      - `"lte"`

                      - `"in"`

                      - `"nin"`

                    - `value: string | number | boolean | Array<string | number>`

                      The value to compare against the attribute key; supports string, number, or boolean types.

                      - `string`

                      - `number`

                      - `boolean`

                      - `Array<string | number>`

                        - `string`

                        - `number`

                  - `unknown`

                - `type: "and" | "or"`

                  Type of operation: `and` or `or`.

                  - `"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`

              Ranking options for search.

              - `hybrid_search?: HybridSearch`

                Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

                - `embedding_weight: number`

                  The weight of the embedding in the reciprocal ranking fusion.

                - `text_weight: number`

                  The weight of the text in the reciprocal ranking fusion.

              - `ranker?: "auto" | "default-2024-11-15"`

                The ranker to use for the file search.

                - `"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`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `type: "computer"`

              The type of the computer tool. Always `computer`.

              - `"computer"`

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `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.

              - `"windows"`

              - `"mac"`

              - `"linux"`

              - `"ubuntu"`

              - `"browser"`

            - `type: "computer_use_preview"`

              The type of the computer use tool. Always `computer_use_preview`.

              - `"computer_use_preview"`

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

            - `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`.

              - `"web_search"`

              - `"web_search_2025_08_26"`

            - `external_web_access?: boolean`

              Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

            - `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.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `user_location?: UserLocation | null`

              The approximate location of the user. If omitted or null, defaults to the
              United States. To avoid this fallback, pass `{"type": "approximate"}` without
              location fields. To localize results, provide the relevant location fields.

              - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type?: "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

              - `"mcp"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools?: Array<string> | McpToolFilter | null`

              List of allowed tool names or a filter object.

              - `Array<string>`

              - `McpToolFilter`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

              This field is deprecated for models released after September 1, 2026.
              Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
              connect through a Secure MCP Tunnel.

              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`

              - `"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" | null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter`

                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`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                    it will match this filter.

                  - `tool_names?: Array<string>`

                    List of allowed tool names.

                - `never?: Never`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

              `format: uri`

            - `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`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string | CodeInterpreterToolAuto`

              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.

              - `string`

              - `CodeInterpreterToolAuto`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids?: Array<string>`

                  An optional list of uploaded files to make available to your code.

                  `maxItems: 50`

                - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                    - `type: "disabled"`

                      Disable outbound network access. Always `disabled`.

                      - `"disabled"`

                  - `BetaContainerNetworkPolicyAllowlist`

                    - `allowed_domains: Array<string>`

                      A list of allowed domains when type is `allowlist`.

                      `minItems: 1`

                    - `type: "allowlist"`

                      Allow outbound network access only to specified domains. Always `allowlist`.

                      - `"allowlist"`

                    - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                      Optional domain-scoped secrets for allowlisted domains.

                      `minItems: 1`

                      - `domain: string`

                        The domain associated with the secret.

                        `minLength: 1`

                      - `name: string`

                        The name of the secret to inject for the domain.

                        `minLength: 1`

                      - `value: string`

                        The secret value to inject for the domain.

                        `minLength: 1`, `maxLength: 10485760`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action?: "generate" | "edit" | "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background?: "transparent" | "opaque" | "auto"`

              Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
              `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
              Transparent backgrounds are available for supported GPT Image models. For
              `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
              using `transparent`, set the output format to `png` or `webp`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `complexity?: "low" | "medium" | "high"`

              Computation spent planning the image, independently of rendering quality.
              Overrides the outer response's `reasoning.effort` for image generation.
              When omitted, inherits a supported outer reasoning effort or uses the
              image model's configured default.
              For SVG output, controls the reference image, not the SVG author's
              reasoning.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `frame_count?: number`

              Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

              `minimum: 2`, `maximum: 16`

            - `frame_duration_ms?: number`

              Duration of each GIF frame in milliseconds, rounded to 10 ms.
              Requires `output_format` to be `gif`. Default: 200.

              `minimum: 20`, `maximum: 2000`

            - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

              - `"high"`

              - `"low"`

            - `input_image_mask?: InputImageMask`

              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" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              Deprecated values:

              - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

              - `(string & {})`

              - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                - `"gpt-image-1"`

                - `"gpt-image-1-mini"`

                - `"gpt-image-2"`

                - `"gpt-image-2-2026-04-21"`

                - `"gpt-image-2.5-sunburst"`

                - `"gpt-image-2.5-sunburst-2026-09-08"`

                - `"gpt-image-2.5-flare"`

                - `"gpt-image-2.5-flare-2026-09-08"`

                - `"gpt-image-2.6-sunburst"`

                - `"gpt-image-2.6-flare"`

                - `"gpt-image-1.5"`

                - `"chatgpt-image-latest"`

            - `moderation?: "auto" | "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression?: number`

              Compression level for the output image. Default: 100.

              `minimum: 0`, `maximum: 100`

            - `output_format?: "png" | "webp" | "jpeg" | 2 more`

              The output format of the generated image. One of `png`, `webp`, `jpeg`,
              `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
              that supports the selected format. GIF output does not support
              partial image streaming (`partial_images` greater than `0`),
              `input_image_mask`, or custom `output_compression`.
              Responses lifecycle events can still be streamed for GIF output.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

              - `"gif"`

              - `"svg"`

            - `partial_images?: number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              `minimum: 0`, `maximum: 3`

            - `quality?: "low" | "medium" | "high" | 3 more`

              The quality of the generated image. The GPT image models support `low`,
              `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
              including their `2026-09-08` snapshots, also support `xhigh` and `max`.
              Default: `auto`.

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

              - `"auto"`

            - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

              - `(string & {})`

              - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

            - `svg?: Svg`

              SVG author model settings. Requires `output_format` to be `svg`.
              When SVG model selection is enabled, omitting this object uses the
              outer response model. Otherwise, the default SVG author is used and
              explicit model overrides are unavailable.

              - `model?: string`

                `minLength: 1`

              - `reasoning?: Reasoning | null`

                Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                - `effort?: "none" | "minimal" | "low" | 4 more`

                  Controls how much effort the model should spend on reasoning for this request.

                  - `"none"`

                  - `"minimal"`

                  - `"low"`

                  - `"medium"`

                  - `"high"`

                  - `"xhigh"`

                  - `"max"`

          - `LocalShell`

            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`.

              - `"local_shell"`

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

              - `BetaContainerAuto`

                - `type: "container_auto"`

                  Automatically creates a container for this request

                  - `"container_auto"`

                - `file_ids?: Array<string>`

                  An optional list of uploaded files to make available to your code.

                  `maxItems: 50`

                - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                  The memory limit for the container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                  - `BetaContainerNetworkPolicyAllowlist`

                - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

                  An optional list of skills referenced by id or inline data.

                  `maxItems: 200`

                  - `BetaSkillReference`

                    - `skill_id: string`

                      The ID of the referenced skill.

                      `minLength: 1`, `maxLength: 64`

                    - `type: "skill_reference"`

                      References a skill created with the /v1/skills endpoint.

                      - `"skill_reference"`

                    - `version?: string`

                      Optional skill version. Use a positive integer or 'latest'. Omit for default.

                  - `BetaInlineSkill`

                    - `description: string`

                      The description of the skill.

                    - `name: string`

                      The name of the skill.

                    - `source: BetaInlineSkillSource`

                      Inline skill payload

                      - `data: string`

                        Base64-encoded skill zip bundle.

                        `minLength: 1`, `maxLength: 70254592`

                      - `media_type: "application/zip"`

                        The media type of the inline skill payload. Must be `application/zip`.

                        - `"application/zip"`

                      - `type: "base64"`

                        The type of the inline skill source. Must be `base64`.

                        - `"base64"`

                    - `type: "inline"`

                      Defines an inline skill for this request.

                      - `"inline"`

              - `BetaLocalEnvironment`

                - `type: "local"`

                  Use a local computer environment.

                  - `"local"`

                - `skills?: Array<BetaLocalSkill>`

                  An optional list of skills.

                  `maxItems: 200`

                  - `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: string`

                  The ID of the referenced container.

                - `type: "container_reference"`

                  References a container created with the /v1/containers endpoint

                  - `"container_reference"`

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

              - `"custom"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `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 | Grammar`

              The input format for the custom tool. Default is unconstrained text.

              - `Text`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar`

                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`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `BetaToolSearchOutputNamespaceTool`

            Groups function/custom tools under a shared namespace.

            - `description: string`

              A description of the namespace shown to the model.

            - `name: string`

              The namespace name used in tool calls (for example, `crm`).

              `minLength: 1`

            - `tools: Array<Function | BetaCustomTool>`

              The function/custom tools loaded inside this namespace.

              `minItems: 1`

              - `Function`

                - `name: string`

                  The name of the loaded function tool.

                  `minLength: 1`, `maxLength: 128`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                  The tool invocation context(s).

                  `minItems: 1`

                  - `"direct"`

                  - `"programmatic"`

                - `async?: boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `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`

                A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `type: "namespace"`

              The type of the tool. Always `namespace`.

              - `"namespace"`

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"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.

              - `"server"`

              - `"client"`

            - `parameters?: unknown`

              Parameter schema for a client-executed tool search tool.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `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`.

              - `"web_search_preview"`

              - `"web_search_preview_2025_03_11"`

            - `search_content_types?: Array<"text" | "image">`

              - `"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.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `user_location?: UserLocation | null`

              The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

              - `type: "approximate"`

                The type of location approximation. Always `approximate`.

                - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The item type. Always `tool_search_output`.

          - `"tool_search_output"`

        - `id?: string | null`

          The unique ID of this tool search output.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

          The unique ID of the tool search call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `execution?: "server" | "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the tool search output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AdditionalTools`

        - `role: "developer"`

          The role that provided the additional tools. Only `developer` is supported.

          - `"developer"`

        - `tools: Array<BetaTool>`

          A list of additional tools made available at this item.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

              - `"mcp"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools?: Array<string> | McpToolFilter | null`

              List of allowed tool names or a filter object.

              - `Array<string>`

              - `McpToolFilter`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

              This field is deprecated for models released after September 1, 2026.
              Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
              connect through a Secure MCP Tunnel.

              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`

              - `"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" | null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter`

                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`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                    it will match this filter.

                  - `tool_names?: Array<string>`

                    List of allowed tool names.

                - `never?: Never`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

              `format: uri`

            - `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`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string | CodeInterpreterToolAuto`

              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.

              - `string`

              - `CodeInterpreterToolAuto`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids?: Array<string>`

                  An optional list of uploaded files to make available to your code.

                  `maxItems: 50`

                - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                  - `BetaContainerNetworkPolicyAllowlist`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action?: "generate" | "edit" | "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background?: "transparent" | "opaque" | "auto"`

              Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
              `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
              Transparent backgrounds are available for supported GPT Image models. For
              `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
              using `transparent`, set the output format to `png` or `webp`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `complexity?: "low" | "medium" | "high"`

              Computation spent planning the image, independently of rendering quality.
              Overrides the outer response's `reasoning.effort` for image generation.
              When omitted, inherits a supported outer reasoning effort or uses the
              image model's configured default.
              For SVG output, controls the reference image, not the SVG author's
              reasoning.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `frame_count?: number`

              Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

              `minimum: 2`, `maximum: 16`

            - `frame_duration_ms?: number`

              Duration of each GIF frame in milliseconds, rounded to 10 ms.
              Requires `output_format` to be `gif`. Default: 200.

              `minimum: 20`, `maximum: 2000`

            - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

              - `"high"`

              - `"low"`

            - `input_image_mask?: InputImageMask`

              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" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              Deprecated values:

              - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

              - `(string & {})`

              - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                - `"gpt-image-1"`

                - `"gpt-image-1-mini"`

                - `"gpt-image-2"`

                - `"gpt-image-2-2026-04-21"`

                - `"gpt-image-2.5-sunburst"`

                - `"gpt-image-2.5-sunburst-2026-09-08"`

                - `"gpt-image-2.5-flare"`

                - `"gpt-image-2.5-flare-2026-09-08"`

                - `"gpt-image-2.6-sunburst"`

                - `"gpt-image-2.6-flare"`

                - `"gpt-image-1.5"`

                - `"chatgpt-image-latest"`

            - `moderation?: "auto" | "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression?: number`

              Compression level for the output image. Default: 100.

              `minimum: 0`, `maximum: 100`

            - `output_format?: "png" | "webp" | "jpeg" | 2 more`

              The output format of the generated image. One of `png`, `webp`, `jpeg`,
              `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
              that supports the selected format. GIF output does not support
              partial image streaming (`partial_images` greater than `0`),
              `input_image_mask`, or custom `output_compression`.
              Responses lifecycle events can still be streamed for GIF output.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

              - `"gif"`

              - `"svg"`

            - `partial_images?: number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              `minimum: 0`, `maximum: 3`

            - `quality?: "low" | "medium" | "high" | 3 more`

              The quality of the generated image. The GPT image models support `low`,
              `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
              including their `2026-09-08` snapshots, also support `xhigh` and `max`.
              Default: `auto`.

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

              - `"auto"`

            - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

              - `(string & {})`

              - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

            - `svg?: Svg`

              SVG author model settings. Requires `output_format` to be `svg`.
              When SVG model selection is enabled, omitting this object uses the
              outer response model. Otherwise, the default SVG author is used and
              explicit model overrides are unavailable.

              - `model?: string`

                `minLength: 1`

              - `reasoning?: Reasoning | null`

                Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                - `effort?: "none" | "minimal" | "low" | 4 more`

                  Controls how much effort the model should spend on reasoning for this request.

                  - `"none"`

                  - `"minimal"`

                  - `"low"`

                  - `"medium"`

                  - `"high"`

                  - `"xhigh"`

                  - `"max"`

          - `LocalShell`

            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`.

              - `"local_shell"`

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

            - `description: string`

              A description of the namespace shown to the model.

            - `name: string`

              The namespace name used in tool calls (for example, `crm`).

              `minLength: 1`

            - `tools: Array<Function | BetaCustomTool>`

              The function/custom tools available inside this namespace.

              `minItems: 1`

              - `Function`

                - `name: string`

                  `minLength: 1`, `maxLength: 128`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                  The tool invocation context(s).

                  `minItems: 1`

                  - `"direct"`

                  - `"programmatic"`

                - `async?: boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `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`

                A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `type: "namespace"`

              The type of the tool. Always `namespace`.

              - `"namespace"`

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "additional_tools"`

          The item type. Always `additional_tools`.

          - `"additional_tools"`

        - `id?: string | null`

          The unique ID of this additional tools item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseConfigurationUpdateItemParam`

        An update to the conversation's response configuration. Supply reasoning,
        text, or both. Each setting stays in effect until a later update replaces it.

        - `type: "configuration_update"`

          The item type. Always `configuration_update`.

          - `"configuration_update"`

        - `id?: string | null`

          The unique ID of the configuration update item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reasoning?: Reasoning`

          Updates to reasoning configuration. Only effort is supported.

          - `effort?: "none" | "minimal" | "low" | 4 more | null`

            The reasoning effort to use for subsequent responses until another
            configuration update replaces it.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

        - `text?: Text`

          The text output configuration for subsequent responses.

          - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

            Use a JSON schema for structured output or text to return to plain text.

            - `Text`

              Default response format. Used to generate text responses.

              - `type: "text"`

                The type of response format being defined. Always `text`.

                - `"text"`

            - `BetaResponseFormatTextJSONSchemaConfig`

              JSON Schema response format. Used to generate structured JSON responses.
              Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

              - `name: string`

                The name of the response format. Must be a-z, A-Z, 0-9, or contain
                underscores and dashes, with a maximum length of 64.

              - `schema: Record<string, unknown>`

                The schema for the response format, described as a JSON Schema object.
                Learn how to build JSON schemas [here](https://json-schema.org/).

              - `type: "json_schema"`

                The type of response format being defined. Always `json_schema`.

                - `"json_schema"`

              - `description?: string`

                A description of what the response format is for, used by the model to
                determine how to respond in the format.

              - `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](/api/docs/guides/structured-outputs).

      - `BetaResponseReasoningItem`

        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](/api/docs/guides/conversation-state).

        - `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`.

            - `"summary_text"`

        - `type: "reasoning"`

          The type of the object. Always `reasoning`.

          - `"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`.

            - `"reasoning_text"`

        - `encrypted_content?: string | null`

          The encrypted content of the reasoning item. This is populated by default
          for reasoning items returned by `POST /v1/responses` and WebSocket
          `response.create` requests.

          When streaming, use the completed reasoning item and its
          `encrypted_content` from the `response.output_item.done` event in
          subsequent requests. The `encrypted_content` in
          `response.output_item.added` may be incomplete. This is especially
          important when `store` is `false` or when using Zero Data Retention.

        - `status?: "in_progress" | "completed" | "incomplete"`

          The status of the item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseCompactionItemParam`

        A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

        - `encrypted_content: string`

          The encrypted content of the compaction summary.

          `maxLength: 104857600`

        - `type: "compaction"`

          The type of the item. Always `compaction`.

          - `"compaction"`

        - `id?: string | null`

          The ID of the compaction item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ImageGenerationCall`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"generating"`

          - `"failed"`

        - `type: "image_generation_call"`

          The type of the image generation call. Always `image_generation_call`.

          - `"image_generation_call"`

        - `action?: "generate" | "edit" | "auto" | null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background?: "transparent" | "opaque" | "auto" | null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error?: Error`

          Details of a moderation failure, when available.

          - `code: string | null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string | null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details?: ModerationDetails`

            Public details for a `moderation_blocked` error, when available.

            - `categories: Array<string>`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" | "output" | "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `quality?: "low" | "medium" | "high" | 3 more | null`

          The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `revised_prompt?: string | null`

          The prompt that was used after any model prompt rewriting.

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

        - `svg_usage?: SvgUsage`

          - `input_tokens: number`

          - `model: string`

          - `output_tokens: number`

          - `reasoning_tokens: number`

          - `total_tokens: number`

      - `BetaResponseCodeInterpreterToolCall`

        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 | Image> | null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs`

            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`.

              - `"logs"`

          - `Image`

            The image output from the code interpreter.

            - `type: "image"`

              The type of the output. Always `image`.

              - `"image"`

            - `url: string`

              The URL of the image output from the code interpreter.

              `format: uri`

        - `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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"interpreting"`

          - `"failed"`

        - `type: "code_interpreter_call"`

          The type of the code interpreter tool call. Always `code_interpreter_call`.

          - `"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`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: Action`

          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`.

            - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "local_shell_call"`

          The type of the local shell call. Always `local_shell_call`.

          - `"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`

        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`.

          - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall`

        A tool representing a request to execute one or more shell commands.

        - `action: Action`

          The shell commands and limits that describe how to run the tool call.

          - `commands: Array<string>`

            Ordered shell commands for the execution environment to run.

          - `max_output_length?: number | null`

            Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

          - `timeout_ms?: number | null`

            Maximum wall-clock time in milliseconds to allow the shell commands to run.

        - `call_id: string`

          The unique ID of the shell tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `id?: string | null`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

          The environment to execute the shell commands in.

          - `BetaLocalEnvironment`

          - `BetaContainerReference`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCallOutput`

        The streamed output items emitted by a shell tool call.

        - `call_id: string`

          The unique ID of the shell tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `output: Array<BetaResponseFunctionShellCallOutputContent>`

          Captured chunks of stdout and stderr output, along with their associated outcomes.

          - `outcome: Timeout | Exit`

            The exit or timeout outcome associated with this shell call.

            - `Timeout`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit`

              Indicates that the shell commands finished and returned an exit code.

              - `exit_code: number`

                The exit code returned by the shell process.

              - `type: "exit"`

                The outcome type. Always `exit`.

                - `"exit"`

          - `stderr: string`

            Captured stderr output for the shell call.

            `maxLength: 10485760`

          - `stdout: string`

            Captured stdout output for the shell call.

            `maxLength: 10485760`

        - `type: "shell_call_output"`

          The type of the item. Always `shell_call_output`.

          - `"shell_call_output"`

        - `id?: string | null`

          The unique ID of the shell tool call output. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `max_output_length?: number | null`

          The maximum number of UTF-8 characters captured for this shell call's combined output.

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the shell call output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ApplyPatchCall`

        A tool call representing a request to create, delete, or update files using diff patches.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `operation: CreateFile | DeleteFile | UpdateFile`

          The specific create, delete, or update instruction for the apply_patch tool call.

          - `CreateFile`

            Instruction for creating a new file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply when creating the file.

              `maxLength: 10485760`

            - `path: string`

              Path of the file to create relative to the workspace root.

              `minLength: 1`

            - `type: "create_file"`

              The operation type. Always `create_file`.

              - `"create_file"`

          - `DeleteFile`

            Instruction for deleting an existing file via the apply_patch tool.

            - `path: string`

              Path of the file to delete relative to the workspace root.

              `minLength: 1`

            - `type: "delete_file"`

              The operation type. Always `delete_file`.

              - `"delete_file"`

          - `UpdateFile`

            Instruction for updating an existing file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply to the existing file.

              `maxLength: 10485760`

            - `path: string`

              Path of the file to update relative to the workspace root.

              `minLength: 1`

            - `type: "update_file"`

              The operation type. Always `update_file`.

              - `"update_file"`

        - `status: "in_progress" | "completed"`

          The status of the apply patch tool call. One of `in_progress` or `completed`.

          - `"in_progress"`

          - `"completed"`

        - `type: "apply_patch_call"`

          The type of the item. Always `apply_patch_call`.

          - `"apply_patch_call"`

        - `id?: string | null`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `ApplyPatchCallOutput`

        The streamed output emitted by an apply patch tool call.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `status: "completed" | "failed"`

          The status of the apply patch tool call output. One of `completed` or `failed`.

          - `"completed"`

          - `"failed"`

        - `type: "apply_patch_call_output"`

          The type of the item. Always `apply_patch_call_output`.

          - `"apply_patch_call_output"`

        - `id?: string | null`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `output?: string | null`

          Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

          `maxLength: 10485760`

      - `McpListTools`

        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`.

          - `"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`

        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`.

          - `"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`

        A response to an MCP approval request.

        - `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`.

          - `"mcp_approval_response"`

        - `id?: string | null`

          The unique ID of the 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.

      - `McpCall`

        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`.

          - `"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?: BetaMcpToolCallError | null`

          The error from the tool call, if any.

          - `McpProtocolError`

            - `code: number`

            - `message: string`

            - `type: "mcp_protocol_error"`

              - `"mcp_protocol_error"`

          - `McpToolExecutionError`

            - `content: unknown`

            - `type: "mcp_tool_execution_error"`

              - `"mcp_tool_execution_error"`

          - `HTTPError`

            - `code: number`

            - `message: string`

            - `type: "http_error"`

              - `"http_error"`

        - `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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `BetaResponseCustomToolCallOutput`

        The output of a custom tool call from your code, being sent back to the model.

        - `call_id: string`

          The call ID, used to map this custom tool call output to a custom tool call.

        - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `string`

          - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            - `BetaResponseInputText`

              A text input to the model.

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile`

              A file input to the model.

        - `type: "custom_tool_call_output"`

          The type of the custom tool call output. Always `custom_tool_call_output`.

          - `"custom_tool_call_output"`

        - `id?: string`

          The unique ID of the custom tool call output 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 | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `BetaResponseCustomToolCall`

        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`.

          - `"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.

        - `async?: boolean`

          Whether the custom tool call runs asynchronously.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace?: string`

          The namespace of the custom tool being called.

      - `CompactionTrigger`

        Compacts the current context. Must be the final input item.

        - `type: "compaction_trigger"`

          The type of the item. Always `compaction_trigger`.

          - `"compaction_trigger"`

        - `id?: string | null`

          The unique ID of this compaction trigger.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ItemReference`

        An internal identifier for an item to reference.

        - `id: string`

          The ID of the item to reference.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `type?: "item_reference" | null`

          The type of item to reference. Always `item_reference`.

          - `"item_reference"`

      - `Program`

        - `id: string`

          The unique ID of this program item.

        - `call_id: string`

          The stable call ID of the program item.

          `minLength: 1`, `maxLength: 64`

        - `code: string`

          The JavaScript source executed by programmatic tool calling.

          `maxLength: 10485760`

        - `fingerprint: string`

          Opaque program replay fingerprint that must be round-tripped.

          `maxLength: 10485760`

        - `type: "program"`

          The item type. Always `program`.

          - `"program"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput`

        - `id: string`

          The unique ID of this program output item.

        - `call_id: string`

          The call ID of the program item.

          `minLength: 1`, `maxLength: 64`

        - `result: string`

          The result produced by the program item.

          `maxLength: 10485760`

        - `status: "completed" | "incomplete"`

          The terminal status of the program output.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The item type. Always `program_output`.

          - `"program_output"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

  - `metadata: Record<string, string> | 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: "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more | (string & {})`

    Model ID used to generate the response, like `gpt-6-astra`. OpenAI
    offers a wide range of models with different capabilities, performance
    characteristics, and price points. Refer to the [model guide](/api/docs/models)
    to browse and compare available models.

    Deprecated values:

    - "gpt-5.4-nano", "gpt-5.4-nano-2026-03-17", "gpt-5.1", "gpt-5.1-2025-11-13": Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-5.3-chat-latest", "gpt-5.2-chat-latest": Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-5.1-codex", "gpt-5.1-chat-latest", "gpt-5-chat-latest", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", "o3-deep-research", "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5-codex", "gpt-5.1-codex-max": Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-5.1-mini": Not a supported model ID. Retained for SDK compatibility.
    - "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "o3", "o3-2025-04-16", "o3-pro", "o3-pro-2025-06-10", "gpt-5-pro", "gpt-5-pro-2025-10-06": Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-mini", "gpt-4o-mini-2024-07-18": Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4.1-nano", "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3-mini", "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "gpt-4o-2024-05-13", "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-1106-preview", "gpt-4", "gpt-4-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-0125", "o1-pro", "o1-pro-2025-03-19": Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "o1-preview", "o1-preview-2024-09-12": Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "o1-mini", "o1-mini-2024-09-12": Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-audio-mini", "gpt-audio-mini-2025-12-15": Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-12-17", "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", "gpt-4o-mini-audio-preview-2024-12-17": Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4o-audio-preview-2024-10-01": Announced shutdown date: 2025-10-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "chatgpt-4o-latest": Announced shutdown date: 2026-02-17. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "codex-mini-latest": Announced shutdown date: 2026-02-12. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4-0125-preview", "gpt-4-turbo-preview", "gpt-4-0314": Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4-vision-preview": Announced shutdown date: 2024-12-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-0613": Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k-0613": Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-3.5-turbo-1106": Announced shutdown date: 2026-09-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.

    - `"gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more`

      Model ID used to generate the response, like `gpt-6-astra`. OpenAI
      offers a wide range of models with different capabilities, performance
      characteristics, and price points. Refer to the [model guide](/api/docs/models)
      to browse and compare available models.

      - `"gpt-6-astra"`

      - `"gpt-6.1-sol"`

      - `"gpt-6.1-terra"`

      - `"gpt-6-sol"`

      - `"gpt-6-luna"`

      - `"gpt-5.6-sol"`

      - `"gpt-5.6-terra"`

      - `"gpt-5.6-luna"`

      - `"gpt-5.5"`

      - `"gpt-5.5-2026-04-23"`

      - `"gpt-5.4"`

      - `"gpt-5.4-mini"`

      - `"gpt-5.4-nano"`

      - `"gpt-5.4-mini-2026-03-17"`

      - `"gpt-5.4-nano-2026-03-17"`

      - `"gpt-5.3-chat-latest"`

      - `"gpt-5.2"`

      - `"gpt-5.2-2025-12-11"`

      - `"gpt-5.2-chat-latest"`

      - `"gpt-5.2-pro"`

      - `"gpt-5.2-pro-2025-12-11"`

      - `"gpt-5.1"`

      - `"gpt-5.1-2025-11-13"`

      - `"gpt-5.1-codex"`

      - `"gpt-5.1-mini"`

      - `"gpt-5.1-chat-latest"`

      - `"gpt-5"`

      - `"gpt-5-mini"`

      - `"gpt-5-nano"`

      - `"gpt-5-2025-08-07"`

      - `"gpt-5-mini-2025-08-07"`

      - `"gpt-5-nano-2025-08-07"`

      - `"gpt-5-chat-latest"`

      - `"gpt-4.1"`

      - `"gpt-4.1-mini"`

      - `"gpt-4.1-nano"`

      - `"gpt-4.1-2025-04-14"`

      - `"gpt-4.1-mini-2025-04-14"`

      - `"gpt-4.1-nano-2025-04-14"`

      - `"o4-mini"`

      - `"o4-mini-2025-04-16"`

      - `"o3"`

      - `"o3-2025-04-16"`

      - `"o3-mini"`

      - `"o3-mini-2025-01-31"`

      - `"o1"`

      - `"o1-2024-12-17"`

      - `"o1-preview"`

      - `"o1-preview-2024-09-12"`

      - `"o1-mini"`

      - `"o1-mini-2024-09-12"`

      - `"gpt-4o"`

      - `"gpt-4o-2024-11-20"`

      - `"gpt-4o-2024-08-06"`

      - `"gpt-4o-2024-05-13"`

      - `"gpt-audio-mini"`

      - `"gpt-audio-mini-2025-12-15"`

      - `"gpt-4o-audio-preview"`

      - `"gpt-4o-audio-preview-2024-10-01"`

      - `"gpt-4o-audio-preview-2024-12-17"`

      - `"gpt-4o-audio-preview-2025-06-03"`

      - `"gpt-4o-mini-audio-preview"`

      - `"gpt-4o-mini-audio-preview-2024-12-17"`

      - `"gpt-4o-search-preview"`

      - `"gpt-4o-mini-search-preview"`

      - `"gpt-4o-search-preview-2025-03-11"`

      - `"gpt-4o-mini-search-preview-2025-03-11"`

      - `"chatgpt-4o-latest"`

      - `"codex-mini-latest"`

      - `"gpt-4o-mini"`

      - `"gpt-4o-mini-2024-07-18"`

      - `"gpt-4-turbo"`

      - `"gpt-4-turbo-2024-04-09"`

      - `"gpt-4-0125-preview"`

      - `"gpt-4-turbo-preview"`

      - `"gpt-4-1106-preview"`

      - `"gpt-4-vision-preview"`

      - `"gpt-4"`

      - `"gpt-4-0314"`

      - `"gpt-4-0613"`

      - `"gpt-4-32k"`

      - `"gpt-4-32k-0314"`

      - `"gpt-4-32k-0613"`

      - `"gpt-3.5-turbo"`

      - `"gpt-3.5-turbo-16k"`

      - `"gpt-3.5-turbo-0301"`

      - `"gpt-3.5-turbo-0613"`

      - `"gpt-3.5-turbo-1106"`

      - `"gpt-3.5-turbo-0125"`

      - `"gpt-3.5-turbo-16k-0613"`

      - `"o1-pro"`

      - `"o1-pro-2025-03-19"`

      - `"o3-pro"`

      - `"o3-pro-2025-06-10"`

      - `"o3-deep-research"`

      - `"o3-deep-research-2025-06-26"`

      - `"o4-mini-deep-research"`

      - `"o4-mini-deep-research-2025-06-26"`

      - `"computer-use-preview"`

      - `"computer-use-preview-2025-03-11"`

      - `"gpt-5.5-pro"`

      - `"gpt-5.5-pro-2026-04-23"`

      - `"gpt-5-codex"`

      - `"gpt-5-pro"`

      - `"gpt-5-pro-2025-10-06"`

      - `"gpt-5.1-codex-max"`

      - `"gpt-daybreak-blue-latest"`

      - `"gpt-daybreak-red-latest"`

      - `"gpt-5.6-cyber"`

      - `"gpt-6-cyber"`

      - `"gpt-rosalind-research"`

      - `"gpt-6-rosalind"`

    - `(string & {})`

  - `object: "response"`

    The object type of this resource - always set to `response`.

    - `"response"`

  - `output: Array<BetaResponseOutputItem>`

    An array of content items generated by the model.

    - The length and order of items in the `output` array is dependent
      on the model's response.
    - Rather than accessing the first item in the `output` array and
      assuming it's an `assistant` message with the content generated by
      the model, you might consider using the `output_text` property where
      supported in SDKs.

    - `BetaResponseOutputMessage`

      An output message from the model.

    - `BetaResponseFileSearchToolCall`

      The results of a file search tool call. See the
      [file search guide](/api/docs/guides/tools-file-search) for more information.

    - `BetaResponseFunctionToolCall`

      A tool call to run a function. See the
      [function calling guide](/api/docs/guides/function-calling) for more information.

    - `BetaResponseFunctionToolCallOutputItem`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `string`

        - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          - `BetaResponseInputText`

            A text input to the model.

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile`

            A file input to the model.

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "function_call_output"`

        The type of the function tool call output. Always `function_call_output`.

        - `"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.

      - `call_id?: string`

        The unique ID of the function tool call generated by the model.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

      - `name?: string`

        The name of the tool that produced the output.

      - `namespace?: string`

        The namespace of the tool that produced the output.

    - `AgentMessage`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

        Encrypted content sent between agents.

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseOutputText`

          A text output from the model.

        - `Text`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText`

          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`.

            - `"summary_text"`

        - `ReasoningText`

          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`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal`

          A refusal from the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot`

          A screenshot of a computer.

          - `detail: BetaImageDetail`

            The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

          - `file_id: string | null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string | null`

            The URL of the screenshot image.

            `format: uri`

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputFile`

          A file input to the model.

        - `EncryptedContent`

          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`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall`

      - `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.

        - `"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`.

        - `"multi_agent_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput`

      - `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.

        - `"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>`

        Text output returned by the multi-agent action.

        - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

          The annotations of the text output.

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

        - `logprobs?: Array<Logprob>`

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseFunctionWebSearch`

      The results of a web search tool call. See the
      [web search guide](/api/docs/guides/tools-web-search) for more information.

    - `BetaResponseComputerToolCall`

      A tool call to a computer use tool. See the
      [computer use guide](/api/docs/guides/tools-computer-use) for more information.

    - `BetaResponseComputerToolCallOutputItem`

      - `id: string`

        The ID of the computer tool call output.

      - `call_id: string`

        The ID of the computer tool call that produced the output.

      - `output: BetaResponseComputerToolCallOutputScreenshot`

        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.

        - `"completed"`

        - `"incomplete"`

        - `"failed"`

        - `"in_progress"`

      - `type: "computer_call_output"`

        The type of the computer tool call output. Always `computer_call_output`.

        - `"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`

      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](/api/docs/guides/conversation-state).

    - `Program`

      - `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`.

        - `"program"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput`

      - `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.

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The type of the item. Always `program_output`.

        - `"program_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseToolSearchCall`

      - `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.

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the tool search call item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "tool_search_call"`

        The type of the item. Always `tool_search_call`.

        - `"tool_search_call"`

      - `agent?: Agent`

        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: 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.

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: Array<BetaTool>`

        The loaded tool definitions returned by tool search.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

        - `BetaFileSearchTool`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `BetaComputerTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

        - `CodeInterpreter`

          A tool that runs Python code to help generate a response to a prompt.

        - `ProgrammaticToolCalling`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

        - `LocalShell`

          A tool that allows the model to execute shell commands in a local environment.

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `BetaApplyPatchTool`

          Allows the assistant to create, delete, or update files using unified diffs.

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent?: Agent`

        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: string`

        The unique ID of the additional tools item.

      - `role: "unknown" | "user" | "assistant" | 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: Array<BetaTool>`

        The additional tool definitions made available at this item.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

        - `BetaFileSearchTool`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `BetaComputerTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

        - `CodeInterpreter`

          A tool that runs Python code to help generate a response to a prompt.

        - `ProgrammaticToolCalling`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

        - `LocalShell`

          A tool that allows the model to execute shell commands in a local environment.

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `BetaApplyPatchTool`

          Allows the assistant to create, delete, or update files using unified diffs.

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseCompactionItem`

      A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

      - `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`.

        - `"compaction"`

      - `agent?: Agent`

        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`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"generating"`

        - `"failed"`

      - `type: "image_generation_call"`

        The type of the image generation call. Always `image_generation_call`.

        - `"image_generation_call"`

      - `action?: "generate" | "edit" | "auto" | null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background?: "transparent" | "opaque" | "auto" | null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error?: Error`

        Details of a moderation failure, when available.

        - `code: string | null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string | null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details?: ModerationDetails`

          Public details for a `moderation_blocked` error, when available.

          - `categories: Array<string>`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" | "output" | "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

        - `"gif"`

        - `"svg"`

      - `quality?: "low" | "medium" | "high" | 3 more | null`

        The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

        - `"auto"`

      - `revised_prompt?: string | null`

        The prompt that was used after any model prompt rewriting.

      - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `(string & {})`

        - `"1024x1024" | "1024x1536" | "1536x1024"`

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

      - `svg_usage?: SvgUsage`

        - `input_tokens: number`

        - `model: string`

        - `output_tokens: number`

        - `reasoning_tokens: number`

        - `total_tokens: number`

    - `BetaResponseCodeInterpreterToolCall`

      A tool call to run code.

    - `LocalShellCall`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: Action`

        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`.

          - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "local_shell_call"`

        The type of the local shell call. Always `local_shell_call`.

        - `"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`

      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`.

        - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseFunctionShellToolCall`

      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`

        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 | BetaResponseContainerReference | null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "shell_call"`

        The type of the item. Always `shell_call`.

        - `"shell_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The ID of the entity that created this tool call.

    - `BetaResponseFunctionShellToolCallOutput`

      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 | Exit`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit`

            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`.

              - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "shell_call_output"`

        The type of the shell call output. Always `shell_call_output`.

        - `"shell_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

    - `BetaResponseApplyPatchToolCall`

      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 | DeleteFile | UpdateFile`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile`

          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.

            - `"create_file"`

        - `DeleteFile`

          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.

            - `"delete_file"`

        - `UpdateFile`

          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.

            - `"update_file"`

      - `status: "in_progress" | "completed"`

        The status of the apply patch tool call. One of `in_progress` or `completed`.

        - `"in_progress"`

        - `"completed"`

      - `type: "apply_patch_call"`

        The type of the item. Always `apply_patch_call`.

        - `"apply_patch_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The ID of the entity that created this tool call.

    - `BetaResponseApplyPatchToolCallOutput`

      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`.

        - `"completed"`

        - `"failed"`

      - `type: "apply_patch_call_output"`

        The type of the item. Always `apply_patch_call_output`.

        - `"apply_patch_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"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`

      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`.

        - `"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?: BetaMcpToolCallError | 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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `McpListTools`

      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`.

        - `"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`

      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`.

        - `"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`

      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`.

        - `"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`

      A call to a custom tool created by the model.

    - `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `created_by?: string`

        The identifier of the actor that created the item.

  - `parallel_tool_calls: boolean`

    Whether to allow the model to run tool calls in parallel.

  - `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.
    We generally recommend altering this or `top_p` but not both.

    `minimum: 0`, `maximum: 2`

  - `tool_choice: BetaToolChoiceOptions | BetaToolChoiceAllowed | BetaToolChoiceTypes | 6 more`

    How the model should select which tool (or tools) to use when generating
    a response. See the `tools` parameter to see how to specify which tools
    the model can call.

    - `BetaToolChoiceOptions = "none" | "auto" | "required"`

      Controls which (if any) tool is called by the model.

      `none` means the model will not call any tool and instead generates a message.

      `auto` means the model can pick between generating a message or calling one or
      more tools.

      `required` means the model must call one or more tools.

      - `"none"`

      - `"auto"`

      - `"required"`

    - `BetaToolChoiceAllowed`

      Constrains the tools available to the model to a pre-defined set.

      - `mode: "auto" | "required"`

        Constrains the tools available to the model to a pre-defined set.

        `auto` allows the model to pick from among the allowed tools and generate a
        message.

        `required` requires the model to call one or more of the allowed tools.

        - `"auto"`

        - `"required"`

      - `tools: Array<Record<string, unknown>>`

        A list of tool definitions that the model should be allowed to call.

        For the Responses API, the list of tool definitions might look like:

        ```json
        [
          { "type": "function", "name": "get_weather" },
          { "type": "mcp", "server_label": "deepwiki" },
          { "type": "image_generation" }
        ]
        ```

      - `type: "allowed_tools"`

        Allowed tool configuration type. Always `allowed_tools`.

        - `"allowed_tools"`

    - `BetaToolChoiceTypes`

      Indicates that the model should use a built-in tool to generate a response.
      [Learn more about built-in tools](/api/docs/guides/tools).

      - `type: "file_search" | "web_search_preview" | "computer" | 5 more`

        The type of hosted tool the model should to use. Learn more about
        [built-in tools](/api/docs/guides/tools).

        Allowed values are:

        - `file_search`
        - `web_search_preview`
        - `computer`
        - `computer_use_preview`
        - `computer_use`
        - `code_interpreter`
        - `image_generation`

        - `"file_search"`

        - `"web_search_preview"`

        - `"computer"`

        - `"computer_use_preview"`

        - `"computer_use"`

        - `"web_search_preview_2025_03_11"`

        - `"image_generation"`

        - `"code_interpreter"`

    - `BetaToolChoiceFunction`

      Use this option to force the model to call a specific function.

      - `name: string`

        The name of the function to call.

      - `type: "function"`

        For function calling, the type is always `function`.

        - `"function"`

    - `BetaToolChoiceMcp`

      Use this option to force the model to call a specific tool on a remote MCP server.

      - `server_label: string`

        The label of the MCP server to use.

      - `type: "mcp"`

        For MCP tools, the type is always `mcp`.

        - `"mcp"`

      - `name?: string | null`

        The name of the tool to call on the server.

    - `BetaToolChoiceCustom`

      Use this option to force the model to call a specific custom tool.

      - `name: string`

        The name of the custom tool to call.

      - `type: "custom"`

        For custom tool calling, the type is always `custom`.

        - `"custom"`

    - `BetaSpecificProgrammaticToolCallingParam`

      - `type: "programmatic_tool_calling"`

        The tool to call. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `BetaToolChoiceApplyPatch`

      Forces the model to call the apply_patch tool when executing a tool call.

      - `type: "apply_patch"`

        The tool to call. Always `apply_patch`.

        - `"apply_patch"`

    - `BetaToolChoiceShell`

      Forces the model to call the shell tool when a tool call is required.

      - `type: "shell"`

        The tool to call. Always `shell`.

        - `"shell"`

  - `tools: Array<BetaTool>`

    An array of tools the model may call while generating a response. You
    can specify which tool to use by setting the `tool_choice` parameter.

    We support the following categories of tools:

    - **Built-in tools**: Tools that are provided by OpenAI that extend the
      model's capabilities, like [web search](/api/docs/guides/tools-web-search)
      or [file search](/api/docs/guides/tools-file-search). Learn more about
      [built-in tools](/api/docs/guides/tools).
    - **MCP Tools**: Integrations with third-party systems via custom MCP servers
      or predefined connectors such as Google Drive and SharePoint. Learn more about
      [MCP Tools](/api/docs/guides/tools-connectors-mcp).
    - **Function calls (custom tools)**: Functions that are defined by you,
      enabling the model to call your own code with strongly typed arguments
      and outputs. Learn more about
      [function calling](/api/docs/guides/function-calling). You can also use
      custom tools to call your own code.

    - `BetaFunctionTool`

      Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

    - `BetaFileSearchTool`

      A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

    - `BetaComputerTool`

      A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

    - `BetaComputerUsePreviewTool`

      A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

    - `BetaWebSearchTool`

      Search the Internet for sources related to the prompt. Learn more about the
      [web search tool](/api/docs/guides/tools-web-search).

    - `Mcp`

      Give the model access to additional tools via remote Model Context Protocol
      (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

    - `CodeInterpreter`

      A tool that runs Python code to help generate a response to a prompt.

    - `ProgrammaticToolCalling`

    - `ImageGeneration`

      A tool that generates images using the GPT image models.

    - `LocalShell`

      A tool that allows the model to execute shell commands in a local environment.

    - `BetaFunctionShellTool`

      A tool that allows the model to execute shell commands.

    - `BetaCustomTool`

      A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

    - `BetaNamespaceTool`

      Groups function/custom tools under a shared namespace.

    - `BetaToolSearchTool`

      Hosted or BYOT tool search configuration for deferred tools.

    - `BetaWebSearchPreviewTool`

      This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

    - `BetaApplyPatchTool`

      Allows the assistant to create, delete, or update files using unified diffs.

  - `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.

    `minimum: 0`, `maximum: 1`

  - `background?: boolean | null`

    Whether to run the model response in the background.
    [Learn more](/api/docs/guides/background).

  - `completed_at?: number | null`

    Unix timestamp (in seconds) of when this Response was completed.
    Only present when the status is `completed`.

    `format: unixtime`

  - `conversation?: Conversation | null`

    The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation.

    - `id: string`

      The unique ID of the conversation that this response was associated with.

  - `image?: Image`

    - `context_compression: "enabled" | "disabled"`

      Effective image context optimization policy.

      - `"enabled"`

      - `"disabled"`

  - `max_output_tokens?: number | null`

    An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/api/docs/guides/reasoning).

  - `max_tool_calls?: number | null`

    The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

  - `moderation?: Moderation | null`

    Moderation results for the response input and output, if moderated completions were requested.

    - `input: ModerationResult | Error`

      Moderation for the response input.

      - `ModerationResult`

        A moderation result produced for the response input or output.

        - `categories: Record<string, boolean>`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: Record<string, Array<"text" | "image">>`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: Record<string, number>`

          A dictionary of moderation categories to scores.

        - `flagged: boolean`

          A boolean indicating whether the content was flagged by any category.

        - `model: string`

          The moderation model that produced this result.

        - `type: "moderation_result"`

          The object type, which was always `moderation_result` for successful moderation results.

          - `"moderation_result"`

      - `Error`

        An error produced while attempting moderation for the response input or output.

        - `code: string`

          The error code.

        - `message: string`

          The error message.

        - `type: "error"`

          The object type, which was always `error` for moderation failures.

          - `"error"`

    - `output: ModerationResult | Error`

      Moderation for the response output.

      - `ModerationResult`

        A moderation result produced for the response input or output.

        - `categories: Record<string, boolean>`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: Record<string, Array<"text" | "image">>`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: Record<string, number>`

          A dictionary of moderation categories to scores.

        - `flagged: boolean`

          A boolean indicating whether the content was flagged by any category.

        - `model: string`

          The moderation model that produced this result.

        - `type: "moderation_result"`

          The object type, which was always `moderation_result` for successful moderation results.

          - `"moderation_result"`

      - `Error`

        An error produced while attempting moderation for the response input or output.

        - `code: string`

          The error code.

        - `message: string`

          The error message.

        - `type: "error"`

          The object type, which was always `error` for moderation failures.

          - `"error"`

  - `previous_response_id?: string | null`

    The unique ID of the previous response to the model. Use this to
    create multi-turn conversations. Learn more about
    [conversation state](/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.

  - `prompt?: BetaResponsePrompt | null`

    Reference to a prompt template and its variables.
    [Learn more](/api/docs/guides/text?api-mode=responses#version-prompts-in-code).

    - `id: string`

      The unique identifier of the prompt template to use.

    - `variables?: Record<string, string | BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile> | null`

      Optional map of values to substitute in for variables in your
      prompt. The substitution values can either be strings, or other
      Response input types like images or files.

      - `string`

      - `BetaResponseInputText`

        A text input to the model.

      - `BetaResponseInputImage`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

      - `BetaResponseInputFile`

        A file input to the model.

    - `version?: string | null`

      Optional version of the prompt template.

  - `prompt_cache_diagnostics?: CacheMiss | CacheHit | ComparisonResponseNotFound | Unavailable`

    Prompt cache diagnostics requested for this response.

    - `CacheMiss`

      - `cache_missed_tokens: number`

        The estimated number of input tokens affected after the first detected divergence.

      - `reason: "model_changed" | "prompt_cache_key_changed" | "tools_changed" | 6 more`

        The reason prompt cache reuse did not occur.

        - `"model_changed"`

        - `"prompt_cache_key_changed"`

        - `"tools_changed"`

        - `"text_format_changed"`

        - `"reasoning_effort_changed"`

        - `"verbosity_changed"`

        - `"context_compacted"`

        - `"input_changed"`

        - `"service_tier_changed"`

      - `type: "cache_miss"`

        - `"cache_miss"`

      - `comparison_reusable_tokens?: number`

        The raw token count of the reusable prefix in the compared response.

    - `CacheHit`

      - `type: "cache_hit"`

        - `"cache_hit"`

    - `ComparisonResponseNotFound`

      - `type: "comparison_response_not_found"`

        - `"comparison_response_not_found"`

    - `Unavailable`

      - `type: "unavailable"`

        - `"unavailable"`

  - `prompt_cache_key?: string | null`

    Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/api/docs/guides/prompt-caching).

  - `prompt_cache_options?: PromptCacheOptions`

    The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

    - `mode: "implicit" | "explicit"`

      Whether implicit prompt-cache breakpoints were enabled.

      - `"implicit"`

      - `"explicit"`

    - `ttl: "30m" | "12h"`

      The minimum lifetime applied to each cache breakpoint.

      - `"30m"`

      - `"12h"`

    - `comparison_response_id?: string | null`

      The response ID supplied as the prompt cache diagnostics comparison.

  - `prompt_cache_retention?: "in_memory" | "24h" | null`

    Deprecated. Use `prompt_cache_options.ttl` instead.

    The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/api/docs/guides/prompt-caching#prompt-cache-retention).
    This field expresses a maximum retention policy, while
    `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two
    fields are independent and do not interact.
    For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported.

    For older models that support both `in_memory` and `24h`, the default depends on your organization's data retention policy:

    - Organizations without ZDR enabled default to `24h`.
    - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified.

    - `"in_memory"`

    - `"24h"`

  - `reasoning?: Reasoning | null`

    Configuration options for
    [reasoning models](/api/docs/guides/reasoning).

    - `context?: "auto" | "current_turn" | "all_turns" | null`

      Controls which reasoning items are rendered back to the model on later turns.
      If omitted or set to `auto`, the model determines the context mode. The
      `gpt-5.6` model family defaults to `all_turns`; earlier models default to
      `current_turn`.

      When returned on a response, this is the effective reasoning context mode
      used for the response.

      - `"auto"`

      - `"current_turn"`

      - `"all_turns"`

    - `effort?: "none" | "minimal" | "low" | 4 more | null`

      Constrains effort on reasoning for reasoning models. Currently supported
      values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
      Reducing reasoning effort can result in faster responses and fewer tokens
      used on reasoning in a response. Not all reasoning models support every
      value. See the
      [reasoning guide](/api/docs/guides/reasoning)
      for model-specific support.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `generate_summary?: "auto" | "concise" | "detailed" | null`

      **Deprecated:** use `summary` instead.

      A summary of the reasoning performed by the model. This can be
      useful for debugging and understanding the model's reasoning process.
      One of `auto`, `concise`, or `detailed`.

      - `"auto"`

      - `"concise"`

      - `"detailed"`

    - `mode?: (string & {}) | "standard" | "pro"`

      Controls the reasoning execution mode for the request.

      When returned on a response, this is the effective execution mode.

      - `(string & {})`

      - `"standard" | "pro"`

        - `"standard"`

        - `"pro"`

    - `summary?: "auto" | "concise" | "detailed" | null`

      A summary of the reasoning performed by the model. This can be
      useful for debugging and understanding the model's reasoning process.
      One of `auto`, `concise`, or `detailed`.

      `concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.

      - `"auto"`

      - `"concise"`

      - `"detailed"`

  - `safety_identifier?: string | null`

    A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.
    The IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

    `maxLength: 128`

  - `service_tier?: BetaServiceTier | null`

    Specifies the processing type used for serving the request.

    - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
    - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
    - If set to '[flex](/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.
    - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.
    - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for `gpt-5.6-sol`; a response served through it will show `service_tier=ultrafast`.
    - When not set, the default behavior is 'auto'.

    When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

    - `"auto"`

    - `"default"`

    - `"flex"`

    - `"scale"`

    - `"priority"`

    - `"fast"`

    - `"ultrafast"`

  - `status?: BetaResponseStatus`

    The status of the response generation. One of `completed`, `failed`,
    `in_progress`, `cancelled`, `queued`, or `incomplete`.

    - `"completed"`

    - `"failed"`

    - `"in_progress"`

    - `"cancelled"`

    - `"queued"`

    - `"incomplete"`

  - `text?: BetaResponseTextConfig`

    Configuration options for a text response from the model. Can be plain
    text or structured JSON data. Learn more:

    - [Text inputs and outputs](/api/docs/guides/text)
    - [Structured Outputs](/api/docs/guides/structured-outputs)

    - `format?: BetaResponseFormatTextConfig`

      An object specifying the format that the model must output.

      Configuring `{ "type": "json_schema" }` enables Structured Outputs,
      which ensures the model will match your supplied JSON schema. Learn more in the
      [Structured Outputs guide](/api/docs/guides/structured-outputs).

      The default format is `{ "type": "text" }` with no additional options.

      **Not recommended for gpt-4o and newer models:**

      Setting to `{ "type": "json_object" }` enables the older JSON mode, which
      ensures the message the model generates is valid JSON. Using `json_schema`
      is preferred for models that support it.

      - `Text`

        Default response format. Used to generate text responses.

        - `type: "text"`

          The type of response format being defined. Always `text`.

          - `"text"`

      - `BetaResponseFormatTextJSONSchemaConfig`

        JSON Schema response format. Used to generate structured JSON responses.
        Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `JSONObject`

        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`.

          - `"json_object"`

    - `verbosity?: "low" | "medium" | "high" | null`

      Constrains the verbosity of the model's response. Lower values will result in
      more concise responses, while higher values will result in more verbose responses.
      Currently supported values are `low`, `medium`, and `high`. The default is
      `medium`.

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tool_usage?: ToolUsage`

    Usage reported by hosted tools, separate from base model `usage`. The field
    can be omitted when tool usage is unavailable. When present, tool families
    with no recorded usage have zero counts.

    `image_gen` sums available token counts across image generation calls.
    Calls with missing or incomplete usage records may be skipped. Output
    token details and cached input counts can be omitted. An omitted cache
    count means cache usage is unknown.

    `web_search.num_requests` counts billable searches. Discounted searches
    and actions such as opening a page are excluded. Use billing records to
    reconcile final charges.

    - `image_gen: ImageGen`

      Aggregated usage statistics for image generation tool calls.

      - `input_tokens: number`

        The number of tokens (images and text) in the input prompt.

      - `input_tokens_details: InputTokensDetails`

        The input tokens detailed information for the image generation.

        - `image_tokens: number`

          The number of image tokens in the input prompt.

        - `text_tokens: number`

          The number of text tokens in the input prompt.

      - `output_tokens: number`

        The number of output tokens generated by the model.

      - `total_tokens: number`

        The total number of tokens (images and text) used for the image generation.

      - `cached_tokens?: number`

      - `cached_tokens_details?: CachedTokensDetails`

        - `cached_image_tokens: number`

        - `cached_text_tokens: number`

      - `output_tokens_details?: OutputTokensDetails`

        The output token details for the image generation.

        - `image_tokens: number`

          The number of image output tokens generated by the model.

        - `text_tokens: number`

          The number of text output tokens generated by the model.

    - `web_search: WebSearch`

      Aggregated billable usage statistics for web search tool calls.

      - `num_requests: number`

        The number of billable web search requests issued.

  - `top_logprobs?: number | null`

    An integer between 0 and 20 specifying the maximum number of most likely
    tokens to return at each token position, each with an associated log
    probability. In some cases, the number of returned tokens may be fewer than
    requested.

    `minimum: 0`, `maximum: 20`

  - `truncation?: "auto" | "disabled" | null`

    The truncation strategy to use for the model response.

    - `auto`: If the input to this Response exceeds
      the model's context window size, the model will truncate the
      response to fit the context window by dropping items from the beginning of the conversation.
      On some models, trimming can begin earlier because the API subtracts the model's
      maximum output allowance from its input limit, even if you set a lower `max_output_tokens`.
    - `disabled` (default): If the input size will exceed the context window
      size for a model, the request will fail with a 400 error.

    - `"auto"`

    - `"disabled"`

  - `usage?: BetaResponseUsage`

    Represents token usage details including input tokens, output tokens,
    a breakdown of output tokens, and the total tokens used.

    - `input_tokens: number`

      The number of input tokens.

    - `input_tokens_details: InputTokensDetails`

      A detailed breakdown of the input tokens.

      - `cache_write_tokens: number`

        The number of input tokens that were written to the cache.

      - `cached_tokens: number`

        The number of tokens that were retrieved from the cache.
        [More on prompt caching](/api/docs/guides/prompt-caching).

      - `cache_write_tokens_details?: CacheWriteTokensDetails`

        - `ttl_12h_tokens: number`

          The number of input tokens written with 12-hour retention.

        - `ttl_30m_tokens: number`

          The number of input tokens written with 30-minute retention.

    - `output_tokens: number`

      The number of output tokens.

    - `output_tokens_details: OutputTokensDetails`

      A detailed breakdown of the output tokens.

      - `reasoning_tokens: number`

        The number of reasoning tokens.

    - `total_tokens: number`

      The total number of tokens used.

  - `user?: string`

    This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.
    A stable identifier for your end-users.
    Used to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const betaResponse = await client.beta.responses.retrieve('resp_677efb5139a88190b512bc3fef8e535d');

console.log(betaResponse.id);
```

#### 200 — Example

```json
{
  "id": "id",
  "access_programs": {
    "cyber": "standard"
  },
  "created_at": 0,
  "error": {
    "code": "server_error",
    "message": "message",
    "misalignment": {
      "detailed_explanation": "detailed_explanation",
      "error_type": "potentially_unintended_data_transfer",
      "review_target": "review_target",
      "steer": {
        "message": "message"
      }
    },
    "param": "param",
    "type": "type"
  },
  "incomplete_details": {
    "reason": "max_output_tokens"
  },
  "instructions": "string",
  "metadata": {
    "foo": "string"
  },
  "model": "gpt-6-astra",
  "object": "response",
  "output": [
    {
      "id": "id",
      "content": [
        {
          "annotations": [
            {
              "file_id": "file_id",
              "filename": "filename",
              "index": 0,
              "type": "file_citation"
            }
          ],
          "text": "text",
          "type": "output_text",
          "logprobs": [
            {
              "token": "token",
              "bytes": [
                0
              ],
              "logprob": 0,
              "top_logprobs": [
                {
                  "token": "token",
                  "bytes": [
                    0
                  ],
                  "logprob": 0
                }
              ]
            }
          ]
        }
      ],
      "role": "assistant",
      "status": "in_progress",
      "type": "message",
      "agent": {
        "agent_name": "agent_name"
      },
      "phase": "commentary"
    }
  ],
  "parallel_tool_calls": true,
  "temperature": 1,
  "tool_choice": "none",
  "tools": [
    {
      "name": "name",
      "parameters": {
        "foo": "bar"
      },
      "strict": true,
      "type": "function",
      "allowed_callers": [
        "direct"
      ],
      "async": true,
      "defer_loading": true,
      "description": "description",
      "output_schema": {
        "foo": "bar"
      }
    }
  ],
  "top_p": 1,
  "background": true,
  "completed_at": 0,
  "conversation": {
    "id": "id"
  },
  "image": {
    "context_compression": "enabled"
  },
  "max_output_tokens": 0,
  "max_tool_calls": 0,
  "moderation": {
    "input": {
      "categories": {
        "foo": true
      },
      "category_applied_input_types": {
        "foo": [
          "text"
        ]
      },
      "category_scores": {
        "foo": 0
      },
      "flagged": true,
      "model": "model",
      "type": "moderation_result"
    },
    "output": {
      "categories": {
        "foo": true
      },
      "category_applied_input_types": {
        "foo": [
          "text"
        ]
      },
      "category_scores": {
        "foo": 0
      },
      "flagged": true,
      "model": "model",
      "type": "moderation_result"
    }
  },
  "output_text": "output_text",
  "previous_response_id": "previous_response_id",
  "prompt": {
    "id": "id",
    "variables": {
      "foo": "string"
    },
    "version": "version"
  },
  "prompt_cache_diagnostics": {
    "cache_missed_tokens": 0,
    "reason": "model_changed",
    "type": "cache_miss",
    "comparison_reusable_tokens": 0
  },
  "prompt_cache_key": "prompt-cache-key-1234",
  "prompt_cache_options": {
    "mode": "implicit",
    "ttl": "30m",
    "comparison_response_id": "comparison_response_id"
  },
  "prompt_cache_retention": "in_memory",
  "reasoning": {
    "context": "auto",
    "effort": "none",
    "generate_summary": "auto",
    "mode": "standard",
    "summary": "auto"
  },
  "safety_identifier": "safety-identifier-1234",
  "service_tier": "auto",
  "status": "completed",
  "text": {
    "format": {
      "type": "text"
    },
    "verbosity": "low"
  },
  "tool_usage": {
    "image_gen": {
      "input_tokens": 0,
      "input_tokens_details": {
        "image_tokens": 0,
        "text_tokens": 0
      },
      "output_tokens": 0,
      "total_tokens": 0,
      "cached_tokens": 0,
      "cached_tokens_details": {
        "cached_image_tokens": 0,
        "cached_text_tokens": 0
      },
      "output_tokens_details": {
        "image_tokens": 0,
        "text_tokens": 0
      }
    },
    "web_search": {
      "num_requests": 0
    }
  },
  "top_logprobs": 0,
  "truncation": "auto",
  "usage": {
    "input_tokens": 0,
    "input_tokens_details": {
      "cache_write_tokens": 0,
      "cached_tokens": 0,
      "cache_write_tokens_details": {
        "ttl_12h_tokens": 0,
        "ttl_30m_tokens": 0
      }
    },
    "output_tokens": 0,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 0
  },
  "user": "user-1234"
}
```

### Example

```typescript
import OpenAI from "openai";
const client = new OpenAI();

const response = await client.responses.retrieve("resp_123");
console.log(response);
```

#### Response example

```json
{
  "id": "resp_67cb71b351908190a308f3859487620d06981a8637e6bc44",
  "object": "response",
  "access_programs": null,
  "created_at": 1741386163,
  "status": "completed",
  "completed_at": 1741386164,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-6-astra",
  "output": [
    {
      "type": "message",
      "id": "msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44",
      "status": "completed",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Silent circuits hum,  \nThoughts emerge in data streams—  \nDigital dawn breaks.",
          "annotations": [],
          "logprobs": []
        }
      ]
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 32,
    "input_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0
    },
    "output_tokens": 18,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 50
  },
  "user": null,
  "metadata": {}
}
```

## Domain Types

### Beta Apply Patch Tool

- `BetaApplyPatchTool`

  Allows the assistant to create, delete, or update files using unified diffs.

  - `type: "apply_patch"`

    The type of the tool. Always `apply_patch`.

    - `"apply_patch"`

  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

    The tool invocation context(s).

    `minItems: 1`

    - `"direct"`

    - `"programmatic"`

### Beta Compacted Response

- `BetaCompactedResponse`

  - `id: string`

    The unique identifier for the compacted response.

  - `created_at: number`

    Unix timestamp (in seconds) when the compacted conversation was created.

    `format: unixtime`

  - `object: "response.compaction"`

    The object type. Always `response.compaction`.

    - `"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.

    - `BetaResponseOutputMessage`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

        The content of the output message.

        - `BetaResponseOutputText`

          A text output from the model.

          - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

            The annotations of the text output.

            - `FileCitation`

              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 in the output text at which to insert the file citation.

              - `type: "file_citation"`

                The type of the file citation. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation`

              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_citation"`

              - `url: string`

                The URL of the web resource.

                `format: uri`

            - `ContainerFileCitation`

              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`.

                - `"container_file_citation"`

            - `FilePath`

              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`.

                - `"file_path"`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

          - `logprobs?: Array<Logprob>`

            - `token: string`

            - `bytes: Array<number>`

            - `logprob: number`

            - `top_logprobs: Array<TopLogprob>`

              - `token: string`

              - `bytes: Array<number>`

              - `logprob: number`

        - `BetaResponseOutputRefusal`

          A refusal from the model.

          - `refusal: string`

            The refusal explanation from the model.

          - `type: "refusal"`

            The type of the refusal. Always `refusal`.

            - `"refusal"`

      - `role: "assistant"`

        The role of the output message. Always `assistant`.

        - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "message"`

        The type of the output message. Always `message`.

        - `"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" | "final_answer" | 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.

        - `"commentary"`

        - `"final_answer"`

    - `BetaResponseFileSearchToolCall`

      The results of a file search tool call. See the
      [file search guide](/api/docs/guides/tools-file-search) 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`,

        - `"in_progress"`

        - `"searching"`

        - `"completed"`

        - `"incomplete"`

        - `"failed"`

      - `type: "file_search_call"`

        The type of the file search tool call. Always `file_search_call`.

        - `"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.

          - `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.

          `format: float`

        - `text?: string`

          The text that was retrieved from the file.

    - `BetaResponseFunctionToolCall`

      A tool call to run a function. See the
      [function calling guide](/api/docs/guides/function-calling) 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`.

        - `"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.

      - `async?: boolean`

        Whether the function tool call runs asynchronously.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseFunctionToolCallOutputItem`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `string`

        - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          - `BetaResponseInputText`

            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`.

              - `"input_text"`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `detail: BetaImageDetail`

              The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

              - `"low"`

              - `"high"`

              - `"auto"`

              - `"original"`

            - `type: "input_image"`

              The type of the input item. Always `input_image`.

              - `"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.

              `format: uri`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFile`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"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`.

              - `"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.

              `format: uri`

            - `filename?: string`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "function_call_output"`

        The type of the function tool call output. Always `function_call_output`.

        - `"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.

      - `call_id?: string`

        The unique ID of the function tool call generated by the model.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

      - `name?: string`

        The name of the tool that produced the output.

      - `namespace?: string`

        The namespace of the tool that produced the output.

    - `AgentMessage`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

        Encrypted content sent between agents.

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseOutputText`

          A text output from the model.

        - `Text`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText`

          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`.

            - `"summary_text"`

        - `ReasoningText`

          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`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal`

          A refusal from the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot`

          A screenshot of a computer.

          - `detail: BetaImageDetail`

            The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

          - `file_id: string | null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string | null`

            The URL of the screenshot image.

            `format: uri`

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputFile`

          A file input to the model.

        - `EncryptedContent`

          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`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall`

      - `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.

        - `"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`.

        - `"multi_agent_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput`

      - `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.

        - `"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>`

        Text output returned by the multi-agent action.

        - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

          The annotations of the text output.

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

        - `logprobs?: Array<Logprob>`

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseFunctionWebSearch`

      The results of a web search tool call. See the
      [web search guide](/api/docs/guides/tools-web-search) for more information.

      - `id: string`

        The unique ID of the web search tool call.

      - `action: Search | OpenPage | FindInPage`

        An object describing the specific action taken in this web search call.
        Includes details on how the model used the web (search, open_page, find_in_page).

        - `Search`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries?: Array<string>`

            The search queries.

          - `query?: string`

            The search query.

          - `sources?: Array<Source>`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

              `format: uri`

        - `OpenPage`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url?: string | null`

            The URL opened by the model.

            `format: uri`

        - `FindInPage`

          Action type "find_in_page": Searches for a pattern within a loaded page.

          - `pattern: string`

            The pattern or text to search for within the page.

          - `type: "find_in_page"`

            The action type.

            - `"find_in_page"`

          - `url: string`

            The URL of the page searched for the pattern.

            `format: uri`

      - `status: "in_progress" | "searching" | "completed" | 2 more`

        The status of the web search tool call.

        - `"in_progress"`

        - `"searching"`

        - `"completed"`

        - `"failed"`

        - `"incomplete"`

      - `type: "web_search_call"`

        The type of the web search tool call. Always `web_search_call`.

        - `"web_search_call"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseComputerToolCall`

      A tool call to a computer use tool. See the
      [computer use guide](/api/docs/guides/tools-computer-use) 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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "computer_call"`

        The type of the computer call. Always `computer_call`.

        - `"computer_call"`

      - `action?: BetaComputerAction`

        A click action.

        - `Click`

          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`.

            - `"left"`

            - `"right"`

            - `"wheel"`

            - `"back"`

            - `"forward"`

          - `type: "click"`

            Specifies the event type. For a click action, this property is always `click`.

            - `"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`

          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`.

            - `"double_click"`

          - `x: number`

            The x-coordinate where the double click occurred.

          - `y: number`

            The y-coordinate where the double click occurred.

        - `Drag`

          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`.

            - `"drag"`

          - `keys?: Array<string> | null`

            The keys being held while dragging the mouse.

        - `Keypress`

          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`.

            - `"keypress"`

        - `Move`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"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`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll`

          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`.

            - `"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`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions?: BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click`

          A click action.

        - `DoubleClick`

          A double click action.

        - `Drag`

          A drag action.

        - `Keypress`

          A collection of keypresses the model would like to perform.

        - `Move`

          A mouse move action.

        - `Screenshot`

          A screenshot action.

        - `Scroll`

          A scroll action.

        - `Type`

          An action to type in text.

        - `Wait`

          A wait action.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseComputerToolCallOutputItem`

      - `id: string`

        The ID of the computer tool call output.

      - `call_id: string`

        The ID of the computer tool call that produced the output.

      - `output: BetaResponseComputerToolCallOutputScreenshot`

        A computer screenshot image used with the computer use tool.

        - `type: "computer_screenshot"`

          Specifies the event type. For a computer screenshot, this property is
          always set to `computer_screenshot`.

          - `"computer_screenshot"`

        - `file_id?: string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url?: string`

          The URL of the screenshot image.

          `format: uri`

      - `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.

        - `"completed"`

        - `"incomplete"`

        - `"failed"`

        - `"in_progress"`

      - `type: "computer_call_output"`

        The type of the computer tool call output. Always `computer_call_output`.

        - `"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`

      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](/api/docs/guides/conversation-state).

      - `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`.

          - `"summary_text"`

      - `type: "reasoning"`

        The type of the object. Always `reasoning`.

        - `"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`.

          - `"reasoning_text"`

      - `encrypted_content?: string | null`

        The encrypted content of the reasoning item. This is populated by default
        for reasoning items returned by `POST /v1/responses` and WebSocket
        `response.create` requests.

        When streaming, use the completed reasoning item and its
        `encrypted_content` from the `response.output_item.done` event in
        subsequent requests. The `encrypted_content` in
        `response.output_item.added` may be incomplete. This is especially
        important when `store` is `false` or when using Zero Data Retention.

      - `status?: "in_progress" | "completed" | "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `Program`

      - `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`.

        - `"program"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput`

      - `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.

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The type of the item. Always `program_output`.

        - `"program_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseToolSearchCall`

      - `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.

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the tool search call item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "tool_search_call"`

        The type of the item. Always `tool_search_call`.

        - `"tool_search_call"`

      - `agent?: Agent`

        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: 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.

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: Array<BetaTool>`

        The loaded tool definitions returned by tool search.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

            - `"function"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async?: boolean`

          - `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`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `type: "file_search"`

            The type of the file search tool. Always `file_search`.

            - `"file_search"`

          - `vector_store_ids: Array<string>`

            The IDs of the vector stores to search.

          - `filters?: ComparisonFilter | CompoundFilter | null`

            A filter to apply.

            - `ComparisonFilter`

              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

                - `"eq"`

                - `"ne"`

                - `"gt"`

                - `"gte"`

                - `"lt"`

                - `"lte"`

                - `"in"`

                - `"nin"`

              - `value: string | number | boolean | Array<string | number>`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `Array<string | number>`

                  - `string`

                  - `number`

            - `CompoundFilter`

              Combine multiple filters using `and` or `or`.

              - `filters: Array<ComparisonFilter | unknown>`

                Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

                - `ComparisonFilter`

                  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

                    - `"eq"`

                    - `"ne"`

                    - `"gt"`

                    - `"gte"`

                    - `"lt"`

                    - `"lte"`

                    - `"in"`

                    - `"nin"`

                  - `value: string | number | boolean | Array<string | number>`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `Array<string | number>`

                      - `string`

                      - `number`

                - `unknown`

              - `type: "and" | "or"`

                Type of operation: `and` or `or`.

                - `"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`

            Ranking options for search.

            - `hybrid_search?: HybridSearch`

              Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

              - `embedding_weight: number`

                The weight of the embedding in the reciprocal ranking fusion.

              - `text_weight: number`

                The weight of the text in the reciprocal ranking fusion.

            - `ranker?: "auto" | "default-2024-11-15"`

              The ranker to use for the file search.

              - `"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`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `type: "computer"`

            The type of the computer tool. Always `computer`.

            - `"computer"`

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `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.

            - `"windows"`

            - `"mac"`

            - `"linux"`

            - `"ubuntu"`

            - `"browser"`

          - `type: "computer_use_preview"`

            The type of the computer use tool. Always `computer_use_preview`.

            - `"computer_use_preview"`

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

          - `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`.

            - `"web_search"`

            - `"web_search_2025_08_26"`

          - `external_web_access?: boolean`

            Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

          - `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.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `user_location?: UserLocation | null`

            The approximate location of the user. If omitted or null, defaults to the
            United States. To avoid this fallback, pass `{"type": "approximate"}` without
            location fields. To localize results, provide the relevant location fields.

            - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type?: "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

            - `"mcp"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools?: Array<string> | McpToolFilter | null`

            List of allowed tool names or a filter object.

            - `Array<string>`

            - `McpToolFilter`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

            This field is deprecated for models released after September 1, 2026.
            Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
            connect through a Secure MCP Tunnel.

            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`

            - `"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" | null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter`

              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`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                  it will match this filter.

                - `tool_names?: Array<string>`

                  List of allowed tool names.

              - `never?: Never`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

            `format: uri`

          - `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`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string | CodeInterpreterToolAuto`

            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.

            - `string`

            - `CodeInterpreterToolAuto`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids?: Array<string>`

                An optional list of uploaded files to make available to your code.

                `maxItems: 50`

              - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist`

                  - `allowed_domains: Array<string>`

                    A list of allowed domains when type is `allowlist`.

                    `minItems: 1`

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                    Optional domain-scoped secrets for allowlisted domains.

                    `minItems: 1`

                    - `domain: string`

                      The domain associated with the secret.

                      `minLength: 1`

                    - `name: string`

                      The name of the secret to inject for the domain.

                      `minLength: 1`

                    - `value: string`

                      The secret value to inject for the domain.

                      `minLength: 1`, `maxLength: 10485760`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action?: "generate" | "edit" | "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background?: "transparent" | "opaque" | "auto"`

            Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
            `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
            Transparent backgrounds are available for supported GPT Image models. For
            `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
            using `transparent`, set the output format to `png` or `webp`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `complexity?: "low" | "medium" | "high"`

            Computation spent planning the image, independently of rendering quality.
            Overrides the outer response's `reasoning.effort` for image generation.
            When omitted, inherits a supported outer reasoning effort or uses the
            image model's configured default.
            For SVG output, controls the reference image, not the SVG author's
            reasoning.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `frame_count?: number`

            Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

            `minimum: 2`, `maximum: 16`

          - `frame_duration_ms?: number`

            Duration of each GIF frame in milliseconds, rounded to 10 ms.
            Requires `output_format` to be `gif`. Default: 200.

            `minimum: 20`, `maximum: 2000`

          - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

            - `"high"`

            - `"low"`

          - `input_image_mask?: InputImageMask`

            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" | 9 more`

            The image generation model to use. One of `gpt-image-1-mini`,
            `gpt-image-1.5`, `gpt-image-2`,
            `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
            `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
            `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
            `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
            `gpt-image-2`.

            `gpt-image-1` was shut down on October 23, 2026. Use
            `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

            Deprecated values:

            - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

            - `(string & {})`

            - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              - `"gpt-image-1"`

              - `"gpt-image-1-mini"`

              - `"gpt-image-2"`

              - `"gpt-image-2-2026-04-21"`

              - `"gpt-image-2.5-sunburst"`

              - `"gpt-image-2.5-sunburst-2026-09-08"`

              - `"gpt-image-2.5-flare"`

              - `"gpt-image-2.5-flare-2026-09-08"`

              - `"gpt-image-2.6-sunburst"`

              - `"gpt-image-2.6-flare"`

              - `"gpt-image-1.5"`

              - `"chatgpt-image-latest"`

          - `moderation?: "auto" | "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression?: number`

            Compression level for the output image. Default: 100.

            `minimum: 0`, `maximum: 100`

          - `output_format?: "png" | "webp" | "jpeg" | 2 more`

            The output format of the generated image. One of `png`, `webp`, `jpeg`,
            `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
            that supports the selected format. GIF output does not support
            partial image streaming (`partial_images` greater than `0`),
            `input_image_mask`, or custom `output_compression`.
            Responses lifecycle events can still be streamed for GIF output.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

            - `"gif"`

            - `"svg"`

          - `partial_images?: number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            `minimum: 0`, `maximum: 3`

          - `quality?: "low" | "medium" | "high" | 3 more`

            The quality of the generated image. The GPT image models support `low`,
            `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
            including their `2026-09-08` snapshots, also support `xhigh` and `max`.
            Default: `auto`.

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

            - `"auto"`

          - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

            The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

            - `(string & {})`

            - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

          - `svg?: Svg`

            SVG author model settings. Requires `output_format` to be `svg`.
            When SVG model selection is enabled, omitting this object uses the
            outer response model. Otherwise, the default SVG author is used and
            explicit model overrides are unavailable.

            - `model?: string`

              `minLength: 1`

            - `reasoning?: Reasoning | null`

              Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

              - `effort?: "none" | "minimal" | "low" | 4 more`

                Controls how much effort the model should spend on reasoning for this request.

                - `"none"`

                - `"minimal"`

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

        - `LocalShell`

          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`.

            - `"local_shell"`

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

            - `BetaContainerAuto`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids?: Array<string>`

                An optional list of uploaded files to make available to your code.

                `maxItems: 50`

              - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled`

                - `BetaContainerNetworkPolicyAllowlist`

              - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

                An optional list of skills referenced by id or inline data.

                `maxItems: 200`

                - `BetaSkillReference`

                  - `skill_id: string`

                    The ID of the referenced skill.

                    `minLength: 1`, `maxLength: 64`

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version?: string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill`

                  - `description: string`

                    The description of the skill.

                  - `name: string`

                    The name of the skill.

                  - `source: BetaInlineSkillSource`

                    Inline skill payload

                    - `data: string`

                      Base64-encoded skill zip bundle.

                      `minLength: 1`, `maxLength: 70254592`

                    - `media_type: "application/zip"`

                      The media type of the inline skill payload. Must be `application/zip`.

                      - `"application/zip"`

                    - `type: "base64"`

                      The type of the inline skill source. Must be `base64`.

                      - `"base64"`

                  - `type: "inline"`

                    Defines an inline skill for this request.

                    - `"inline"`

            - `BetaLocalEnvironment`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills?: Array<BetaLocalSkill>`

                An optional list of skills.

                `maxItems: 200`

                - `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: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

            - `"custom"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `async?: boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `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 | Grammar`

            The input format for the custom tool. Default is unconstrained text.

            - `Text`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar`

              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`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

          - `description: string`

            A description of the namespace shown to the model.

          - `name: string`

            The namespace name used in tool calls (for example, `crm`).

            `minLength: 1`

          - `tools: Array<Function | BetaCustomTool>`

            The function/custom tools available inside this namespace.

            `minItems: 1`

            - `Function`

              - `name: string`

                `minLength: 1`, `maxLength: 128`

              - `type: "function"`

                - `"function"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `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`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `type: "namespace"`

            The type of the tool. Always `namespace`.

            - `"namespace"`

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"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.

            - `"server"`

            - `"client"`

          - `parameters?: unknown`

            Parameter schema for a client-executed tool search tool.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `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`.

            - `"web_search_preview"`

            - `"web_search_preview_2025_03_11"`

          - `search_content_types?: Array<"text" | "image">`

            - `"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.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `user_location?: UserLocation | null`

            The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

            - `type: "approximate"`

              The type of location approximation. Always `approximate`.

              - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `BetaApplyPatchTool`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent?: Agent`

        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: string`

        The unique ID of the additional tools item.

      - `role: "unknown" | "user" | "assistant" | 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: Array<BetaTool>`

        The additional tool definitions made available at this item.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

        - `BetaFileSearchTool`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `BetaComputerTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

        - `CodeInterpreter`

          A tool that runs Python code to help generate a response to a prompt.

        - `ProgrammaticToolCalling`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

        - `LocalShell`

          A tool that allows the model to execute shell commands in a local environment.

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `BetaApplyPatchTool`

          Allows the assistant to create, delete, or update files using unified diffs.

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseCompactionItem`

      A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

      - `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`.

        - `"compaction"`

      - `agent?: Agent`

        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`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"generating"`

        - `"failed"`

      - `type: "image_generation_call"`

        The type of the image generation call. Always `image_generation_call`.

        - `"image_generation_call"`

      - `action?: "generate" | "edit" | "auto" | null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background?: "transparent" | "opaque" | "auto" | null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error?: Error`

        Details of a moderation failure, when available.

        - `code: string | null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string | null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details?: ModerationDetails`

          Public details for a `moderation_blocked` error, when available.

          - `categories: Array<string>`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" | "output" | "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

        - `"gif"`

        - `"svg"`

      - `quality?: "low" | "medium" | "high" | 3 more | null`

        The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

        - `"auto"`

      - `revised_prompt?: string | null`

        The prompt that was used after any model prompt rewriting.

      - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `(string & {})`

        - `"1024x1024" | "1024x1536" | "1536x1024"`

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

      - `svg_usage?: SvgUsage`

        - `input_tokens: number`

        - `model: string`

        - `output_tokens: number`

        - `reasoning_tokens: number`

        - `total_tokens: number`

    - `BetaResponseCodeInterpreterToolCall`

      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 | Image> | null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs`

          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`.

            - `"logs"`

        - `Image`

          The image output from the code interpreter.

          - `type: "image"`

            The type of the output. Always `image`.

            - `"image"`

          - `url: string`

            The URL of the image output from the code interpreter.

            `format: uri`

      - `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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"interpreting"`

        - `"failed"`

      - `type: "code_interpreter_call"`

        The type of the code interpreter tool call. Always `code_interpreter_call`.

        - `"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`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: Action`

        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`.

          - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "local_shell_call"`

        The type of the local shell call. Always `local_shell_call`.

        - `"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`

      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`.

        - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseFunctionShellToolCall`

      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`

        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 | BetaResponseContainerReference | null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "shell_call"`

        The type of the item. Always `shell_call`.

        - `"shell_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The ID of the entity that created this tool call.

    - `BetaResponseFunctionShellToolCallOutput`

      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 | Exit`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit`

            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`.

              - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "shell_call_output"`

        The type of the shell call output. Always `shell_call_output`.

        - `"shell_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

    - `BetaResponseApplyPatchToolCall`

      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 | DeleteFile | UpdateFile`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile`

          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.

            - `"create_file"`

        - `DeleteFile`

          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.

            - `"delete_file"`

        - `UpdateFile`

          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.

            - `"update_file"`

      - `status: "in_progress" | "completed"`

        The status of the apply patch tool call. One of `in_progress` or `completed`.

        - `"in_progress"`

        - `"completed"`

      - `type: "apply_patch_call"`

        The type of the item. Always `apply_patch_call`.

        - `"apply_patch_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The ID of the entity that created this tool call.

    - `BetaResponseApplyPatchToolCallOutput`

      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`.

        - `"completed"`

        - `"failed"`

      - `type: "apply_patch_call_output"`

        The type of the item. Always `apply_patch_call_output`.

        - `"apply_patch_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"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`

      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`.

        - `"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?: BetaMcpToolCallError | null`

        The error from the tool call, if any.

        - `McpProtocolError`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `McpListTools`

      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`.

        - `"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`

      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`.

        - `"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`

      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`.

        - `"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`

      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`.

        - `"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.

      - `async?: boolean`

        Whether the custom tool call runs asynchronously.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace?: string`

        The namespace of the custom tool being called.

    - `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `created_by?: string`

        The identifier of the actor that created the item.

  - `usage: BetaResponseUsage`

    Token accounting for the compaction pass, including cached, reasoning, and total tokens.

    - `input_tokens: number`

      The number of input tokens.

    - `input_tokens_details: InputTokensDetails`

      A detailed breakdown of the input tokens.

      - `cache_write_tokens: number`

        The number of input tokens that were written to the cache.

      - `cached_tokens: number`

        The number of tokens that were retrieved from the cache.
        [More on prompt caching](/api/docs/guides/prompt-caching).

      - `cache_write_tokens_details?: CacheWriteTokensDetails`

        - `ttl_12h_tokens: number`

          The number of input tokens written with 12-hour retention.

        - `ttl_30m_tokens: number`

          The number of input tokens written with 30-minute retention.

    - `output_tokens: number`

      The number of output tokens.

    - `output_tokens_details: OutputTokensDetails`

      A detailed breakdown of the output tokens.

      - `reasoning_tokens: number`

        The number of reasoning tokens.

    - `total_tokens: number`

      The total number of tokens used.

  - `image?: Image`

    - `context_compression: "enabled" | "disabled"`

      Effective image context optimization policy.

      - `"enabled"`

      - `"disabled"`

### Beta Computer Action

- `BetaComputerAction = Click | DoubleClick | Drag | 6 more`

  A click action.

  - `Click`

    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`.

      - `"left"`

      - `"right"`

      - `"wheel"`

      - `"back"`

      - `"forward"`

    - `type: "click"`

      Specifies the event type. For a click action, this property is always `click`.

      - `"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`

    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`.

      - `"double_click"`

    - `x: number`

      The x-coordinate where the double click occurred.

    - `y: number`

      The y-coordinate where the double click occurred.

  - `Drag`

    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`.

      - `"drag"`

    - `keys?: Array<string> | null`

      The keys being held while dragging the mouse.

  - `Keypress`

    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`.

      - `"keypress"`

  - `Move`

    A mouse move action.

    - `type: "move"`

      Specifies the event type. For a move action, this property is always set to `move`.

      - `"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`

    A screenshot action.

    - `type: "screenshot"`

      Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

      - `"screenshot"`

  - `Scroll`

    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`.

      - `"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`

    An action to type in text.

    - `text: string`

      The text to type.

    - `type: "type"`

      Specifies the event type. For a type action, this property is always set to `type`.

      - `"type"`

  - `Wait`

    A wait action.

    - `type: "wait"`

      Specifies the event type. For a wait action, this property is always set to `wait`.

      - `"wait"`

### Beta Computer Action List

- `BetaComputerActionList = Array<BetaComputerAction>`

  Flattened batched actions for `computer_use`. Each action includes an
  `type` discriminator and action-specific fields.

  - `Click`

    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`.

      - `"left"`

      - `"right"`

      - `"wheel"`

      - `"back"`

      - `"forward"`

    - `type: "click"`

      Specifies the event type. For a click action, this property is always `click`.

      - `"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`

    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`.

      - `"double_click"`

    - `x: number`

      The x-coordinate where the double click occurred.

    - `y: number`

      The y-coordinate where the double click occurred.

  - `Drag`

    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`.

      - `"drag"`

    - `keys?: Array<string> | null`

      The keys being held while dragging the mouse.

  - `Keypress`

    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`.

      - `"keypress"`

  - `Move`

    A mouse move action.

    - `type: "move"`

      Specifies the event type. For a move action, this property is always set to `move`.

      - `"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`

    A screenshot action.

    - `type: "screenshot"`

      Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

      - `"screenshot"`

  - `Scroll`

    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`.

      - `"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`

    An action to type in text.

    - `text: string`

      The text to type.

    - `type: "type"`

      Specifies the event type. For a type action, this property is always set to `type`.

      - `"type"`

  - `Wait`

    A wait action.

    - `type: "wait"`

      Specifies the event type. For a wait action, this property is always set to `wait`.

      - `"wait"`

### Beta Computer Tool

- `BetaComputerTool`

  A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

  - `type: "computer"`

    The type of the computer tool. Always `computer`.

    - `"computer"`

### Beta Computer Use Preview Tool

- `BetaComputerUsePreviewTool`

  A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

  - `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.

    - `"windows"`

    - `"mac"`

    - `"linux"`

    - `"ubuntu"`

    - `"browser"`

  - `type: "computer_use_preview"`

    The type of the computer use tool. Always `computer_use_preview`.

    - `"computer_use_preview"`

### Beta Container Auto

- `BetaContainerAuto`

  - `type: "container_auto"`

    Automatically creates a container for this request

    - `"container_auto"`

  - `file_ids?: Array<string>`

    An optional list of uploaded files to make available to your code.

    `maxItems: 50`

  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

    The memory limit for the container.

    - `"1g"`

    - `"4g"`

    - `"16g"`

    - `"64g"`

  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

    Network access policy for the container.

    - `BetaContainerNetworkPolicyDisabled`

      - `type: "disabled"`

        Disable outbound network access. Always `disabled`.

        - `"disabled"`

    - `BetaContainerNetworkPolicyAllowlist`

      - `allowed_domains: Array<string>`

        A list of allowed domains when type is `allowlist`.

        `minItems: 1`

      - `type: "allowlist"`

        Allow outbound network access only to specified domains. Always `allowlist`.

        - `"allowlist"`

      - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

        Optional domain-scoped secrets for allowlisted domains.

        `minItems: 1`

        - `domain: string`

          The domain associated with the secret.

          `minLength: 1`

        - `name: string`

          The name of the secret to inject for the domain.

          `minLength: 1`

        - `value: string`

          The secret value to inject for the domain.

          `minLength: 1`, `maxLength: 10485760`

  - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

    An optional list of skills referenced by id or inline data.

    `maxItems: 200`

    - `BetaSkillReference`

      - `skill_id: string`

        The ID of the referenced skill.

        `minLength: 1`, `maxLength: 64`

      - `type: "skill_reference"`

        References a skill created with the /v1/skills endpoint.

        - `"skill_reference"`

      - `version?: string`

        Optional skill version. Use a positive integer or 'latest'. Omit for default.

    - `BetaInlineSkill`

      - `description: string`

        The description of the skill.

      - `name: string`

        The name of the skill.

      - `source: BetaInlineSkillSource`

        Inline skill payload

        - `data: string`

          Base64-encoded skill zip bundle.

          `minLength: 1`, `maxLength: 70254592`

        - `media_type: "application/zip"`

          The media type of the inline skill payload. Must be `application/zip`.

          - `"application/zip"`

        - `type: "base64"`

          The type of the inline skill source. Must be `base64`.

          - `"base64"`

      - `type: "inline"`

        Defines an inline skill for this request.

        - `"inline"`

### Beta Container Network Policy Allowlist

- `BetaContainerNetworkPolicyAllowlist`

  - `allowed_domains: Array<string>`

    A list of allowed domains when type is `allowlist`.

    `minItems: 1`

  - `type: "allowlist"`

    Allow outbound network access only to specified domains. Always `allowlist`.

    - `"allowlist"`

  - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

    Optional domain-scoped secrets for allowlisted domains.

    `minItems: 1`

    - `domain: string`

      The domain associated with the secret.

      `minLength: 1`

    - `name: string`

      The name of the secret to inject for the domain.

      `minLength: 1`

    - `value: string`

      The secret value to inject for the domain.

      `minLength: 1`, `maxLength: 10485760`

### Beta Container Network Policy Disabled

- `BetaContainerNetworkPolicyDisabled`

  - `type: "disabled"`

    Disable outbound network access. Always `disabled`.

    - `"disabled"`

### Beta Container Network Policy Domain Secret

- `BetaContainerNetworkPolicyDomainSecret`

  - `domain: string`

    The domain associated with the secret.

    `minLength: 1`

  - `name: string`

    The name of the secret to inject for the domain.

    `minLength: 1`

  - `value: string`

    The secret value to inject for the domain.

    `minLength: 1`, `maxLength: 10485760`

### Beta Container Reference

- `BetaContainerReference`

  - `container_id: string`

    The ID of the referenced container.

  - `type: "container_reference"`

    References a container created with the /v1/containers endpoint

    - `"container_reference"`

### Beta Custom Tool

- `BetaCustomTool`

  A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

    - `"custom"`

  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

    The tool invocation context(s).

    `minItems: 1`

    - `"direct"`

    - `"programmatic"`

  - `async?: boolean`

    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

  - `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 | Grammar`

    The input format for the custom tool. Default is unconstrained text.

    - `Text`

      Unconstrained free-form text.

      - `type: "text"`

        Unconstrained text format. Always `text`.

        - `"text"`

    - `Grammar`

      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`.

        - `"lark"`

        - `"regex"`

      - `type: "grammar"`

        Grammar format. Always `grammar`.

        - `"grammar"`

### Beta Easy Input Message

- `BetaEasyInputMessage`

  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.

    - `string`

    - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

      A list of one or many input items to the model, containing different content
      types.

      - `BetaResponseInputText`

        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`.

          - `"input_text"`

        - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

          Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

          - `ttl?: "30m" | "12h"`

            The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

            - `"30m"`

            - `"12h"`

      - `BetaResponseInputImage`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `detail: BetaImageDetail`

          The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

          - `"low"`

          - `"high"`

          - `"auto"`

          - `"original"`

        - `type: "input_image"`

          The type of the input item. Always `input_image`.

          - `"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.

          `format: uri`

        - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

          Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

          - `ttl?: "30m" | "12h"`

            The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

            - `"30m"`

            - `"12h"`

      - `BetaResponseInputFile`

        A file input to the model.

        - `type: "input_file"`

          The type of the input item. Always `input_file`.

          - `"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`.

          - `"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.

          `format: uri`

        - `filename?: string`

          The name of the file to be sent to the model.

        - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

          Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

          - `ttl?: "30m" | "12h"`

            The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

            - `"30m"`

            - `"12h"`

  - `role: "user" | "assistant" | "system" | "developer"`

    The role of the message input. One of `user`, `assistant`, `system`, or
    `developer`.

    - `"user"`

    - `"assistant"`

    - `"system"`

    - `"developer"`

  - `phase?: "commentary" | "final_answer" | 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.

    - `"commentary"`

    - `"final_answer"`

  - `type?: "message"`

    The type of the message input. Always `message`.

    - `"message"`

### Beta File Search Tool

- `BetaFileSearchTool`

  A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

  - `type: "file_search"`

    The type of the file search tool. Always `file_search`.

    - `"file_search"`

  - `vector_store_ids: Array<string>`

    The IDs of the vector stores to search.

  - `filters?: ComparisonFilter | CompoundFilter | null`

    A filter to apply.

    - `ComparisonFilter`

      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

        - `"eq"`

        - `"ne"`

        - `"gt"`

        - `"gte"`

        - `"lt"`

        - `"lte"`

        - `"in"`

        - `"nin"`

      - `value: string | number | boolean | Array<string | number>`

        The value to compare against the attribute key; supports string, number, or boolean types.

        - `string`

        - `number`

        - `boolean`

        - `Array<string | number>`

          - `string`

          - `number`

    - `CompoundFilter`

      Combine multiple filters using `and` or `or`.

      - `filters: Array<ComparisonFilter | unknown>`

        Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

        - `ComparisonFilter`

          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

            - `"eq"`

            - `"ne"`

            - `"gt"`

            - `"gte"`

            - `"lt"`

            - `"lte"`

            - `"in"`

            - `"nin"`

          - `value: string | number | boolean | Array<string | number>`

            The value to compare against the attribute key; supports string, number, or boolean types.

            - `string`

            - `number`

            - `boolean`

            - `Array<string | number>`

              - `string`

              - `number`

        - `unknown`

      - `type: "and" | "or"`

        Type of operation: `and` or `or`.

        - `"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`

    Ranking options for search.

    - `hybrid_search?: HybridSearch`

      Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

      - `embedding_weight: number`

        The weight of the embedding in the reciprocal ranking fusion.

      - `text_weight: number`

        The weight of the text in the reciprocal ranking fusion.

    - `ranker?: "auto" | "default-2024-11-15"`

      The ranker to use for the file search.

      - `"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.

### Beta Function Shell Tool

- `BetaFunctionShellTool`

  A tool that allows the model to execute shell commands.

  - `type: "shell"`

    The type of the shell tool. Always `shell`.

    - `"shell"`

  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

    The tool invocation context(s).

    `minItems: 1`

    - `"direct"`

    - `"programmatic"`

  - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

    - `BetaContainerAuto`

      - `type: "container_auto"`

        Automatically creates a container for this request

        - `"container_auto"`

      - `file_ids?: Array<string>`

        An optional list of uploaded files to make available to your code.

        `maxItems: 50`

      - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

        The memory limit for the container.

        - `"1g"`

        - `"4g"`

        - `"16g"`

        - `"64g"`

      - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

        Network access policy for the container.

        - `BetaContainerNetworkPolicyDisabled`

          - `type: "disabled"`

            Disable outbound network access. Always `disabled`.

            - `"disabled"`

        - `BetaContainerNetworkPolicyAllowlist`

          - `allowed_domains: Array<string>`

            A list of allowed domains when type is `allowlist`.

            `minItems: 1`

          - `type: "allowlist"`

            Allow outbound network access only to specified domains. Always `allowlist`.

            - `"allowlist"`

          - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

            Optional domain-scoped secrets for allowlisted domains.

            `minItems: 1`

            - `domain: string`

              The domain associated with the secret.

              `minLength: 1`

            - `name: string`

              The name of the secret to inject for the domain.

              `minLength: 1`

            - `value: string`

              The secret value to inject for the domain.

              `minLength: 1`, `maxLength: 10485760`

      - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

        An optional list of skills referenced by id or inline data.

        `maxItems: 200`

        - `BetaSkillReference`

          - `skill_id: string`

            The ID of the referenced skill.

            `minLength: 1`, `maxLength: 64`

          - `type: "skill_reference"`

            References a skill created with the /v1/skills endpoint.

            - `"skill_reference"`

          - `version?: string`

            Optional skill version. Use a positive integer or 'latest'. Omit for default.

        - `BetaInlineSkill`

          - `description: string`

            The description of the skill.

          - `name: string`

            The name of the skill.

          - `source: BetaInlineSkillSource`

            Inline skill payload

            - `data: string`

              Base64-encoded skill zip bundle.

              `minLength: 1`, `maxLength: 70254592`

            - `media_type: "application/zip"`

              The media type of the inline skill payload. Must be `application/zip`.

              - `"application/zip"`

            - `type: "base64"`

              The type of the inline skill source. Must be `base64`.

              - `"base64"`

          - `type: "inline"`

            Defines an inline skill for this request.

            - `"inline"`

    - `BetaLocalEnvironment`

      - `type: "local"`

        Use a local computer environment.

        - `"local"`

      - `skills?: Array<BetaLocalSkill>`

        An optional list of skills.

        `maxItems: 200`

        - `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: string`

        The ID of the referenced container.

      - `type: "container_reference"`

        References a container created with the /v1/containers endpoint

        - `"container_reference"`

### Beta Function Tool

- `BetaFunctionTool`

  Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

    - `"function"`

  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

    The tool invocation context(s).

    - `"direct"`

    - `"programmatic"`

  - `async?: boolean`

  - `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.

### Beta Image Detail

- `BetaImageDetail = "low" | "high" | "auto" | "original"`

  - `"low"`

  - `"high"`

  - `"auto"`

  - `"original"`

### Beta Inline Skill

- `BetaInlineSkill`

  - `description: string`

    The description of the skill.

  - `name: string`

    The name of the skill.

  - `source: BetaInlineSkillSource`

    Inline skill payload

    - `data: string`

      Base64-encoded skill zip bundle.

      `minLength: 1`, `maxLength: 70254592`

    - `media_type: "application/zip"`

      The media type of the inline skill payload. Must be `application/zip`.

      - `"application/zip"`

    - `type: "base64"`

      The type of the inline skill source. Must be `base64`.

      - `"base64"`

  - `type: "inline"`

    Defines an inline skill for this request.

    - `"inline"`

### Beta Inline Skill Source

- `BetaInlineSkillSource`

  Inline skill payload

  - `data: string`

    Base64-encoded skill zip bundle.

    `minLength: 1`, `maxLength: 70254592`

  - `media_type: "application/zip"`

    The media type of the inline skill payload. Must be `application/zip`.

    - `"application/zip"`

  - `type: "base64"`

    The type of the inline skill source. Must be `base64`.

    - `"base64"`

### Beta Local Environment

- `BetaLocalEnvironment`

  - `type: "local"`

    Use a local computer environment.

    - `"local"`

  - `skills?: Array<BetaLocalSkill>`

    An optional list of skills.

    `maxItems: 200`

    - `description: string`

      The description of the skill.

    - `name: string`

      The name of the skill.

    - `path: string`

      The path to the directory containing the skill.

### Beta Local Skill

- `BetaLocalSkill`

  - `description: string`

    The description of the skill.

  - `name: string`

    The name of the skill.

  - `path: string`

    The path to the directory containing the skill.

### Beta Mcp Tool Call Error

- `BetaMcpToolCallError = McpProtocolError | McpToolExecutionError | HTTPError`

  - `McpProtocolError`

    - `code: number`

    - `message: string`

    - `type: "mcp_protocol_error"`

      - `"mcp_protocol_error"`

  - `McpToolExecutionError`

    - `content: unknown`

    - `type: "mcp_tool_execution_error"`

      - `"mcp_tool_execution_error"`

  - `HTTPError`

    - `code: number`

    - `message: string`

    - `type: "http_error"`

      - `"http_error"`

### Beta Namespace Tool

- `BetaNamespaceTool`

  Groups function/custom tools under a shared namespace.

  - `description: string`

    A description of the namespace shown to the model.

  - `name: string`

    The namespace name used in tool calls (for example, `crm`).

    `minLength: 1`

  - `tools: Array<Function | BetaCustomTool>`

    The function/custom tools available inside this namespace.

    `minItems: 1`

    - `Function`

      - `name: string`

        `minLength: 1`, `maxLength: 128`

      - `type: "function"`

        - `"function"`

      - `allowed_callers?: Array<"direct" | "programmatic"> | null`

        The tool invocation context(s).

        `minItems: 1`

        - `"direct"`

        - `"programmatic"`

      - `async?: boolean`

        Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

      - `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`

      A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

        - `"custom"`

      - `allowed_callers?: Array<"direct" | "programmatic"> | null`

        The tool invocation context(s).

        `minItems: 1`

        - `"direct"`

        - `"programmatic"`

      - `async?: boolean`

        Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

      - `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 | Grammar`

        The input format for the custom tool. Default is unconstrained text.

        - `Text`

          Unconstrained free-form text.

          - `type: "text"`

            Unconstrained text format. Always `text`.

            - `"text"`

        - `Grammar`

          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`.

            - `"lark"`

            - `"regex"`

          - `type: "grammar"`

            Grammar format. Always `grammar`.

            - `"grammar"`

  - `type: "namespace"`

    The type of the tool. Always `namespace`.

    - `"namespace"`

### Beta Response

- `BetaResponse`

  - `id: string`

    Unique identifier for this Response.

  - `access_programs: AccessPrograms | null`

    - `cyber: "standard" | "daybreak_blue" | "daybreak_red"`

      The effective Cyber access program used for this response.

      - `"standard"`

      - `"daybreak_blue"`

      - `"daybreak_red"`

  - `created_at: number`

    Unix timestamp (in seconds) of when this Response was created.

    `format: unixtime`

  - `error: BetaResponseError | null`

    An error object returned when the model fails to generate a Response.

    - `code: "server_error" | "rate_limit_exceeded" | "invalid_prompt" | 18 more`

      The error code for the response.

      - `"server_error"`

      - `"rate_limit_exceeded"`

      - `"invalid_prompt"`

      - `"data_residency_mismatch"`

      - `"bio_policy"`

      - `"misalignment_policy_violation"`

      - `"vector_store_timeout"`

      - `"invalid_image"`

      - `"invalid_image_format"`

      - `"invalid_base64_image"`

      - `"invalid_image_url"`

      - `"image_too_large"`

      - `"image_too_small"`

      - `"image_parse_error"`

      - `"image_content_policy_violation"`

      - `"invalid_image_mode"`

      - `"image_file_too_large"`

      - `"unsupported_image_media_type"`

      - `"empty_image_file"`

      - `"failed_to_download_image"`

      - `"image_file_not_found"`

    - `message: string`

      A human-readable description of the error.

    - `misalignment?: Misalignment`

      - `detailed_explanation?: string`

        The public explanation for this block.

      - `error_type?: (string & {}) | "potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

        An optional classification; clients must accept additional values.

        - `(string & {})`

        - `"potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

          - `"potentially_unintended_data_transfer"`

          - `"potentially_unintended_data_access"`

          - `"potentially_unintended_destructive_activity"`

          - `"other"`

      - `review_target?: string | null`

        An opaque target for explicitly continuing this review, or null when unavailable.

        `minLength: 1`, `maxLength: 96`

      - `steer?: Steer`

        An optional public continuation instruction.

        - `message: string`

          The public continuation instruction.

    - `param?: string | null`

      The request parameter associated with the error, or null if none was recorded.

    - `type?: string | null`

      The original error type, or null if it was not recorded.

  - `incomplete_details: IncompleteDetails | null`

    Details about why the response is incomplete.

    - `reason?: "max_output_tokens" | "max_messages" | "content_filter" | "steered"`

      The reason why the response is incomplete. `steered` means
      the response stopped at a safe output boundary after a
      WebSocket `response.steer` event. The server can then create
      a successor response automatically with the queued input.

      - `"max_output_tokens"`

      - `"max_messages"`

      - `"content_filter"`

      - `"steered"`

  - `instructions: string | Array<BetaResponseInputItem> | null`

    A system (or developer) message inserted into the model's context.

    When using along with `previous_response_id`, the instructions from a previous
    response will not be carried over to the next response. This makes it simple
    to swap out system (or developer) messages in new responses.

    - `string`

    - `Array<BetaResponseInputItem>`

      - `BetaEasyInputMessage`

        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.

          - `string`

          - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

            A list of one or many input items to the model, containing different content
            types.

            - `BetaResponseInputText`

              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`.

                - `"input_text"`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `detail: BetaImageDetail`

                The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                - `"low"`

                - `"high"`

                - `"auto"`

                - `"original"`

              - `type: "input_image"`

                The type of the input item. Always `input_image`.

                - `"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.

                `format: uri`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFile`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"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`.

                - `"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.

                `format: uri`

              - `filename?: string`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

        - `role: "user" | "assistant" | "system" | "developer"`

          The role of the message input. One of `user`, `assistant`, `system`, or
          `developer`.

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"developer"`

        - `phase?: "commentary" | "final_answer" | 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.

          - `"commentary"`

          - `"final_answer"`

        - `type?: "message"`

          The type of the message input. Always `message`.

          - `"message"`

      - `Message`

        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.

        - `content: BetaResponseInputMessageContentList`

          A list of one or many input items to the model, containing different content
          types.

        - `role: "user" | "system" | "developer"`

          The role of the message input. One of `user`, `system`, or `developer`.

          - `"user"`

          - `"system"`

          - `"developer"`

        - `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"`

          The status of item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type?: "message"`

          The type of the message input. Always set to `message`.

          - `"message"`

      - `BetaResponseOutputMessage`

        An output message from the model.

        - `id: string`

          The unique ID of the output message.

        - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

          The content of the output message.

          - `BetaResponseOutputText`

            A text output from the model.

            - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

              The annotations of the text output.

              - `FileCitation`

                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 in the output text at which to insert the file citation.

                - `type: "file_citation"`

                  The type of the file citation. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation`

                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_citation"`

                - `url: string`

                  The URL of the web resource.

                  `format: uri`

              - `ContainerFileCitation`

                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`.

                  - `"container_file_citation"`

              - `FilePath`

                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`.

                  - `"file_path"`

            - `text: string`

              The text output from the model.

            - `type: "output_text"`

              The type of the output text. Always `output_text`.

              - `"output_text"`

            - `logprobs?: Array<Logprob>`

              - `token: string`

              - `bytes: Array<number>`

              - `logprob: number`

              - `top_logprobs: Array<TopLogprob>`

                - `token: string`

                - `bytes: Array<number>`

                - `logprob: number`

          - `BetaResponseOutputRefusal`

            A refusal from the model.

            - `refusal: string`

              The refusal explanation from the model.

            - `type: "refusal"`

              The type of the refusal. Always `refusal`.

              - `"refusal"`

        - `role: "assistant"`

          The role of the output message. Always `assistant`.

          - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "message"`

          The type of the output message. Always `message`.

          - `"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" | "final_answer" | 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.

          - `"commentary"`

          - `"final_answer"`

      - `BetaResponseFileSearchToolCall`

        The results of a file search tool call. See the
        [file search guide](/api/docs/guides/tools-file-search) 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`,

          - `"in_progress"`

          - `"searching"`

          - `"completed"`

          - `"incomplete"`

          - `"failed"`

        - `type: "file_search_call"`

          The type of the file search tool call. Always `file_search_call`.

          - `"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.

            - `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.

            `format: float`

          - `text?: string`

            The text that was retrieved from the file.

      - `BetaResponseComputerToolCall`

        A tool call to a computer use tool. See the
        [computer use guide](/api/docs/guides/tools-computer-use) 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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "computer_call"`

          The type of the computer call. Always `computer_call`.

          - `"computer_call"`

        - `action?: BetaComputerAction`

          A click action.

          - `Click`

            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`.

              - `"left"`

              - `"right"`

              - `"wheel"`

              - `"back"`

              - `"forward"`

            - `type: "click"`

              Specifies the event type. For a click action, this property is always `click`.

              - `"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`

            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`.

              - `"double_click"`

            - `x: number`

              The x-coordinate where the double click occurred.

            - `y: number`

              The y-coordinate where the double click occurred.

          - `Drag`

            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`.

              - `"drag"`

            - `keys?: Array<string> | null`

              The keys being held while dragging the mouse.

          - `Keypress`

            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`.

              - `"keypress"`

          - `Move`

            A mouse move action.

            - `type: "move"`

              Specifies the event type. For a move action, this property is always set to `move`.

              - `"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`

            A screenshot action.

            - `type: "screenshot"`

              Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

              - `"screenshot"`

          - `Scroll`

            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`.

              - `"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`

            An action to type in text.

            - `text: string`

              The text to type.

            - `type: "type"`

              Specifies the event type. For a type action, this property is always set to `type`.

              - `"type"`

          - `Wait`

            A wait action.

            - `type: "wait"`

              Specifies the event type. For a wait action, this property is always set to `wait`.

              - `"wait"`

        - `actions?: BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

          - `Click`

            A click action.

          - `DoubleClick`

            A double click action.

          - `Drag`

            A drag action.

          - `Keypress`

            A collection of keypresses the model would like to perform.

          - `Move`

            A mouse move action.

          - `Screenshot`

            A screenshot action.

          - `Scroll`

            A scroll action.

          - `Type`

            An action to type in text.

          - `Wait`

            A wait action.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput`

        The output of a computer tool call.

        - `call_id: string`

          The ID of the computer tool call that produced the output.

          `minLength: 1`, `maxLength: 64`

        - `output: BetaResponseComputerToolCallOutputScreenshot`

          A computer screenshot image used with the computer use tool.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is
            always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `file_id?: string`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url?: string`

            The URL of the screenshot image.

            `format: uri`

        - `type: "computer_call_output"`

          The type of the computer tool call output. Always `computer_call_output`.

          - `"computer_call_output"`

        - `id?: string | null`

          The ID of the computer tool call output.

        - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

          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.

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseFunctionWebSearch`

        The results of a web search tool call. See the
        [web search guide](/api/docs/guides/tools-web-search) for more information.

        - `id: string`

          The unique ID of the web search tool call.

        - `action: Search | OpenPage | FindInPage`

          An object describing the specific action taken in this web search call.
          Includes details on how the model used the web (search, open_page, find_in_page).

          - `Search`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries?: Array<string>`

              The search queries.

            - `query?: string`

              The search query.

            - `sources?: Array<Source>`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

                `format: uri`

          - `OpenPage`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url?: string | null`

              The URL opened by the model.

              `format: uri`

          - `FindInPage`

            Action type "find_in_page": Searches for a pattern within a loaded page.

            - `pattern: string`

              The pattern or text to search for within the page.

            - `type: "find_in_page"`

              The action type.

              - `"find_in_page"`

            - `url: string`

              The URL of the page searched for the pattern.

              `format: uri`

        - `status: "in_progress" | "searching" | "completed" | 2 more`

          The status of the web search tool call.

          - `"in_progress"`

          - `"searching"`

          - `"completed"`

          - `"failed"`

          - `"incomplete"`

        - `type: "web_search_call"`

          The type of the web search tool call. Always `web_search_call`.

          - `"web_search_call"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseFunctionToolCall`

        A tool call to run a function. See the
        [function calling guide](/api/docs/guides/function-calling) 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`.

          - `"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.

        - `async?: boolean`

          Whether the function tool call runs asynchronously.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `FunctionCallOutput`

        The output of a function tool call.

        - `output: string | BetaResponseFunctionCallOutputItemList`

          Text, image, or file output of the function tool call.

          - `string`

          - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

            An array of content outputs (text, image, file) for the function tool call.

            - `BetaResponseInputTextContent`

              A text input to the model.

              - `text: string`

                The text input to the model.

                `maxLength: 10485760`

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImageContent`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

              - `type: "input_image"`

                The type of the input item. Always `input_image`.

                - `"input_image"`

              - `detail?: BetaImageDetail | null`

                The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

              - `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.

                `maxLength: 20971520`, `format: uri`

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFileContent`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"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`.

                - `"auto"`

                - `"low"`

                - `"high"`

              - `file_data?: string | null`

                The base64-encoded data of the file to be sent to the model.

                `maxLength: 73400320`

              - `file_id?: string | null`

                The ID of the file to be sent to the model.

              - `file_url?: string | null`

                The URL of the file to be sent to the model.

                `format: uri`

              - `filename?: string | null`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl?: "30m" | "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

        - `type: "function_call_output"`

          The type of the function tool call output. Always `function_call_output`.

          - `"function_call_output"`

        - `id?: string | null`

          The unique ID of the function tool call output. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

          The unique ID of the function tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `name?: string | null`

          The name of the tool that produced the output.

          `minLength: 1`, `maxLength: 128`

        - `namespace?: string | null`

          The namespace of the tool that produced the output.

          `minLength: 1`, `maxLength: 128`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AgentMessage`

        A message routed between agents.

        - `author: string`

          The sending agent identity.

        - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

          Plaintext, image, or encrypted content sent between agents.

          - `BetaResponseInputTextContent`

            A text input to the model.

          - `BetaResponseInputImageContent`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

          - `EncryptedContent`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

              `maxLength: 10485760`

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

        - `id?: string | null`

          The unique ID of this agent message item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall`

        - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

          The multi-agent action that was executed.

          - `"spawn_agent"`

          - `"interrupt_agent"`

          - `"list_agents"`

          - `"send_message"`

          - `"followup_task"`

          - `"wait_agent"`

        - `arguments: string`

          The action arguments as a JSON string.

        - `call_id: string`

          The unique ID linking this call to its output.

          `minLength: 1`, `maxLength: 64`

        - `type: "multi_agent_call"`

          The item type. Always `multi_agent_call`.

          - `"multi_agent_call"`

        - `id?: string | null`

          The unique ID of this multi-agent call.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput`

        - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

          The multi-agent action that produced this result.

          - `"spawn_agent"`

          - `"interrupt_agent"`

          - `"list_agents"`

          - `"send_message"`

          - `"followup_task"`

          - `"wait_agent"`

        - `call_id: string`

          The unique ID of the multi-agent call.

          `minLength: 1`, `maxLength: 64`

        - `output: Array<Output>`

          Text output returned by the multi-agent action.

          - `text: string`

            The text content.

            `maxLength: 10485760`

          - `type: "output_text"`

            The content type. Always `output_text`.

            - `"output_text"`

          - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

            Citations associated with the text content.

            - `FileCitation`

              - `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.

                `minimum: 0`

              - `type: "file_citation"`

                The citation type. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation`

              - `end_index: number`

                The index of the last character of the citation in the message.

                `minimum: 0`

              - `start_index: number`

                The index of the first character of the citation in the message.

                `minimum: 0`

              - `title: string`

                The title of the cited resource.

              - `type: "url_citation"`

                The citation type. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the cited resource.

                `format: uri`

            - `ContainerFileCitation`

              - `container_id: string`

                The ID of the container.

              - `end_index: number`

                The index of the last character of the citation in the message.

                `minimum: 0`

              - `file_id: string`

                The ID of the container file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

                The index of the first character of the citation in the message.

                `minimum: 0`

              - `type: "container_file_citation"`

                The citation type. Always `container_file_citation`.

                - `"container_file_citation"`

        - `type: "multi_agent_call_output"`

          The item type. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `id?: string | null`

          The unique ID of this multi-agent call output.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall`

        - `arguments: unknown`

          The arguments supplied to the tool search call.

        - `type: "tool_search_call"`

          The item type. Always `tool_search_call`.

          - `"tool_search_call"`

        - `id?: string | null`

          The unique ID of this tool search call.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

          The unique ID of the tool search call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `execution?: "server" | "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the tool search call.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseToolSearchOutputItemParam`

        - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

          The loaded tool definitions returned by the tool search output.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

              - `"function"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

            - `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`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

            - `type: "file_search"`

              The type of the file search tool. Always `file_search`.

              - `"file_search"`

            - `vector_store_ids: Array<string>`

              The IDs of the vector stores to search.

            - `filters?: ComparisonFilter | CompoundFilter | null`

              A filter to apply.

              - `ComparisonFilter`

                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

                  - `"eq"`

                  - `"ne"`

                  - `"gt"`

                  - `"gte"`

                  - `"lt"`

                  - `"lte"`

                  - `"in"`

                  - `"nin"`

                - `value: string | number | boolean | Array<string | number>`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `Array<string | number>`

                    - `string`

                    - `number`

              - `CompoundFilter`

                Combine multiple filters using `and` or `or`.

                - `filters: Array<ComparisonFilter | unknown>`

                  Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

                  - `ComparisonFilter`

                    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

                      - `"eq"`

                      - `"ne"`

                      - `"gt"`

                      - `"gte"`

                      - `"lt"`

                      - `"lte"`

                      - `"in"`

                      - `"nin"`

                    - `value: string | number | boolean | Array<string | number>`

                      The value to compare against the attribute key; supports string, number, or boolean types.

                      - `string`

                      - `number`

                      - `boolean`

                      - `Array<string | number>`

                        - `string`

                        - `number`

                  - `unknown`

                - `type: "and" | "or"`

                  Type of operation: `and` or `or`.

                  - `"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`

              Ranking options for search.

              - `hybrid_search?: HybridSearch`

                Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

                - `embedding_weight: number`

                  The weight of the embedding in the reciprocal ranking fusion.

                - `text_weight: number`

                  The weight of the text in the reciprocal ranking fusion.

              - `ranker?: "auto" | "default-2024-11-15"`

                The ranker to use for the file search.

                - `"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`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `type: "computer"`

              The type of the computer tool. Always `computer`.

              - `"computer"`

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `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.

              - `"windows"`

              - `"mac"`

              - `"linux"`

              - `"ubuntu"`

              - `"browser"`

            - `type: "computer_use_preview"`

              The type of the computer use tool. Always `computer_use_preview`.

              - `"computer_use_preview"`

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

            - `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`.

              - `"web_search"`

              - `"web_search_2025_08_26"`

            - `external_web_access?: boolean`

              Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

            - `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.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `user_location?: UserLocation | null`

              The approximate location of the user. If omitted or null, defaults to the
              United States. To avoid this fallback, pass `{"type": "approximate"}` without
              location fields. To localize results, provide the relevant location fields.

              - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type?: "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

              - `"mcp"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools?: Array<string> | McpToolFilter | null`

              List of allowed tool names or a filter object.

              - `Array<string>`

              - `McpToolFilter`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

              This field is deprecated for models released after September 1, 2026.
              Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
              connect through a Secure MCP Tunnel.

              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`

              - `"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" | null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter`

                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`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                    it will match this filter.

                  - `tool_names?: Array<string>`

                    List of allowed tool names.

                - `never?: Never`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

              `format: uri`

            - `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`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string | CodeInterpreterToolAuto`

              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.

              - `string`

              - `CodeInterpreterToolAuto`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids?: Array<string>`

                  An optional list of uploaded files to make available to your code.

                  `maxItems: 50`

                - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                    - `type: "disabled"`

                      Disable outbound network access. Always `disabled`.

                      - `"disabled"`

                  - `BetaContainerNetworkPolicyAllowlist`

                    - `allowed_domains: Array<string>`

                      A list of allowed domains when type is `allowlist`.

                      `minItems: 1`

                    - `type: "allowlist"`

                      Allow outbound network access only to specified domains. Always `allowlist`.

                      - `"allowlist"`

                    - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                      Optional domain-scoped secrets for allowlisted domains.

                      `minItems: 1`

                      - `domain: string`

                        The domain associated with the secret.

                        `minLength: 1`

                      - `name: string`

                        The name of the secret to inject for the domain.

                        `minLength: 1`

                      - `value: string`

                        The secret value to inject for the domain.

                        `minLength: 1`, `maxLength: 10485760`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action?: "generate" | "edit" | "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background?: "transparent" | "opaque" | "auto"`

              Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
              `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
              Transparent backgrounds are available for supported GPT Image models. For
              `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
              using `transparent`, set the output format to `png` or `webp`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `complexity?: "low" | "medium" | "high"`

              Computation spent planning the image, independently of rendering quality.
              Overrides the outer response's `reasoning.effort` for image generation.
              When omitted, inherits a supported outer reasoning effort or uses the
              image model's configured default.
              For SVG output, controls the reference image, not the SVG author's
              reasoning.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `frame_count?: number`

              Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

              `minimum: 2`, `maximum: 16`

            - `frame_duration_ms?: number`

              Duration of each GIF frame in milliseconds, rounded to 10 ms.
              Requires `output_format` to be `gif`. Default: 200.

              `minimum: 20`, `maximum: 2000`

            - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

              - `"high"`

              - `"low"`

            - `input_image_mask?: InputImageMask`

              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" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              Deprecated values:

              - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

              - `(string & {})`

              - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                - `"gpt-image-1"`

                - `"gpt-image-1-mini"`

                - `"gpt-image-2"`

                - `"gpt-image-2-2026-04-21"`

                - `"gpt-image-2.5-sunburst"`

                - `"gpt-image-2.5-sunburst-2026-09-08"`

                - `"gpt-image-2.5-flare"`

                - `"gpt-image-2.5-flare-2026-09-08"`

                - `"gpt-image-2.6-sunburst"`

                - `"gpt-image-2.6-flare"`

                - `"gpt-image-1.5"`

                - `"chatgpt-image-latest"`

            - `moderation?: "auto" | "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression?: number`

              Compression level for the output image. Default: 100.

              `minimum: 0`, `maximum: 100`

            - `output_format?: "png" | "webp" | "jpeg" | 2 more`

              The output format of the generated image. One of `png`, `webp`, `jpeg`,
              `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
              that supports the selected format. GIF output does not support
              partial image streaming (`partial_images` greater than `0`),
              `input_image_mask`, or custom `output_compression`.
              Responses lifecycle events can still be streamed for GIF output.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

              - `"gif"`

              - `"svg"`

            - `partial_images?: number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              `minimum: 0`, `maximum: 3`

            - `quality?: "low" | "medium" | "high" | 3 more`

              The quality of the generated image. The GPT image models support `low`,
              `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
              including their `2026-09-08` snapshots, also support `xhigh` and `max`.
              Default: `auto`.

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

              - `"auto"`

            - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

              - `(string & {})`

              - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

            - `svg?: Svg`

              SVG author model settings. Requires `output_format` to be `svg`.
              When SVG model selection is enabled, omitting this object uses the
              outer response model. Otherwise, the default SVG author is used and
              explicit model overrides are unavailable.

              - `model?: string`

                `minLength: 1`

              - `reasoning?: Reasoning | null`

                Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                - `effort?: "none" | "minimal" | "low" | 4 more`

                  Controls how much effort the model should spend on reasoning for this request.

                  - `"none"`

                  - `"minimal"`

                  - `"low"`

                  - `"medium"`

                  - `"high"`

                  - `"xhigh"`

                  - `"max"`

          - `LocalShell`

            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`.

              - `"local_shell"`

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

              - `BetaContainerAuto`

                - `type: "container_auto"`

                  Automatically creates a container for this request

                  - `"container_auto"`

                - `file_ids?: Array<string>`

                  An optional list of uploaded files to make available to your code.

                  `maxItems: 50`

                - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                  The memory limit for the container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                  - `BetaContainerNetworkPolicyAllowlist`

                - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

                  An optional list of skills referenced by id or inline data.

                  `maxItems: 200`

                  - `BetaSkillReference`

                    - `skill_id: string`

                      The ID of the referenced skill.

                      `minLength: 1`, `maxLength: 64`

                    - `type: "skill_reference"`

                      References a skill created with the /v1/skills endpoint.

                      - `"skill_reference"`

                    - `version?: string`

                      Optional skill version. Use a positive integer or 'latest'. Omit for default.

                  - `BetaInlineSkill`

                    - `description: string`

                      The description of the skill.

                    - `name: string`

                      The name of the skill.

                    - `source: BetaInlineSkillSource`

                      Inline skill payload

                      - `data: string`

                        Base64-encoded skill zip bundle.

                        `minLength: 1`, `maxLength: 70254592`

                      - `media_type: "application/zip"`

                        The media type of the inline skill payload. Must be `application/zip`.

                        - `"application/zip"`

                      - `type: "base64"`

                        The type of the inline skill source. Must be `base64`.

                        - `"base64"`

                    - `type: "inline"`

                      Defines an inline skill for this request.

                      - `"inline"`

              - `BetaLocalEnvironment`

                - `type: "local"`

                  Use a local computer environment.

                  - `"local"`

                - `skills?: Array<BetaLocalSkill>`

                  An optional list of skills.

                  `maxItems: 200`

                  - `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: string`

                  The ID of the referenced container.

                - `type: "container_reference"`

                  References a container created with the /v1/containers endpoint

                  - `"container_reference"`

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

              - `"custom"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `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 | Grammar`

              The input format for the custom tool. Default is unconstrained text.

              - `Text`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar`

                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`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `BetaToolSearchOutputNamespaceTool`

            Groups function/custom tools under a shared namespace.

            - `description: string`

              A description of the namespace shown to the model.

            - `name: string`

              The namespace name used in tool calls (for example, `crm`).

              `minLength: 1`

            - `tools: Array<Function | BetaCustomTool>`

              The function/custom tools loaded inside this namespace.

              `minItems: 1`

              - `Function`

                - `name: string`

                  The name of the loaded function tool.

                  `minLength: 1`, `maxLength: 128`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                  The tool invocation context(s).

                  `minItems: 1`

                  - `"direct"`

                  - `"programmatic"`

                - `async?: boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `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`

                A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `type: "namespace"`

              The type of the tool. Always `namespace`.

              - `"namespace"`

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"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.

              - `"server"`

              - `"client"`

            - `parameters?: unknown`

              Parameter schema for a client-executed tool search tool.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `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`.

              - `"web_search_preview"`

              - `"web_search_preview_2025_03_11"`

            - `search_content_types?: Array<"text" | "image">`

              - `"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.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `user_location?: UserLocation | null`

              The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

              - `type: "approximate"`

                The type of location approximation. Always `approximate`.

                - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The item type. Always `tool_search_output`.

          - `"tool_search_output"`

        - `id?: string | null`

          The unique ID of this tool search output.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id?: string | null`

          The unique ID of the tool search call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `execution?: "server" | "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the tool search output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AdditionalTools`

        - `role: "developer"`

          The role that provided the additional tools. Only `developer` is supported.

          - `"developer"`

        - `tools: Array<BetaTool>`

          A list of additional tools made available at this item.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

              - `"mcp"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools?: Array<string> | McpToolFilter | null`

              List of allowed tool names or a filter object.

              - `Array<string>`

              - `McpToolFilter`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

              This field is deprecated for models released after September 1, 2026.
              Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
              connect through a Secure MCP Tunnel.

              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`

              - `"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" | null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter`

                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`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                    it will match this filter.

                  - `tool_names?: Array<string>`

                    List of allowed tool names.

                - `never?: Never`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

              `format: uri`

            - `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`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string | CodeInterpreterToolAuto`

              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.

              - `string`

              - `CodeInterpreterToolAuto`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids?: Array<string>`

                  An optional list of uploaded files to make available to your code.

                  `maxItems: 50`

                - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled`

                  - `BetaContainerNetworkPolicyAllowlist`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action?: "generate" | "edit" | "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background?: "transparent" | "opaque" | "auto"`

              Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
              `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
              Transparent backgrounds are available for supported GPT Image models. For
              `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
              using `transparent`, set the output format to `png` or `webp`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `complexity?: "low" | "medium" | "high"`

              Computation spent planning the image, independently of rendering quality.
              Overrides the outer response's `reasoning.effort` for image generation.
              When omitted, inherits a supported outer reasoning effort or uses the
              image model's configured default.
              For SVG output, controls the reference image, not the SVG author's
              reasoning.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `frame_count?: number`

              Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

              `minimum: 2`, `maximum: 16`

            - `frame_duration_ms?: number`

              Duration of each GIF frame in milliseconds, rounded to 10 ms.
              Requires `output_format` to be `gif`. Default: 200.

              `minimum: 20`, `maximum: 2000`

            - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

              - `"high"`

              - `"low"`

            - `input_image_mask?: InputImageMask`

              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" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              Deprecated values:

              - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

              - `(string & {})`

              - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                - `"gpt-image-1"`

                - `"gpt-image-1-mini"`

                - `"gpt-image-2"`

                - `"gpt-image-2-2026-04-21"`

                - `"gpt-image-2.5-sunburst"`

                - `"gpt-image-2.5-sunburst-2026-09-08"`

                - `"gpt-image-2.5-flare"`

                - `"gpt-image-2.5-flare-2026-09-08"`

                - `"gpt-image-2.6-sunburst"`

                - `"gpt-image-2.6-flare"`

                - `"gpt-image-1.5"`

                - `"chatgpt-image-latest"`

            - `moderation?: "auto" | "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression?: number`

              Compression level for the output image. Default: 100.

              `minimum: 0`, `maximum: 100`

            - `output_format?: "png" | "webp" | "jpeg" | 2 more`

              The output format of the generated image. One of `png`, `webp`, `jpeg`,
              `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
              that supports the selected format. GIF output does not support
              partial image streaming (`partial_images` greater than `0`),
              `input_image_mask`, or custom `output_compression`.
              Responses lifecycle events can still be streamed for GIF output.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

              - `"gif"`

              - `"svg"`

            - `partial_images?: number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              `minimum: 0`, `maximum: 3`

            - `quality?: "low" | "medium" | "high" | 3 more`

              The quality of the generated image. The GPT image models support `low`,
              `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
              including their `2026-09-08` snapshots, also support `xhigh` and `max`.
              Default: `auto`.

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

              - `"auto"`

            - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

              - `(string & {})`

              - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

            - `svg?: Svg`

              SVG author model settings. Requires `output_format` to be `svg`.
              When SVG model selection is enabled, omitting this object uses the
              outer response model. Otherwise, the default SVG author is used and
              explicit model overrides are unavailable.

              - `model?: string`

                `minLength: 1`

              - `reasoning?: Reasoning | null`

                Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                - `effort?: "none" | "minimal" | "low" | 4 more`

                  Controls how much effort the model should spend on reasoning for this request.

                  - `"none"`

                  - `"minimal"`

                  - `"low"`

                  - `"medium"`

                  - `"high"`

                  - `"xhigh"`

                  - `"max"`

          - `LocalShell`

            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`.

              - `"local_shell"`

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

            - `description: string`

              A description of the namespace shown to the model.

            - `name: string`

              The namespace name used in tool calls (for example, `crm`).

              `minLength: 1`

            - `tools: Array<Function | BetaCustomTool>`

              The function/custom tools available inside this namespace.

              `minItems: 1`

              - `Function`

                - `name: string`

                  `minLength: 1`, `maxLength: 128`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                  The tool invocation context(s).

                  `minItems: 1`

                  - `"direct"`

                  - `"programmatic"`

                - `async?: boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `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`

                A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `type: "namespace"`

              The type of the tool. Always `namespace`.

              - `"namespace"`

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "additional_tools"`

          The item type. Always `additional_tools`.

          - `"additional_tools"`

        - `id?: string | null`

          The unique ID of this additional tools item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseConfigurationUpdateItemParam`

        An update to the conversation's response configuration. Supply reasoning,
        text, or both. Each setting stays in effect until a later update replaces it.

        - `type: "configuration_update"`

          The item type. Always `configuration_update`.

          - `"configuration_update"`

        - `id?: string | null`

          The unique ID of the configuration update item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reasoning?: Reasoning`

          Updates to reasoning configuration. Only effort is supported.

          - `effort?: "none" | "minimal" | "low" | 4 more | null`

            The reasoning effort to use for subsequent responses until another
            configuration update replaces it.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

        - `text?: Text`

          The text output configuration for subsequent responses.

          - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

            Use a JSON schema for structured output or text to return to plain text.

            - `Text`

              Default response format. Used to generate text responses.

              - `type: "text"`

                The type of response format being defined. Always `text`.

                - `"text"`

            - `BetaResponseFormatTextJSONSchemaConfig`

              JSON Schema response format. Used to generate structured JSON responses.
              Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

              - `name: string`

                The name of the response format. Must be a-z, A-Z, 0-9, or contain
                underscores and dashes, with a maximum length of 64.

              - `schema: Record<string, unknown>`

                The schema for the response format, described as a JSON Schema object.
                Learn how to build JSON schemas [here](https://json-schema.org/).

              - `type: "json_schema"`

                The type of response format being defined. Always `json_schema`.

                - `"json_schema"`

              - `description?: string`

                A description of what the response format is for, used by the model to
                determine how to respond in the format.

              - `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](/api/docs/guides/structured-outputs).

      - `BetaResponseReasoningItem`

        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](/api/docs/guides/conversation-state).

        - `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`.

            - `"summary_text"`

        - `type: "reasoning"`

          The type of the object. Always `reasoning`.

          - `"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`.

            - `"reasoning_text"`

        - `encrypted_content?: string | null`

          The encrypted content of the reasoning item. This is populated by default
          for reasoning items returned by `POST /v1/responses` and WebSocket
          `response.create` requests.

          When streaming, use the completed reasoning item and its
          `encrypted_content` from the `response.output_item.done` event in
          subsequent requests. The `encrypted_content` in
          `response.output_item.added` may be incomplete. This is especially
          important when `store` is `false` or when using Zero Data Retention.

        - `status?: "in_progress" | "completed" | "incomplete"`

          The status of the item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseCompactionItemParam`

        A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

        - `encrypted_content: string`

          The encrypted content of the compaction summary.

          `maxLength: 104857600`

        - `type: "compaction"`

          The type of the item. Always `compaction`.

          - `"compaction"`

        - `id?: string | null`

          The ID of the compaction item.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ImageGenerationCall`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"generating"`

          - `"failed"`

        - `type: "image_generation_call"`

          The type of the image generation call. Always `image_generation_call`.

          - `"image_generation_call"`

        - `action?: "generate" | "edit" | "auto" | null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background?: "transparent" | "opaque" | "auto" | null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error?: Error`

          Details of a moderation failure, when available.

          - `code: string | null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string | null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details?: ModerationDetails`

            Public details for a `moderation_blocked` error, when available.

            - `categories: Array<string>`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" | "output" | "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `quality?: "low" | "medium" | "high" | 3 more | null`

          The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `revised_prompt?: string | null`

          The prompt that was used after any model prompt rewriting.

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

        - `svg_usage?: SvgUsage`

          - `input_tokens: number`

          - `model: string`

          - `output_tokens: number`

          - `reasoning_tokens: number`

          - `total_tokens: number`

      - `BetaResponseCodeInterpreterToolCall`

        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 | Image> | null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs`

            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`.

              - `"logs"`

          - `Image`

            The image output from the code interpreter.

            - `type: "image"`

              The type of the output. Always `image`.

              - `"image"`

            - `url: string`

              The URL of the image output from the code interpreter.

              `format: uri`

        - `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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"interpreting"`

          - `"failed"`

        - `type: "code_interpreter_call"`

          The type of the code interpreter tool call. Always `code_interpreter_call`.

          - `"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`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: Action`

          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`.

            - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "local_shell_call"`

          The type of the local shell call. Always `local_shell_call`.

          - `"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`

        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`.

          - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall`

        A tool representing a request to execute one or more shell commands.

        - `action: Action`

          The shell commands and limits that describe how to run the tool call.

          - `commands: Array<string>`

            Ordered shell commands for the execution environment to run.

          - `max_output_length?: number | null`

            Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

          - `timeout_ms?: number | null`

            Maximum wall-clock time in milliseconds to allow the shell commands to run.

        - `call_id: string`

          The unique ID of the shell tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `id?: string | null`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

          The environment to execute the shell commands in.

          - `BetaLocalEnvironment`

          - `BetaContainerReference`

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCallOutput`

        The streamed output items emitted by a shell tool call.

        - `call_id: string`

          The unique ID of the shell tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `output: Array<BetaResponseFunctionShellCallOutputContent>`

          Captured chunks of stdout and stderr output, along with their associated outcomes.

          - `outcome: Timeout | Exit`

            The exit or timeout outcome associated with this shell call.

            - `Timeout`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit`

              Indicates that the shell commands finished and returned an exit code.

              - `exit_code: number`

                The exit code returned by the shell process.

              - `type: "exit"`

                The outcome type. Always `exit`.

                - `"exit"`

          - `stderr: string`

            Captured stderr output for the shell call.

            `maxLength: 10485760`

          - `stdout: string`

            Captured stdout output for the shell call.

            `maxLength: 10485760`

        - `type: "shell_call_output"`

          The type of the item. Always `shell_call_output`.

          - `"shell_call_output"`

        - `id?: string | null`

          The unique ID of the shell tool call output. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `max_output_length?: number | null`

          The maximum number of UTF-8 characters captured for this shell call's combined output.

        - `status?: "in_progress" | "completed" | "incomplete" | null`

          The status of the shell call output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ApplyPatchCall`

        A tool call representing a request to create, delete, or update files using diff patches.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `operation: CreateFile | DeleteFile | UpdateFile`

          The specific create, delete, or update instruction for the apply_patch tool call.

          - `CreateFile`

            Instruction for creating a new file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply when creating the file.

              `maxLength: 10485760`

            - `path: string`

              Path of the file to create relative to the workspace root.

              `minLength: 1`

            - `type: "create_file"`

              The operation type. Always `create_file`.

              - `"create_file"`

          - `DeleteFile`

            Instruction for deleting an existing file via the apply_patch tool.

            - `path: string`

              Path of the file to delete relative to the workspace root.

              `minLength: 1`

            - `type: "delete_file"`

              The operation type. Always `delete_file`.

              - `"delete_file"`

          - `UpdateFile`

            Instruction for updating an existing file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply to the existing file.

              `maxLength: 10485760`

            - `path: string`

              Path of the file to update relative to the workspace root.

              `minLength: 1`

            - `type: "update_file"`

              The operation type. Always `update_file`.

              - `"update_file"`

        - `status: "in_progress" | "completed"`

          The status of the apply patch tool call. One of `in_progress` or `completed`.

          - `"in_progress"`

          - `"completed"`

        - `type: "apply_patch_call"`

          The type of the item. Always `apply_patch_call`.

          - `"apply_patch_call"`

        - `id?: string | null`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `ApplyPatchCallOutput`

        The streamed output emitted by an apply patch tool call.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

          `minLength: 1`, `maxLength: 64`

        - `status: "completed" | "failed"`

          The status of the apply patch tool call output. One of `completed` or `failed`.

          - `"completed"`

          - `"failed"`

        - `type: "apply_patch_call_output"`

          The type of the item. Always `apply_patch_call_output`.

          - `"apply_patch_call_output"`

        - `id?: string | null`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `output?: string | null`

          Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

          `maxLength: 10485760`

      - `McpListTools`

        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`.

          - `"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`

        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`.

          - `"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`

        A response to an MCP approval request.

        - `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`.

          - `"mcp_approval_response"`

        - `id?: string | null`

          The unique ID of the 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.

      - `McpCall`

        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`.

          - `"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?: BetaMcpToolCallError | null`

          The error from the tool call, if any.

          - `McpProtocolError`

            - `code: number`

            - `message: string`

            - `type: "mcp_protocol_error"`

              - `"mcp_protocol_error"`

          - `McpToolExecutionError`

            - `content: unknown`

            - `type: "mcp_tool_execution_error"`

              - `"mcp_tool_execution_error"`

          - `HTTPError`

            - `code: number`

            - `message: string`

            - `type: "http_error"`

              - `"http_error"`

        - `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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `BetaResponseCustomToolCallOutput`

        The output of a custom tool call from your code, being sent back to the model.

        - `call_id: string`

          The call ID, used to map this custom tool call output to a custom tool call.

        - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `string`

          - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            - `BetaResponseInputText`

              A text input to the model.

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile`

              A file input to the model.

        - `type: "custom_tool_call_output"`

          The type of the custom tool call output. Always `custom_tool_call_output`.

          - `"custom_tool_call_output"`

        - `id?: string`

          The unique ID of the custom tool call output 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 | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `BetaResponseCustomToolCall`

        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`.

          - `"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.

        - `async?: boolean`

          Whether the custom tool call runs asynchronously.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace?: string`

          The namespace of the custom tool being called.

      - `CompactionTrigger`

        Compacts the current context. Must be the final input item.

        - `type: "compaction_trigger"`

          The type of the item. Always `compaction_trigger`.

          - `"compaction_trigger"`

        - `id?: string | null`

          The unique ID of this compaction trigger.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ItemReference`

        An internal identifier for an item to reference.

        - `id: string`

          The ID of the item to reference.

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `type?: "item_reference" | null`

          The type of item to reference. Always `item_reference`.

          - `"item_reference"`

      - `Program`

        - `id: string`

          The unique ID of this program item.

        - `call_id: string`

          The stable call ID of the program item.

          `minLength: 1`, `maxLength: 64`

        - `code: string`

          The JavaScript source executed by programmatic tool calling.

          `maxLength: 10485760`

        - `fingerprint: string`

          Opaque program replay fingerprint that must be round-tripped.

          `maxLength: 10485760`

        - `type: "program"`

          The item type. Always `program`.

          - `"program"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput`

        - `id: string`

          The unique ID of this program output item.

        - `call_id: string`

          The call ID of the program item.

          `minLength: 1`, `maxLength: 64`

        - `result: string`

          The result produced by the program item.

          `maxLength: 10485760`

        - `status: "completed" | "incomplete"`

          The terminal status of the program output.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The item type. Always `program_output`.

          - `"program_output"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

  - `metadata: Record<string, string> | 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: "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more | (string & {})`

    Model ID used to generate the response, like `gpt-6-astra`. OpenAI
    offers a wide range of models with different capabilities, performance
    characteristics, and price points. Refer to the [model guide](/api/docs/models)
    to browse and compare available models.

    Deprecated values:

    - "gpt-5.4-nano", "gpt-5.4-nano-2026-03-17", "gpt-5.1", "gpt-5.1-2025-11-13": Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-5.3-chat-latest", "gpt-5.2-chat-latest": Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-5.1-codex", "gpt-5.1-chat-latest", "gpt-5-chat-latest", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", "o3-deep-research", "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5-codex", "gpt-5.1-codex-max": Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-5.1-mini": Not a supported model ID. Retained for SDK compatibility.
    - "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "o3", "o3-2025-04-16", "o3-pro", "o3-pro-2025-06-10", "gpt-5-pro", "gpt-5-pro-2025-10-06": Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-mini", "gpt-4o-mini-2024-07-18": Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4.1-nano", "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3-mini", "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "gpt-4o-2024-05-13", "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-1106-preview", "gpt-4", "gpt-4-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-0125", "o1-pro", "o1-pro-2025-03-19": Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "o1-preview", "o1-preview-2024-09-12": Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "o1-mini", "o1-mini-2024-09-12": Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-audio-mini", "gpt-audio-mini-2025-12-15": Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-12-17", "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", "gpt-4o-mini-audio-preview-2024-12-17": Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4o-audio-preview-2024-10-01": Announced shutdown date: 2025-10-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "chatgpt-4o-latest": Announced shutdown date: 2026-02-17. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "codex-mini-latest": Announced shutdown date: 2026-02-12. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4-0125-preview", "gpt-4-turbo-preview", "gpt-4-0314": Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4-vision-preview": Announced shutdown date: 2024-12-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-0613": Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k-0613": Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
    - "gpt-3.5-turbo-1106": Announced shutdown date: 2026-09-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.

    - `"gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more`

      Model ID used to generate the response, like `gpt-6-astra`. OpenAI
      offers a wide range of models with different capabilities, performance
      characteristics, and price points. Refer to the [model guide](/api/docs/models)
      to browse and compare available models.

      - `"gpt-6-astra"`

      - `"gpt-6.1-sol"`

      - `"gpt-6.1-terra"`

      - `"gpt-6-sol"`

      - `"gpt-6-luna"`

      - `"gpt-5.6-sol"`

      - `"gpt-5.6-terra"`

      - `"gpt-5.6-luna"`

      - `"gpt-5.5"`

      - `"gpt-5.5-2026-04-23"`

      - `"gpt-5.4"`

      - `"gpt-5.4-mini"`

      - `"gpt-5.4-nano"`

      - `"gpt-5.4-mini-2026-03-17"`

      - `"gpt-5.4-nano-2026-03-17"`

      - `"gpt-5.3-chat-latest"`

      - `"gpt-5.2"`

      - `"gpt-5.2-2025-12-11"`

      - `"gpt-5.2-chat-latest"`

      - `"gpt-5.2-pro"`

      - `"gpt-5.2-pro-2025-12-11"`

      - `"gpt-5.1"`

      - `"gpt-5.1-2025-11-13"`

      - `"gpt-5.1-codex"`

      - `"gpt-5.1-mini"`

      - `"gpt-5.1-chat-latest"`

      - `"gpt-5"`

      - `"gpt-5-mini"`

      - `"gpt-5-nano"`

      - `"gpt-5-2025-08-07"`

      - `"gpt-5-mini-2025-08-07"`

      - `"gpt-5-nano-2025-08-07"`

      - `"gpt-5-chat-latest"`

      - `"gpt-4.1"`

      - `"gpt-4.1-mini"`

      - `"gpt-4.1-nano"`

      - `"gpt-4.1-2025-04-14"`

      - `"gpt-4.1-mini-2025-04-14"`

      - `"gpt-4.1-nano-2025-04-14"`

      - `"o4-mini"`

      - `"o4-mini-2025-04-16"`

      - `"o3"`

      - `"o3-2025-04-16"`

      - `"o3-mini"`

      - `"o3-mini-2025-01-31"`

      - `"o1"`

      - `"o1-2024-12-17"`

      - `"o1-preview"`

      - `"o1-preview-2024-09-12"`

      - `"o1-mini"`

      - `"o1-mini-2024-09-12"`

      - `"gpt-4o"`

      - `"gpt-4o-2024-11-20"`

      - `"gpt-4o-2024-08-06"`

      - `"gpt-4o-2024-05-13"`

      - `"gpt-audio-mini"`

      - `"gpt-audio-mini-2025-12-15"`

      - `"gpt-4o-audio-preview"`

      - `"gpt-4o-audio-preview-2024-10-01"`

      - `"gpt-4o-audio-preview-2024-12-17"`

      - `"gpt-4o-audio-preview-2025-06-03"`

      - `"gpt-4o-mini-audio-preview"`

      - `"gpt-4o-mini-audio-preview-2024-12-17"`

      - `"gpt-4o-search-preview"`

      - `"gpt-4o-mini-search-preview"`

      - `"gpt-4o-search-preview-2025-03-11"`

      - `"gpt-4o-mini-search-preview-2025-03-11"`

      - `"chatgpt-4o-latest"`

      - `"codex-mini-latest"`

      - `"gpt-4o-mini"`

      - `"gpt-4o-mini-2024-07-18"`

      - `"gpt-4-turbo"`

      - `"gpt-4-turbo-2024-04-09"`

      - `"gpt-4-0125-preview"`

      - `"gpt-4-turbo-preview"`

      - `"gpt-4-1106-preview"`

      - `"gpt-4-vision-preview"`

      - `"gpt-4"`

      - `"gpt-4-0314"`

      - `"gpt-4-0613"`

      - `"gpt-4-32k"`

      - `"gpt-4-32k-0314"`

      - `"gpt-4-32k-0613"`

      - `"gpt-3.5-turbo"`

      - `"gpt-3.5-turbo-16k"`

      - `"gpt-3.5-turbo-0301"`

      - `"gpt-3.5-turbo-0613"`

      - `"gpt-3.5-turbo-1106"`

      - `"gpt-3.5-turbo-0125"`

      - `"gpt-3.5-turbo-16k-0613"`

      - `"o1-pro"`

      - `"o1-pro-2025-03-19"`

      - `"o3-pro"`

      - `"o3-pro-2025-06-10"`

      - `"o3-deep-research"`

      - `"o3-deep-research-2025-06-26"`

      - `"o4-mini-deep-research"`

      - `"o4-mini-deep-research-2025-06-26"`

      - `"computer-use-preview"`

      - `"computer-use-preview-2025-03-11"`

      - `"gpt-5.5-pro"`

      - `"gpt-5.5-pro-2026-04-23"`

      - `"gpt-5-codex"`

      - `"gpt-5-pro"`

      - `"gpt-5-pro-2025-10-06"`

      - `"gpt-5.1-codex-max"`

      - `"gpt-daybreak-blue-latest"`

      - `"gpt-daybreak-red-latest"`

      - `"gpt-5.6-cyber"`

      - `"gpt-6-cyber"`

      - `"gpt-rosalind-research"`

      - `"gpt-6-rosalind"`

    - `(string & {})`

  - `object: "response"`

    The object type of this resource - always set to `response`.

    - `"response"`

  - `output: Array<BetaResponseOutputItem>`

    An array of content items generated by the model.

    - The length and order of items in the `output` array is dependent
      on the model's response.
    - Rather than accessing the first item in the `output` array and
      assuming it's an `assistant` message with the content generated by
      the model, you might consider using the `output_text` property where
      supported in SDKs.

    - `BetaResponseOutputMessage`

      An output message from the model.

    - `BetaResponseFileSearchToolCall`

      The results of a file search tool call. See the
      [file search guide](/api/docs/guides/tools-file-search) for more information.

    - `BetaResponseFunctionToolCall`

      A tool call to run a function. See the
      [function calling guide](/api/docs/guides/function-calling) for more information.

    - `BetaResponseFunctionToolCallOutputItem`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `string`

        - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          - `BetaResponseInputText`

            A text input to the model.

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile`

            A file input to the model.

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "function_call_output"`

        The type of the function tool call output. Always `function_call_output`.

        - `"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.

      - `call_id?: string`

        The unique ID of the function tool call generated by the model.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

      - `name?: string`

        The name of the tool that produced the output.

      - `namespace?: string`

        The namespace of the tool that produced the output.

    - `AgentMessage`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

        Encrypted content sent between agents.

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseOutputText`

          A text output from the model.

        - `Text`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText`

          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`.

            - `"summary_text"`

        - `ReasoningText`

          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`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal`

          A refusal from the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot`

          A screenshot of a computer.

          - `detail: BetaImageDetail`

            The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

          - `file_id: string | null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string | null`

            The URL of the screenshot image.

            `format: uri`

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputFile`

          A file input to the model.

        - `EncryptedContent`

          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`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall`

      - `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.

        - `"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`.

        - `"multi_agent_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput`

      - `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.

        - `"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>`

        Text output returned by the multi-agent action.

        - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

          The annotations of the text output.

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

        - `logprobs?: Array<Logprob>`

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseFunctionWebSearch`

      The results of a web search tool call. See the
      [web search guide](/api/docs/guides/tools-web-search) for more information.

    - `BetaResponseComputerToolCall`

      A tool call to a computer use tool. See the
      [computer use guide](/api/docs/guides/tools-computer-use) for more information.

    - `BetaResponseComputerToolCallOutputItem`

      - `id: string`

        The ID of the computer tool call output.

      - `call_id: string`

        The ID of the computer tool call that produced the output.

      - `output: BetaResponseComputerToolCallOutputScreenshot`

        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.

        - `"completed"`

        - `"incomplete"`

        - `"failed"`

        - `"in_progress"`

      - `type: "computer_call_output"`

        The type of the computer tool call output. Always `computer_call_output`.

        - `"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`

      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](/api/docs/guides/conversation-state).

    - `Program`

      - `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`.

        - `"program"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput`

      - `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.

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The type of the item. Always `program_output`.

        - `"program_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseToolSearchCall`

      - `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.

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the tool search call item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "tool_search_call"`

        The type of the item. Always `tool_search_call`.

        - `"tool_search_call"`

      - `agent?: Agent`

        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: 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.

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: Array<BetaTool>`

        The loaded tool definitions returned by tool search.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

        - `BetaFileSearchTool`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `BetaComputerTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

        - `CodeInterpreter`

          A tool that runs Python code to help generate a response to a prompt.

        - `ProgrammaticToolCalling`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

        - `LocalShell`

          A tool that allows the model to execute shell commands in a local environment.

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `BetaApplyPatchTool`

          Allows the assistant to create, delete, or update files using unified diffs.

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent?: Agent`

        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: string`

        The unique ID of the additional tools item.

      - `role: "unknown" | "user" | "assistant" | 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: Array<BetaTool>`

        The additional tool definitions made available at this item.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

        - `BetaFileSearchTool`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `BetaComputerTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

        - `CodeInterpreter`

          A tool that runs Python code to help generate a response to a prompt.

        - `ProgrammaticToolCalling`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

        - `LocalShell`

          A tool that allows the model to execute shell commands in a local environment.

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `BetaApplyPatchTool`

          Allows the assistant to create, delete, or update files using unified diffs.

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseCompactionItem`

      A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

      - `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`.

        - `"compaction"`

      - `agent?: Agent`

        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`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"generating"`

        - `"failed"`

      - `type: "image_generation_call"`

        The type of the image generation call. Always `image_generation_call`.

        - `"image_generation_call"`

      - `action?: "generate" | "edit" | "auto" | null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background?: "transparent" | "opaque" | "auto" | null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error?: Error`

        Details of a moderation failure, when available.

        - `code: string | null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string | null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details?: ModerationDetails`

          Public details for a `moderation_blocked` error, when available.

          - `categories: Array<string>`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" | "output" | "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

        - `"gif"`

        - `"svg"`

      - `quality?: "low" | "medium" | "high" | 3 more | null`

        The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

        - `"auto"`

      - `revised_prompt?: string | null`

        The prompt that was used after any model prompt rewriting.

      - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `(string & {})`

        - `"1024x1024" | "1024x1536" | "1536x1024"`

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

      - `svg_usage?: SvgUsage`

        - `input_tokens: number`

        - `model: string`

        - `output_tokens: number`

        - `reasoning_tokens: number`

        - `total_tokens: number`

    - `BetaResponseCodeInterpreterToolCall`

      A tool call to run code.

    - `LocalShellCall`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: Action`

        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`.

          - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "local_shell_call"`

        The type of the local shell call. Always `local_shell_call`.

        - `"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`

      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`.

        - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseFunctionShellToolCall`

      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`

        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 | BetaResponseContainerReference | null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "shell_call"`

        The type of the item. Always `shell_call`.

        - `"shell_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The ID of the entity that created this tool call.

    - `BetaResponseFunctionShellToolCallOutput`

      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 | Exit`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit`

            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`.

              - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "shell_call_output"`

        The type of the shell call output. Always `shell_call_output`.

        - `"shell_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

    - `BetaResponseApplyPatchToolCall`

      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 | DeleteFile | UpdateFile`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile`

          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.

            - `"create_file"`

        - `DeleteFile`

          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.

            - `"delete_file"`

        - `UpdateFile`

          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.

            - `"update_file"`

      - `status: "in_progress" | "completed"`

        The status of the apply patch tool call. One of `in_progress` or `completed`.

        - `"in_progress"`

        - `"completed"`

      - `type: "apply_patch_call"`

        The type of the item. Always `apply_patch_call`.

        - `"apply_patch_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The ID of the entity that created this tool call.

    - `BetaResponseApplyPatchToolCallOutput`

      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`.

        - `"completed"`

        - `"failed"`

      - `type: "apply_patch_call_output"`

        The type of the item. Always `apply_patch_call_output`.

        - `"apply_patch_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"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`

      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`.

        - `"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?: BetaMcpToolCallError | 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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `McpListTools`

      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`.

        - `"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`

      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`.

        - `"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`

      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`.

        - `"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`

      A call to a custom tool created by the model.

    - `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `created_by?: string`

        The identifier of the actor that created the item.

  - `parallel_tool_calls: boolean`

    Whether to allow the model to run tool calls in parallel.

  - `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.
    We generally recommend altering this or `top_p` but not both.

    `minimum: 0`, `maximum: 2`

  - `tool_choice: BetaToolChoiceOptions | BetaToolChoiceAllowed | BetaToolChoiceTypes | 6 more`

    How the model should select which tool (or tools) to use when generating
    a response. See the `tools` parameter to see how to specify which tools
    the model can call.

    - `BetaToolChoiceOptions = "none" | "auto" | "required"`

      Controls which (if any) tool is called by the model.

      `none` means the model will not call any tool and instead generates a message.

      `auto` means the model can pick between generating a message or calling one or
      more tools.

      `required` means the model must call one or more tools.

      - `"none"`

      - `"auto"`

      - `"required"`

    - `BetaToolChoiceAllowed`

      Constrains the tools available to the model to a pre-defined set.

      - `mode: "auto" | "required"`

        Constrains the tools available to the model to a pre-defined set.

        `auto` allows the model to pick from among the allowed tools and generate a
        message.

        `required` requires the model to call one or more of the allowed tools.

        - `"auto"`

        - `"required"`

      - `tools: Array<Record<string, unknown>>`

        A list of tool definitions that the model should be allowed to call.

        For the Responses API, the list of tool definitions might look like:

        ```json
        [
          { "type": "function", "name": "get_weather" },
          { "type": "mcp", "server_label": "deepwiki" },
          { "type": "image_generation" }
        ]
        ```

      - `type: "allowed_tools"`

        Allowed tool configuration type. Always `allowed_tools`.

        - `"allowed_tools"`

    - `BetaToolChoiceTypes`

      Indicates that the model should use a built-in tool to generate a response.
      [Learn more about built-in tools](/api/docs/guides/tools).

      - `type: "file_search" | "web_search_preview" | "computer" | 5 more`

        The type of hosted tool the model should to use. Learn more about
        [built-in tools](/api/docs/guides/tools).

        Allowed values are:

        - `file_search`
        - `web_search_preview`
        - `computer`
        - `computer_use_preview`
        - `computer_use`
        - `code_interpreter`
        - `image_generation`

        - `"file_search"`

        - `"web_search_preview"`

        - `"computer"`

        - `"computer_use_preview"`

        - `"computer_use"`

        - `"web_search_preview_2025_03_11"`

        - `"image_generation"`

        - `"code_interpreter"`

    - `BetaToolChoiceFunction`

      Use this option to force the model to call a specific function.

      - `name: string`

        The name of the function to call.

      - `type: "function"`

        For function calling, the type is always `function`.

        - `"function"`

    - `BetaToolChoiceMcp`

      Use this option to force the model to call a specific tool on a remote MCP server.

      - `server_label: string`

        The label of the MCP server to use.

      - `type: "mcp"`

        For MCP tools, the type is always `mcp`.

        - `"mcp"`

      - `name?: string | null`

        The name of the tool to call on the server.

    - `BetaToolChoiceCustom`

      Use this option to force the model to call a specific custom tool.

      - `name: string`

        The name of the custom tool to call.

      - `type: "custom"`

        For custom tool calling, the type is always `custom`.

        - `"custom"`

    - `BetaSpecificProgrammaticToolCallingParam`

      - `type: "programmatic_tool_calling"`

        The tool to call. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `BetaToolChoiceApplyPatch`

      Forces the model to call the apply_patch tool when executing a tool call.

      - `type: "apply_patch"`

        The tool to call. Always `apply_patch`.

        - `"apply_patch"`

    - `BetaToolChoiceShell`

      Forces the model to call the shell tool when a tool call is required.

      - `type: "shell"`

        The tool to call. Always `shell`.

        - `"shell"`

  - `tools: Array<BetaTool>`

    An array of tools the model may call while generating a response. You
    can specify which tool to use by setting the `tool_choice` parameter.

    We support the following categories of tools:

    - **Built-in tools**: Tools that are provided by OpenAI that extend the
      model's capabilities, like [web search](/api/docs/guides/tools-web-search)
      or [file search](/api/docs/guides/tools-file-search). Learn more about
      [built-in tools](/api/docs/guides/tools).
    - **MCP Tools**: Integrations with third-party systems via custom MCP servers
      or predefined connectors such as Google Drive and SharePoint. Learn more about
      [MCP Tools](/api/docs/guides/tools-connectors-mcp).
    - **Function calls (custom tools)**: Functions that are defined by you,
      enabling the model to call your own code with strongly typed arguments
      and outputs. Learn more about
      [function calling](/api/docs/guides/function-calling). You can also use
      custom tools to call your own code.

    - `BetaFunctionTool`

      Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

    - `BetaFileSearchTool`

      A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

    - `BetaComputerTool`

      A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

    - `BetaComputerUsePreviewTool`

      A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

    - `BetaWebSearchTool`

      Search the Internet for sources related to the prompt. Learn more about the
      [web search tool](/api/docs/guides/tools-web-search).

    - `Mcp`

      Give the model access to additional tools via remote Model Context Protocol
      (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

    - `CodeInterpreter`

      A tool that runs Python code to help generate a response to a prompt.

    - `ProgrammaticToolCalling`

    - `ImageGeneration`

      A tool that generates images using the GPT image models.

    - `LocalShell`

      A tool that allows the model to execute shell commands in a local environment.

    - `BetaFunctionShellTool`

      A tool that allows the model to execute shell commands.

    - `BetaCustomTool`

      A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

    - `BetaNamespaceTool`

      Groups function/custom tools under a shared namespace.

    - `BetaToolSearchTool`

      Hosted or BYOT tool search configuration for deferred tools.

    - `BetaWebSearchPreviewTool`

      This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

    - `BetaApplyPatchTool`

      Allows the assistant to create, delete, or update files using unified diffs.

  - `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.

    `minimum: 0`, `maximum: 1`

  - `background?: boolean | null`

    Whether to run the model response in the background.
    [Learn more](/api/docs/guides/background).

  - `completed_at?: number | null`

    Unix timestamp (in seconds) of when this Response was completed.
    Only present when the status is `completed`.

    `format: unixtime`

  - `conversation?: Conversation | null`

    The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation.

    - `id: string`

      The unique ID of the conversation that this response was associated with.

  - `image?: Image`

    - `context_compression: "enabled" | "disabled"`

      Effective image context optimization policy.

      - `"enabled"`

      - `"disabled"`

  - `max_output_tokens?: number | null`

    An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/api/docs/guides/reasoning).

  - `max_tool_calls?: number | null`

    The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

  - `moderation?: Moderation | null`

    Moderation results for the response input and output, if moderated completions were requested.

    - `input: ModerationResult | Error`

      Moderation for the response input.

      - `ModerationResult`

        A moderation result produced for the response input or output.

        - `categories: Record<string, boolean>`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: Record<string, Array<"text" | "image">>`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: Record<string, number>`

          A dictionary of moderation categories to scores.

        - `flagged: boolean`

          A boolean indicating whether the content was flagged by any category.

        - `model: string`

          The moderation model that produced this result.

        - `type: "moderation_result"`

          The object type, which was always `moderation_result` for successful moderation results.

          - `"moderation_result"`

      - `Error`

        An error produced while attempting moderation for the response input or output.

        - `code: string`

          The error code.

        - `message: string`

          The error message.

        - `type: "error"`

          The object type, which was always `error` for moderation failures.

          - `"error"`

    - `output: ModerationResult | Error`

      Moderation for the response output.

      - `ModerationResult`

        A moderation result produced for the response input or output.

        - `categories: Record<string, boolean>`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: Record<string, Array<"text" | "image">>`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: Record<string, number>`

          A dictionary of moderation categories to scores.

        - `flagged: boolean`

          A boolean indicating whether the content was flagged by any category.

        - `model: string`

          The moderation model that produced this result.

        - `type: "moderation_result"`

          The object type, which was always `moderation_result` for successful moderation results.

          - `"moderation_result"`

      - `Error`

        An error produced while attempting moderation for the response input or output.

        - `code: string`

          The error code.

        - `message: string`

          The error message.

        - `type: "error"`

          The object type, which was always `error` for moderation failures.

          - `"error"`

  - `previous_response_id?: string | null`

    The unique ID of the previous response to the model. Use this to
    create multi-turn conversations. Learn more about
    [conversation state](/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.

  - `prompt?: BetaResponsePrompt | null`

    Reference to a prompt template and its variables.
    [Learn more](/api/docs/guides/text?api-mode=responses#version-prompts-in-code).

    - `id: string`

      The unique identifier of the prompt template to use.

    - `variables?: Record<string, string | BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile> | null`

      Optional map of values to substitute in for variables in your
      prompt. The substitution values can either be strings, or other
      Response input types like images or files.

      - `string`

      - `BetaResponseInputText`

        A text input to the model.

      - `BetaResponseInputImage`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

      - `BetaResponseInputFile`

        A file input to the model.

    - `version?: string | null`

      Optional version of the prompt template.

  - `prompt_cache_diagnostics?: CacheMiss | CacheHit | ComparisonResponseNotFound | Unavailable`

    Prompt cache diagnostics requested for this response.

    - `CacheMiss`

      - `cache_missed_tokens: number`

        The estimated number of input tokens affected after the first detected divergence.

      - `reason: "model_changed" | "prompt_cache_key_changed" | "tools_changed" | 6 more`

        The reason prompt cache reuse did not occur.

        - `"model_changed"`

        - `"prompt_cache_key_changed"`

        - `"tools_changed"`

        - `"text_format_changed"`

        - `"reasoning_effort_changed"`

        - `"verbosity_changed"`

        - `"context_compacted"`

        - `"input_changed"`

        - `"service_tier_changed"`

      - `type: "cache_miss"`

        - `"cache_miss"`

      - `comparison_reusable_tokens?: number`

        The raw token count of the reusable prefix in the compared response.

    - `CacheHit`

      - `type: "cache_hit"`

        - `"cache_hit"`

    - `ComparisonResponseNotFound`

      - `type: "comparison_response_not_found"`

        - `"comparison_response_not_found"`

    - `Unavailable`

      - `type: "unavailable"`

        - `"unavailable"`

  - `prompt_cache_key?: string | null`

    Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/api/docs/guides/prompt-caching).

  - `prompt_cache_options?: PromptCacheOptions`

    The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

    - `mode: "implicit" | "explicit"`

      Whether implicit prompt-cache breakpoints were enabled.

      - `"implicit"`

      - `"explicit"`

    - `ttl: "30m" | "12h"`

      The minimum lifetime applied to each cache breakpoint.

      - `"30m"`

      - `"12h"`

    - `comparison_response_id?: string | null`

      The response ID supplied as the prompt cache diagnostics comparison.

  - `prompt_cache_retention?: "in_memory" | "24h" | null`

    Deprecated. Use `prompt_cache_options.ttl` instead.

    The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/api/docs/guides/prompt-caching#prompt-cache-retention).
    This field expresses a maximum retention policy, while
    `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two
    fields are independent and do not interact.
    For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported.

    For older models that support both `in_memory` and `24h`, the default depends on your organization's data retention policy:

    - Organizations without ZDR enabled default to `24h`.
    - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified.

    - `"in_memory"`

    - `"24h"`

  - `reasoning?: Reasoning | null`

    Configuration options for
    [reasoning models](/api/docs/guides/reasoning).

    - `context?: "auto" | "current_turn" | "all_turns" | null`

      Controls which reasoning items are rendered back to the model on later turns.
      If omitted or set to `auto`, the model determines the context mode. The
      `gpt-5.6` model family defaults to `all_turns`; earlier models default to
      `current_turn`.

      When returned on a response, this is the effective reasoning context mode
      used for the response.

      - `"auto"`

      - `"current_turn"`

      - `"all_turns"`

    - `effort?: "none" | "minimal" | "low" | 4 more | null`

      Constrains effort on reasoning for reasoning models. Currently supported
      values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
      Reducing reasoning effort can result in faster responses and fewer tokens
      used on reasoning in a response. Not all reasoning models support every
      value. See the
      [reasoning guide](/api/docs/guides/reasoning)
      for model-specific support.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `generate_summary?: "auto" | "concise" | "detailed" | null`

      **Deprecated:** use `summary` instead.

      A summary of the reasoning performed by the model. This can be
      useful for debugging and understanding the model's reasoning process.
      One of `auto`, `concise`, or `detailed`.

      - `"auto"`

      - `"concise"`

      - `"detailed"`

    - `mode?: (string & {}) | "standard" | "pro"`

      Controls the reasoning execution mode for the request.

      When returned on a response, this is the effective execution mode.

      - `(string & {})`

      - `"standard" | "pro"`

        - `"standard"`

        - `"pro"`

    - `summary?: "auto" | "concise" | "detailed" | null`

      A summary of the reasoning performed by the model. This can be
      useful for debugging and understanding the model's reasoning process.
      One of `auto`, `concise`, or `detailed`.

      `concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.

      - `"auto"`

      - `"concise"`

      - `"detailed"`

  - `safety_identifier?: string | null`

    A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.
    The IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

    `maxLength: 128`

  - `service_tier?: BetaServiceTier | null`

    Specifies the processing type used for serving the request.

    - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
    - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
    - If set to '[flex](/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.
    - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.
    - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for `gpt-5.6-sol`; a response served through it will show `service_tier=ultrafast`.
    - When not set, the default behavior is 'auto'.

    When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

    - `"auto"`

    - `"default"`

    - `"flex"`

    - `"scale"`

    - `"priority"`

    - `"fast"`

    - `"ultrafast"`

  - `status?: BetaResponseStatus`

    The status of the response generation. One of `completed`, `failed`,
    `in_progress`, `cancelled`, `queued`, or `incomplete`.

    - `"completed"`

    - `"failed"`

    - `"in_progress"`

    - `"cancelled"`

    - `"queued"`

    - `"incomplete"`

  - `text?: BetaResponseTextConfig`

    Configuration options for a text response from the model. Can be plain
    text or structured JSON data. Learn more:

    - [Text inputs and outputs](/api/docs/guides/text)
    - [Structured Outputs](/api/docs/guides/structured-outputs)

    - `format?: BetaResponseFormatTextConfig`

      An object specifying the format that the model must output.

      Configuring `{ "type": "json_schema" }` enables Structured Outputs,
      which ensures the model will match your supplied JSON schema. Learn more in the
      [Structured Outputs guide](/api/docs/guides/structured-outputs).

      The default format is `{ "type": "text" }` with no additional options.

      **Not recommended for gpt-4o and newer models:**

      Setting to `{ "type": "json_object" }` enables the older JSON mode, which
      ensures the message the model generates is valid JSON. Using `json_schema`
      is preferred for models that support it.

      - `Text`

        Default response format. Used to generate text responses.

        - `type: "text"`

          The type of response format being defined. Always `text`.

          - `"text"`

      - `BetaResponseFormatTextJSONSchemaConfig`

        JSON Schema response format. Used to generate structured JSON responses.
        Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `JSONObject`

        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`.

          - `"json_object"`

    - `verbosity?: "low" | "medium" | "high" | null`

      Constrains the verbosity of the model's response. Lower values will result in
      more concise responses, while higher values will result in more verbose responses.
      Currently supported values are `low`, `medium`, and `high`. The default is
      `medium`.

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tool_usage?: ToolUsage`

    Usage reported by hosted tools, separate from base model `usage`. The field
    can be omitted when tool usage is unavailable. When present, tool families
    with no recorded usage have zero counts.

    `image_gen` sums available token counts across image generation calls.
    Calls with missing or incomplete usage records may be skipped. Output
    token details and cached input counts can be omitted. An omitted cache
    count means cache usage is unknown.

    `web_search.num_requests` counts billable searches. Discounted searches
    and actions such as opening a page are excluded. Use billing records to
    reconcile final charges.

    - `image_gen: ImageGen`

      Aggregated usage statistics for image generation tool calls.

      - `input_tokens: number`

        The number of tokens (images and text) in the input prompt.

      - `input_tokens_details: InputTokensDetails`

        The input tokens detailed information for the image generation.

        - `image_tokens: number`

          The number of image tokens in the input prompt.

        - `text_tokens: number`

          The number of text tokens in the input prompt.

      - `output_tokens: number`

        The number of output tokens generated by the model.

      - `total_tokens: number`

        The total number of tokens (images and text) used for the image generation.

      - `cached_tokens?: number`

      - `cached_tokens_details?: CachedTokensDetails`

        - `cached_image_tokens: number`

        - `cached_text_tokens: number`

      - `output_tokens_details?: OutputTokensDetails`

        The output token details for the image generation.

        - `image_tokens: number`

          The number of image output tokens generated by the model.

        - `text_tokens: number`

          The number of text output tokens generated by the model.

    - `web_search: WebSearch`

      Aggregated billable usage statistics for web search tool calls.

      - `num_requests: number`

        The number of billable web search requests issued.

  - `top_logprobs?: number | null`

    An integer between 0 and 20 specifying the maximum number of most likely
    tokens to return at each token position, each with an associated log
    probability. In some cases, the number of returned tokens may be fewer than
    requested.

    `minimum: 0`, `maximum: 20`

  - `truncation?: "auto" | "disabled" | null`

    The truncation strategy to use for the model response.

    - `auto`: If the input to this Response exceeds
      the model's context window size, the model will truncate the
      response to fit the context window by dropping items from the beginning of the conversation.
      On some models, trimming can begin earlier because the API subtracts the model's
      maximum output allowance from its input limit, even if you set a lower `max_output_tokens`.
    - `disabled` (default): If the input size will exceed the context window
      size for a model, the request will fail with a 400 error.

    - `"auto"`

    - `"disabled"`

  - `usage?: BetaResponseUsage`

    Represents token usage details including input tokens, output tokens,
    a breakdown of output tokens, and the total tokens used.

    - `input_tokens: number`

      The number of input tokens.

    - `input_tokens_details: InputTokensDetails`

      A detailed breakdown of the input tokens.

      - `cache_write_tokens: number`

        The number of input tokens that were written to the cache.

      - `cached_tokens: number`

        The number of tokens that were retrieved from the cache.
        [More on prompt caching](/api/docs/guides/prompt-caching).

      - `cache_write_tokens_details?: CacheWriteTokensDetails`

        - `ttl_12h_tokens: number`

          The number of input tokens written with 12-hour retention.

        - `ttl_30m_tokens: number`

          The number of input tokens written with 30-minute retention.

    - `output_tokens: number`

      The number of output tokens.

    - `output_tokens_details: OutputTokensDetails`

      A detailed breakdown of the output tokens.

      - `reasoning_tokens: number`

        The number of reasoning tokens.

    - `total_tokens: number`

      The total number of tokens used.

  - `user?: string`

    This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.
    A stable identifier for your end-users.
    Used to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

### Beta Response Apply Patch Tool Call

- `BetaResponseApplyPatchToolCall`

  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 | DeleteFile | UpdateFile`

    One of the create_file, delete_file, or update_file operations applied via apply_patch.

    - `CreateFile`

      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.

        - `"create_file"`

    - `DeleteFile`

      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.

        - `"delete_file"`

    - `UpdateFile`

      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.

        - `"update_file"`

  - `status: "in_progress" | "completed"`

    The status of the apply patch tool call. One of `in_progress` or `completed`.

    - `"in_progress"`

    - `"completed"`

  - `type: "apply_patch_call"`

    The type of the item. Always `apply_patch_call`.

    - `"apply_patch_call"`

  - `agent?: Agent`

    The agent that produced this item.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

  - `caller?: Direct | Program | null`

    The execution context that produced this tool call.

    - `Direct`

      - `type: "direct"`

        - `"direct"`

    - `Program`

      - `caller_id: string`

        The call ID of the program item that produced this tool call.

      - `type: "program"`

        - `"program"`

  - `created_by?: string`

    The ID of the entity that created this tool call.

### Beta Response Apply Patch Tool Call Output

- `BetaResponseApplyPatchToolCallOutput`

  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`.

    - `"completed"`

    - `"failed"`

  - `type: "apply_patch_call_output"`

    The type of the item. Always `apply_patch_call_output`.

    - `"apply_patch_call_output"`

  - `agent?: Agent`

    The agent that produced this item.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

  - `caller?: Direct | Program | null`

    The execution context that produced this tool call.

    - `Direct`

      - `type: "direct"`

        - `"direct"`

    - `Program`

      - `caller_id: string`

        The call ID of the program item that produced this tool call.

      - `type: "program"`

        - `"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.

### Beta Response Audio Delta Event

- `BetaResponseAudioDeltaEvent`

  Emitted when there is a partial audio response.

  - `delta: string`

    A chunk of Base64 encoded response audio bytes.

  - `sequence_number: number`

    A sequence number for this chunk of the stream response.

  - `type: "response.audio.delta"`

    The type of the event. Always `response.audio.delta`.

    - `"response.audio.delta"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Audio Done Event

- `BetaResponseAudioDoneEvent`

  Emitted when the audio response is complete.

  - `sequence_number: number`

    The sequence number of the delta.

  - `type: "response.audio.done"`

    The type of the event. Always `response.audio.done`.

    - `"response.audio.done"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Audio Transcript Delta Event

- `BetaResponseAudioTranscriptDeltaEvent`

  Emitted when there is a partial transcript of audio.

  - `delta: string`

    The partial transcript of the audio response.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.audio.transcript.delta"`

    The type of the event. Always `response.audio.transcript.delta`.

    - `"response.audio.transcript.delta"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Audio Transcript Done Event

- `BetaResponseAudioTranscriptDoneEvent`

  Emitted when the full audio transcript is completed.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.audio.transcript.done"`

    The type of the event. Always `response.audio.transcript.done`.

    - `"response.audio.transcript.done"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Code Interpreter Call Code Delta Event

- `BetaResponseCodeInterpreterCallCodeDeltaEvent`

  Emitted when a partial code snippet is streamed by the code interpreter.

  - `delta: string`

    The partial code snippet being streamed by the code interpreter.

  - `item_id: string`

    The unique identifier of the code interpreter tool call item.

  - `output_index: number`

    The index of the output item in the response for which the code is being streamed.

  - `sequence_number: number`

    The sequence number of this event, used to order streaming events.

  - `type: "response.code_interpreter_call_code.delta"`

    The type of the event. Always `response.code_interpreter_call_code.delta`.

    - `"response.code_interpreter_call_code.delta"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Code Interpreter Call Code Done Event

- `BetaResponseCodeInterpreterCallCodeDoneEvent`

  Emitted when the code snippet is finalized by the code interpreter.

  - `code: string`

    The final code snippet output by the code interpreter.

  - `item_id: string`

    The unique identifier of the code interpreter tool call item.

  - `output_index: number`

    The index of the output item in the response for which the code is finalized.

  - `sequence_number: number`

    The sequence number of this event, used to order streaming events.

  - `type: "response.code_interpreter_call_code.done"`

    The type of the event. Always `response.code_interpreter_call_code.done`.

    - `"response.code_interpreter_call_code.done"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Code Interpreter Call Completed Event

- `BetaResponseCodeInterpreterCallCompletedEvent`

  Emitted when the code interpreter call is completed.

  - `item_id: string`

    The unique identifier of the code interpreter tool call item.

  - `output_index: number`

    The index of the output item in the response for which the code interpreter call is completed.

  - `sequence_number: number`

    The sequence number of this event, used to order streaming events.

  - `type: "response.code_interpreter_call.completed"`

    The type of the event. Always `response.code_interpreter_call.completed`.

    - `"response.code_interpreter_call.completed"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Code Interpreter Call In Progress Event

- `BetaResponseCodeInterpreterCallInProgressEvent`

  Emitted when a code interpreter call is in progress.

  - `item_id: string`

    The unique identifier of the code interpreter tool call item.

  - `output_index: number`

    The index of the output item in the response for which the code interpreter call is in progress.

  - `sequence_number: number`

    The sequence number of this event, used to order streaming events.

  - `type: "response.code_interpreter_call.in_progress"`

    The type of the event. Always `response.code_interpreter_call.in_progress`.

    - `"response.code_interpreter_call.in_progress"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Code Interpreter Call Interpreting Event

- `BetaResponseCodeInterpreterCallInterpretingEvent`

  Emitted when the code interpreter is actively interpreting the code snippet.

  - `item_id: string`

    The unique identifier of the code interpreter tool call item.

  - `output_index: number`

    The index of the output item in the response for which the code interpreter is interpreting code.

  - `sequence_number: number`

    The sequence number of this event, used to order streaming events.

  - `type: "response.code_interpreter_call.interpreting"`

    The type of the event. Always `response.code_interpreter_call.interpreting`.

    - `"response.code_interpreter_call.interpreting"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Code Interpreter Tool Call

- `BetaResponseCodeInterpreterToolCall`

  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 | Image> | null`

    The outputs generated by the code interpreter, such as logs or images.
    Can be null if no outputs are available.

    - `Logs`

      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`.

        - `"logs"`

    - `Image`

      The image output from the code interpreter.

      - `type: "image"`

        The type of the output. Always `image`.

        - `"image"`

      - `url: string`

        The URL of the image output from the code interpreter.

        `format: uri`

  - `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`.

    - `"in_progress"`

    - `"completed"`

    - `"incomplete"`

    - `"interpreting"`

    - `"failed"`

  - `type: "code_interpreter_call"`

    The type of the code interpreter tool call. Always `code_interpreter_call`.

    - `"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.

### Beta Response Compaction Compacting Event

- `BetaResponseCompactionCompactingEvent`

  Emitted when new summary content is sampled for a compaction trigger. Contains no summary content.

  - `item_id: string`

    The ID of the compaction output item.

  - `output_index: number`

    The index of the compaction output item.

  - `sequence_number: number`

    The sequence number of the event that was emitted.

  - `type: "response.compaction.compacting"`

    The type of the event, always `response.compaction.compacting`.

    - `"response.compaction.compacting"`

  - `agent?: Agent`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Compaction Item

- `BetaResponseCompactionItem`

  A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

  - `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`.

    - `"compaction"`

  - `agent?: Agent`

    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.

### Beta Response Compaction Item Param

- `BetaResponseCompactionItemParam`

  A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

  - `encrypted_content: string`

    The encrypted content of the compaction summary.

    `maxLength: 104857600`

  - `type: "compaction"`

    The type of the item. Always `compaction`.

    - `"compaction"`

  - `id?: string | null`

    The ID of the compaction item.

  - `agent?: Agent | null`

    The agent that produced this item.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Completed Event

- `BetaResponseCompletedEvent`

  Emitted when the model response is complete.

  - `response: BetaResponse`

    Properties of the completed response.

    - `id: string`

      Unique identifier for this Response.

    - `access_programs: AccessPrograms | null`

      - `cyber: "standard" | "daybreak_blue" | "daybreak_red"`

        The effective Cyber access program used for this response.

        - `"standard"`

        - `"daybreak_blue"`

        - `"daybreak_red"`

    - `created_at: number`

      Unix timestamp (in seconds) of when this Response was created.

      `format: unixtime`

    - `error: BetaResponseError | null`

      An error object returned when the model fails to generate a Response.

      - `code: "server_error" | "rate_limit_exceeded" | "invalid_prompt" | 18 more`

        The error code for the response.

        - `"server_error"`

        - `"rate_limit_exceeded"`

        - `"invalid_prompt"`

        - `"data_residency_mismatch"`

        - `"bio_policy"`

        - `"misalignment_policy_violation"`

        - `"vector_store_timeout"`

        - `"invalid_image"`

        - `"invalid_image_format"`

        - `"invalid_base64_image"`

        - `"invalid_image_url"`

        - `"image_too_large"`

        - `"image_too_small"`

        - `"image_parse_error"`

        - `"image_content_policy_violation"`

        - `"invalid_image_mode"`

        - `"image_file_too_large"`

        - `"unsupported_image_media_type"`

        - `"empty_image_file"`

        - `"failed_to_download_image"`

        - `"image_file_not_found"`

      - `message: string`

        A human-readable description of the error.

      - `misalignment?: Misalignment`

        - `detailed_explanation?: string`

          The public explanation for this block.

        - `error_type?: (string & {}) | "potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

          An optional classification; clients must accept additional values.

          - `(string & {})`

          - `"potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

            - `"potentially_unintended_data_transfer"`

            - `"potentially_unintended_data_access"`

            - `"potentially_unintended_destructive_activity"`

            - `"other"`

        - `review_target?: string | null`

          An opaque target for explicitly continuing this review, or null when unavailable.

          `minLength: 1`, `maxLength: 96`

        - `steer?: Steer`

          An optional public continuation instruction.

          - `message: string`

            The public continuation instruction.

      - `param?: string | null`

        The request parameter associated with the error, or null if none was recorded.

      - `type?: string | null`

        The original error type, or null if it was not recorded.

    - `incomplete_details: IncompleteDetails | null`

      Details about why the response is incomplete.

      - `reason?: "max_output_tokens" | "max_messages" | "content_filter" | "steered"`

        The reason why the response is incomplete. `steered` means
        the response stopped at a safe output boundary after a
        WebSocket `response.steer` event. The server can then create
        a successor response automatically with the queued input.

        - `"max_output_tokens"`

        - `"max_messages"`

        - `"content_filter"`

        - `"steered"`

    - `instructions: string | Array<BetaResponseInputItem> | null`

      A system (or developer) message inserted into the model's context.

      When using along with `previous_response_id`, the instructions from a previous
      response will not be carried over to the next response. This makes it simple
      to swap out system (or developer) messages in new responses.

      - `string`

      - `Array<BetaResponseInputItem>`

        - `BetaEasyInputMessage`

          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.

            - `string`

            - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

              A list of one or many input items to the model, containing different content
              types.

              - `BetaResponseInputText`

                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`.

                  - `"input_text"`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImage`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

                - `detail: BetaImageDetail`

                  The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                  - `"low"`

                  - `"high"`

                  - `"auto"`

                  - `"original"`

                - `type: "input_image"`

                  The type of the input item. Always `input_image`.

                  - `"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.

                  `format: uri`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFile`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"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`.

                  - `"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.

                  `format: uri`

                - `filename?: string`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

          - `role: "user" | "assistant" | "system" | "developer"`

            The role of the message input. One of `user`, `assistant`, `system`, or
            `developer`.

            - `"user"`

            - `"assistant"`

            - `"system"`

            - `"developer"`

          - `phase?: "commentary" | "final_answer" | 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.

            - `"commentary"`

            - `"final_answer"`

          - `type?: "message"`

            The type of the message input. Always `message`.

            - `"message"`

        - `Message`

          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.

          - `content: BetaResponseInputMessageContentList`

            A list of one or many input items to the model, containing different content
            types.

          - `role: "user" | "system" | "developer"`

            The role of the message input. One of `user`, `system`, or `developer`.

            - `"user"`

            - `"system"`

            - `"developer"`

          - `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"`

            The status of item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type?: "message"`

            The type of the message input. Always set to `message`.

            - `"message"`

        - `BetaResponseOutputMessage`

          An output message from the model.

          - `id: string`

            The unique ID of the output message.

          - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

            The content of the output message.

            - `BetaResponseOutputText`

              A text output from the model.

              - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

                The annotations of the text output.

                - `FileCitation`

                  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 in the output text at which to insert the file citation.

                  - `type: "file_citation"`

                    The type of the file citation. Always `file_citation`.

                    - `"file_citation"`

                - `URLCitation`

                  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_citation"`

                  - `url: string`

                    The URL of the web resource.

                    `format: uri`

                - `ContainerFileCitation`

                  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`.

                    - `"container_file_citation"`

                - `FilePath`

                  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`.

                    - `"file_path"`

              - `text: string`

                The text output from the model.

              - `type: "output_text"`

                The type of the output text. Always `output_text`.

                - `"output_text"`

              - `logprobs?: Array<Logprob>`

                - `token: string`

                - `bytes: Array<number>`

                - `logprob: number`

                - `top_logprobs: Array<TopLogprob>`

                  - `token: string`

                  - `bytes: Array<number>`

                  - `logprob: number`

            - `BetaResponseOutputRefusal`

              A refusal from the model.

              - `refusal: string`

                The refusal explanation from the model.

              - `type: "refusal"`

                The type of the refusal. Always `refusal`.

                - `"refusal"`

          - `role: "assistant"`

            The role of the output message. Always `assistant`.

            - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "message"`

            The type of the output message. Always `message`.

            - `"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" | "final_answer" | 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.

            - `"commentary"`

            - `"final_answer"`

        - `BetaResponseFileSearchToolCall`

          The results of a file search tool call. See the
          [file search guide](/api/docs/guides/tools-file-search) 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`,

            - `"in_progress"`

            - `"searching"`

            - `"completed"`

            - `"incomplete"`

            - `"failed"`

          - `type: "file_search_call"`

            The type of the file search tool call. Always `file_search_call`.

            - `"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.

              - `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.

              `format: float`

            - `text?: string`

              The text that was retrieved from the file.

        - `BetaResponseComputerToolCall`

          A tool call to a computer use tool. See the
          [computer use guide](/api/docs/guides/tools-computer-use) 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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "computer_call"`

            The type of the computer call. Always `computer_call`.

            - `"computer_call"`

          - `action?: BetaComputerAction`

            A click action.

            - `Click`

              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`.

                - `"left"`

                - `"right"`

                - `"wheel"`

                - `"back"`

                - `"forward"`

              - `type: "click"`

                Specifies the event type. For a click action, this property is always `click`.

                - `"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`

              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`.

                - `"double_click"`

              - `x: number`

                The x-coordinate where the double click occurred.

              - `y: number`

                The y-coordinate where the double click occurred.

            - `Drag`

              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`.

                - `"drag"`

              - `keys?: Array<string> | null`

                The keys being held while dragging the mouse.

            - `Keypress`

              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`.

                - `"keypress"`

            - `Move`

              A mouse move action.

              - `type: "move"`

                Specifies the event type. For a move action, this property is always set to `move`.

                - `"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`

              A screenshot action.

              - `type: "screenshot"`

                Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

                - `"screenshot"`

            - `Scroll`

              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`.

                - `"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`

              An action to type in text.

              - `text: string`

                The text to type.

              - `type: "type"`

                Specifies the event type. For a type action, this property is always set to `type`.

                - `"type"`

            - `Wait`

              A wait action.

              - `type: "wait"`

                Specifies the event type. For a wait action, this property is always set to `wait`.

                - `"wait"`

          - `actions?: BetaComputerActionList`

            Flattened batched actions for `computer_use`. Each action includes an
            `type` discriminator and action-specific fields.

            - `Click`

              A click action.

            - `DoubleClick`

              A double click action.

            - `Drag`

              A drag action.

            - `Keypress`

              A collection of keypresses the model would like to perform.

            - `Move`

              A mouse move action.

            - `Screenshot`

              A screenshot action.

            - `Scroll`

              A scroll action.

            - `Type`

              An action to type in text.

            - `Wait`

              A wait action.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCallOutput`

          The output of a computer tool call.

          - `call_id: string`

            The ID of the computer tool call that produced the output.

            `minLength: 1`, `maxLength: 64`

          - `output: BetaResponseComputerToolCallOutputScreenshot`

            A computer screenshot image used with the computer use tool.

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is
              always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `file_id?: string`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url?: string`

              The URL of the screenshot image.

              `format: uri`

          - `type: "computer_call_output"`

            The type of the computer tool call output. Always `computer_call_output`.

            - `"computer_call_output"`

          - `id?: string | null`

            The ID of the computer tool call output.

          - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

            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.

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseFunctionWebSearch`

          The results of a web search tool call. See the
          [web search guide](/api/docs/guides/tools-web-search) for more information.

          - `id: string`

            The unique ID of the web search tool call.

          - `action: Search | OpenPage | FindInPage`

            An object describing the specific action taken in this web search call.
            Includes details on how the model used the web (search, open_page, find_in_page).

            - `Search`

              Action type "search" - Performs a web search query.

              - `type: "search"`

                The action type.

                - `"search"`

              - `queries?: Array<string>`

                The search queries.

              - `query?: string`

                The search query.

              - `sources?: Array<Source>`

                The sources used in the search.

                - `type: "url"`

                  The type of source. Always `url`.

                  - `"url"`

                - `url: string`

                  The URL of the source.

                  `format: uri`

            - `OpenPage`

              Action type "open_page" - Opens a specific URL from search results.

              - `type: "open_page"`

                The action type.

                - `"open_page"`

              - `url?: string | null`

                The URL opened by the model.

                `format: uri`

            - `FindInPage`

              Action type "find_in_page": Searches for a pattern within a loaded page.

              - `pattern: string`

                The pattern or text to search for within the page.

              - `type: "find_in_page"`

                The action type.

                - `"find_in_page"`

              - `url: string`

                The URL of the page searched for the pattern.

                `format: uri`

          - `status: "in_progress" | "searching" | "completed" | 2 more`

            The status of the web search tool call.

            - `"in_progress"`

            - `"searching"`

            - `"completed"`

            - `"failed"`

            - `"incomplete"`

          - `type: "web_search_call"`

            The type of the web search tool call. Always `web_search_call`.

            - `"web_search_call"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `BetaResponseFunctionToolCall`

          A tool call to run a function. See the
          [function calling guide](/api/docs/guides/function-calling) 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`.

            - `"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.

          - `async?: boolean`

            Whether the function tool call runs asynchronously.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `FunctionCallOutput`

          The output of a function tool call.

          - `output: string | BetaResponseFunctionCallOutputItemList`

            Text, image, or file output of the function tool call.

            - `string`

            - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                  `maxLength: 10485760`

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImageContent`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

                - `type: "input_image"`

                  The type of the input item. Always `input_image`.

                  - `"input_image"`

                - `detail?: BetaImageDetail | null`

                  The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                - `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.

                  `maxLength: 20971520`, `format: uri`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFileContent`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"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`.

                  - `"auto"`

                  - `"low"`

                  - `"high"`

                - `file_data?: string | null`

                  The base64-encoded data of the file to be sent to the model.

                  `maxLength: 73400320`

                - `file_id?: string | null`

                  The ID of the file to be sent to the model.

                - `file_url?: string | null`

                  The URL of the file to be sent to the model.

                  `format: uri`

                - `filename?: string | null`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

          - `type: "function_call_output"`

            The type of the function tool call output. Always `function_call_output`.

            - `"function_call_output"`

          - `id?: string | null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the function tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name?: string | null`

            The name of the tool that produced the output.

            `minLength: 1`, `maxLength: 128`

          - `namespace?: string | null`

            The namespace of the tool that produced the output.

            `minLength: 1`, `maxLength: 128`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AgentMessage`

          A message routed between agents.

          - `author: string`

            The sending agent identity.

          - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

            Plaintext, image, or encrypted content sent between agents.

            - `BetaResponseInputTextContent`

              A text input to the model.

            - `BetaResponseInputImageContent`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `EncryptedContent`

              Opaque encrypted content that Responses API decrypts inside trusted model execution.

              - `encrypted_content: string`

                Opaque encrypted content.

                `maxLength: 10485760`

              - `type: "encrypted_content"`

                The type of the input item. Always `encrypted_content`.

                - `"encrypted_content"`

          - `recipient: string`

            The destination agent identity.

          - `type: "agent_message"`

            The item type. Always `agent_message`.

            - `"agent_message"`

          - `id?: string | null`

            The unique ID of this agent message item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCall`

          - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

            The multi-agent action that was executed.

            - `"spawn_agent"`

            - `"interrupt_agent"`

            - `"list_agents"`

            - `"send_message"`

            - `"followup_task"`

            - `"wait_agent"`

          - `arguments: string`

            The action arguments as a JSON string.

          - `call_id: string`

            The unique ID linking this call to its output.

            `minLength: 1`, `maxLength: 64`

          - `type: "multi_agent_call"`

            The item type. Always `multi_agent_call`.

            - `"multi_agent_call"`

          - `id?: string | null`

            The unique ID of this multi-agent call.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCallOutput`

          - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

            The multi-agent action that produced this result.

            - `"spawn_agent"`

            - `"interrupt_agent"`

            - `"list_agents"`

            - `"send_message"`

            - `"followup_task"`

            - `"wait_agent"`

          - `call_id: string`

            The unique ID of the multi-agent call.

            `minLength: 1`, `maxLength: 64`

          - `output: Array<Output>`

            Text output returned by the multi-agent action.

            - `text: string`

              The text content.

              `maxLength: 10485760`

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

            - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

              Citations associated with the text content.

              - `FileCitation`

                - `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.

                  `minimum: 0`

                - `type: "file_citation"`

                  The citation type. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation`

                - `end_index: number`

                  The index of the last character of the citation in the message.

                  `minimum: 0`

                - `start_index: number`

                  The index of the first character of the citation in the message.

                  `minimum: 0`

                - `title: string`

                  The title of the cited resource.

                - `type: "url_citation"`

                  The citation type. Always `url_citation`.

                  - `"url_citation"`

                - `url: string`

                  The URL of the cited resource.

                  `format: uri`

              - `ContainerFileCitation`

                - `container_id: string`

                  The ID of the container.

                - `end_index: number`

                  The index of the last character of the citation in the message.

                  `minimum: 0`

                - `file_id: string`

                  The ID of the container file.

                - `filename: string`

                  The filename of the container file cited.

                - `start_index: number`

                  The index of the first character of the citation in the message.

                  `minimum: 0`

                - `type: "container_file_citation"`

                  The citation type. Always `container_file_citation`.

                  - `"container_file_citation"`

          - `type: "multi_agent_call_output"`

            The item type. Always `multi_agent_call_output`.

            - `"multi_agent_call_output"`

          - `id?: string | null`

            The unique ID of this multi-agent call output.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ToolSearchCall`

          - `arguments: unknown`

            The arguments supplied to the tool search call.

          - `type: "tool_search_call"`

            The item type. Always `tool_search_call`.

            - `"tool_search_call"`

          - `id?: string | null`

            The unique ID of this tool search call.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the tool search call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `execution?: "server" | "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the tool search call.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseToolSearchOutputItemParam`

          - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

            The loaded tool definitions returned by the tool search output.

            - `BetaFunctionTool`

              Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

                - `"function"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

              - `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`

              A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

              - `type: "file_search"`

                The type of the file search tool. Always `file_search`.

                - `"file_search"`

              - `vector_store_ids: Array<string>`

                The IDs of the vector stores to search.

              - `filters?: ComparisonFilter | CompoundFilter | null`

                A filter to apply.

                - `ComparisonFilter`

                  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

                    - `"eq"`

                    - `"ne"`

                    - `"gt"`

                    - `"gte"`

                    - `"lt"`

                    - `"lte"`

                    - `"in"`

                    - `"nin"`

                  - `value: string | number | boolean | Array<string | number>`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `Array<string | number>`

                      - `string`

                      - `number`

                - `CompoundFilter`

                  Combine multiple filters using `and` or `or`.

                  - `filters: Array<ComparisonFilter | unknown>`

                    Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

                    - `ComparisonFilter`

                      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

                        - `"eq"`

                        - `"ne"`

                        - `"gt"`

                        - `"gte"`

                        - `"lt"`

                        - `"lte"`

                        - `"in"`

                        - `"nin"`

                      - `value: string | number | boolean | Array<string | number>`

                        The value to compare against the attribute key; supports string, number, or boolean types.

                        - `string`

                        - `number`

                        - `boolean`

                        - `Array<string | number>`

                          - `string`

                          - `number`

                    - `unknown`

                  - `type: "and" | "or"`

                    Type of operation: `and` or `or`.

                    - `"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`

                Ranking options for search.

                - `hybrid_search?: HybridSearch`

                  Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

                  - `embedding_weight: number`

                    The weight of the embedding in the reciprocal ranking fusion.

                  - `text_weight: number`

                    The weight of the text in the reciprocal ranking fusion.

                - `ranker?: "auto" | "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"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`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

              - `type: "computer"`

                The type of the computer tool. Always `computer`.

                - `"computer"`

            - `BetaComputerUsePreviewTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

              - `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.

                - `"windows"`

                - `"mac"`

                - `"linux"`

                - `"ubuntu"`

                - `"browser"`

              - `type: "computer_use_preview"`

                The type of the computer use tool. Always `computer_use_preview`.

                - `"computer_use_preview"`

            - `BetaWebSearchTool`

              Search the Internet for sources related to the prompt. Learn more about the
              [web search tool](/api/docs/guides/tools-web-search).

              - `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`.

                - `"web_search"`

                - `"web_search_2025_08_26"`

              - `external_web_access?: boolean`

                Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

              - `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.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `user_location?: UserLocation | null`

                The approximate location of the user. If omitted or null, defaults to the
                United States. To avoid this fallback, pass `{"type": "approximate"}` without
                location fields. To localize results, provide the relevant location fields.

                - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type?: "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

                - `"mcp"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools?: Array<string> | McpToolFilter | null`

                List of allowed tool names or a filter object.

                - `Array<string>`

                - `McpToolFilter`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

                This field is deprecated for models released after September 1, 2026.
                Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
                connect through a Secure MCP Tunnel.

                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`

                - `"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" | null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter`

                  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`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                      it will match this filter.

                    - `tool_names?: Array<string>`

                      List of allowed tool names.

                  - `never?: Never`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

                `format: uri`

              - `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`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string | CodeInterpreterToolAuto`

                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.

                - `string`

                - `CodeInterpreterToolAuto`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                      - `type: "disabled"`

                        Disable outbound network access. Always `disabled`.

                        - `"disabled"`

                    - `BetaContainerNetworkPolicyAllowlist`

                      - `allowed_domains: Array<string>`

                        A list of allowed domains when type is `allowlist`.

                        `minItems: 1`

                      - `type: "allowlist"`

                        Allow outbound network access only to specified domains. Always `allowlist`.

                        - `"allowlist"`

                      - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                        Optional domain-scoped secrets for allowlisted domains.

                        `minItems: 1`

                        - `domain: string`

                          The domain associated with the secret.

                          `minLength: 1`

                        - `name: string`

                          The name of the secret to inject for the domain.

                          `minLength: 1`

                        - `value: string`

                          The secret value to inject for the domain.

                          `minLength: 1`, `maxLength: 10485760`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action?: "generate" | "edit" | "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background?: "transparent" | "opaque" | "auto"`

                Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
                `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
                Transparent backgrounds are available for supported GPT Image models. For
                `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
                using `transparent`, set the output format to `png` or `webp`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `complexity?: "low" | "medium" | "high"`

                Computation spent planning the image, independently of rendering quality.
                Overrides the outer response's `reasoning.effort` for image generation.
                When omitted, inherits a supported outer reasoning effort or uses the
                image model's configured default.
                For SVG output, controls the reference image, not the SVG author's
                reasoning.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `frame_count?: number`

                Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

                `minimum: 2`, `maximum: 16`

              - `frame_duration_ms?: number`

                Duration of each GIF frame in milliseconds, rounded to 10 ms.
                Requires `output_format` to be `gif`. Default: 200.

                `minimum: 20`, `maximum: 2000`

              - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

                - `"high"`

                - `"low"`

              - `input_image_mask?: InputImageMask`

                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" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                Deprecated values:

                - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

                - `(string & {})`

                - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                  The image generation model to use. One of `gpt-image-1-mini`,
                  `gpt-image-1.5`, `gpt-image-2`,
                  `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                  `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                  `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                  `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                  `gpt-image-2`.

                  `gpt-image-1` was shut down on October 23, 2026. Use
                  `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                  - `"gpt-image-1"`

                  - `"gpt-image-1-mini"`

                  - `"gpt-image-2"`

                  - `"gpt-image-2-2026-04-21"`

                  - `"gpt-image-2.5-sunburst"`

                  - `"gpt-image-2.5-sunburst-2026-09-08"`

                  - `"gpt-image-2.5-flare"`

                  - `"gpt-image-2.5-flare-2026-09-08"`

                  - `"gpt-image-2.6-sunburst"`

                  - `"gpt-image-2.6-flare"`

                  - `"gpt-image-1.5"`

                  - `"chatgpt-image-latest"`

              - `moderation?: "auto" | "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression?: number`

                Compression level for the output image. Default: 100.

                `minimum: 0`, `maximum: 100`

              - `output_format?: "png" | "webp" | "jpeg" | 2 more`

                The output format of the generated image. One of `png`, `webp`, `jpeg`,
                `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
                that supports the selected format. GIF output does not support
                partial image streaming (`partial_images` greater than `0`),
                `input_image_mask`, or custom `output_compression`.
                Responses lifecycle events can still be streamed for GIF output.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

                - `"gif"`

                - `"svg"`

              - `partial_images?: number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

                `minimum: 0`, `maximum: 3`

              - `quality?: "low" | "medium" | "high" | 3 more`

                The quality of the generated image. The GPT image models support `low`,
                `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
                including their `2026-09-08` snapshots, also support `xhigh` and `max`.
                Default: `auto`.

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

                - `"auto"`

              - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

                - `(string & {})`

                - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

              - `svg?: Svg`

                SVG author model settings. Requires `output_format` to be `svg`.
                When SVG model selection is enabled, omitting this object uses the
                outer response model. Otherwise, the default SVG author is used and
                explicit model overrides are unavailable.

                - `model?: string`

                  `minLength: 1`

                - `reasoning?: Reasoning | null`

                  Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                  - `effort?: "none" | "minimal" | "low" | 4 more`

                    Controls how much effort the model should spend on reasoning for this request.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

            - `LocalShell`

              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`.

                - `"local_shell"`

            - `BetaFunctionShellTool`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

                - `BetaContainerAuto`

                  - `type: "container_auto"`

                    Automatically creates a container for this request

                    - `"container_auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                    - `BetaContainerNetworkPolicyAllowlist`

                  - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

                    An optional list of skills referenced by id or inline data.

                    `maxItems: 200`

                    - `BetaSkillReference`

                      - `skill_id: string`

                        The ID of the referenced skill.

                        `minLength: 1`, `maxLength: 64`

                      - `type: "skill_reference"`

                        References a skill created with the /v1/skills endpoint.

                        - `"skill_reference"`

                      - `version?: string`

                        Optional skill version. Use a positive integer or 'latest'. Omit for default.

                    - `BetaInlineSkill`

                      - `description: string`

                        The description of the skill.

                      - `name: string`

                        The name of the skill.

                      - `source: BetaInlineSkillSource`

                        Inline skill payload

                        - `data: string`

                          Base64-encoded skill zip bundle.

                          `minLength: 1`, `maxLength: 70254592`

                        - `media_type: "application/zip"`

                          The media type of the inline skill payload. Must be `application/zip`.

                          - `"application/zip"`

                        - `type: "base64"`

                          The type of the inline skill source. Must be `base64`.

                          - `"base64"`

                      - `type: "inline"`

                        Defines an inline skill for this request.

                        - `"inline"`

                - `BetaLocalEnvironment`

                  - `type: "local"`

                    Use a local computer environment.

                    - `"local"`

                  - `skills?: Array<BetaLocalSkill>`

                    An optional list of skills.

                    `maxItems: 200`

                    - `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: string`

                    The ID of the referenced container.

                  - `type: "container_reference"`

                    References a container created with the /v1/containers endpoint

                    - `"container_reference"`

            - `BetaCustomTool`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

                - `"custom"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `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 | Grammar`

                The input format for the custom tool. Default is unconstrained text.

                - `Text`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar`

                  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`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `BetaToolSearchOutputNamespaceTool`

              Groups function/custom tools under a shared namespace.

              - `description: string`

                A description of the namespace shown to the model.

              - `name: string`

                The namespace name used in tool calls (for example, `crm`).

                `minLength: 1`

              - `tools: Array<Function | BetaCustomTool>`

                The function/custom tools loaded inside this namespace.

                `minItems: 1`

                - `Function`

                  - `name: string`

                    The name of the loaded function tool.

                    `minLength: 1`, `maxLength: 128`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                    The tool invocation context(s).

                    `minItems: 1`

                    - `"direct"`

                    - `"programmatic"`

                  - `async?: boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `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`

                  A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

              - `type: "namespace"`

                The type of the tool. Always `namespace`.

                - `"namespace"`

            - `BetaToolSearchTool`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"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.

                - `"server"`

                - `"client"`

              - `parameters?: unknown`

                Parameter schema for a client-executed tool search tool.

            - `BetaWebSearchPreviewTool`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `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`.

                - `"web_search_preview"`

                - `"web_search_preview_2025_03_11"`

              - `search_content_types?: Array<"text" | "image">`

                - `"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.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `user_location?: UserLocation | null`

                The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

                - `type: "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `BetaApplyPatchTool`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

          - `type: "tool_search_output"`

            The item type. Always `tool_search_output`.

            - `"tool_search_output"`

          - `id?: string | null`

            The unique ID of this tool search output.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the tool search call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `execution?: "server" | "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the tool search output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AdditionalTools`

          - `role: "developer"`

            The role that provided the additional tools. Only `developer` is supported.

            - `"developer"`

          - `tools: Array<BetaTool>`

            A list of additional tools made available at this item.

            - `BetaFunctionTool`

              Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

            - `BetaFileSearchTool`

              A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

            - `BetaComputerTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `BetaComputerUsePreviewTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `BetaWebSearchTool`

              Search the Internet for sources related to the prompt. Learn more about the
              [web search tool](/api/docs/guides/tools-web-search).

            - `Mcp`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

                - `"mcp"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools?: Array<string> | McpToolFilter | null`

                List of allowed tool names or a filter object.

                - `Array<string>`

                - `McpToolFilter`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

                This field is deprecated for models released after September 1, 2026.
                Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
                connect through a Secure MCP Tunnel.

                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`

                - `"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" | null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter`

                  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`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                      it will match this filter.

                    - `tool_names?: Array<string>`

                      List of allowed tool names.

                  - `never?: Never`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

                `format: uri`

              - `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`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string | CodeInterpreterToolAuto`

                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.

                - `string`

                - `CodeInterpreterToolAuto`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                    - `BetaContainerNetworkPolicyAllowlist`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action?: "generate" | "edit" | "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background?: "transparent" | "opaque" | "auto"`

                Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
                `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
                Transparent backgrounds are available for supported GPT Image models. For
                `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
                using `transparent`, set the output format to `png` or `webp`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `complexity?: "low" | "medium" | "high"`

                Computation spent planning the image, independently of rendering quality.
                Overrides the outer response's `reasoning.effort` for image generation.
                When omitted, inherits a supported outer reasoning effort or uses the
                image model's configured default.
                For SVG output, controls the reference image, not the SVG author's
                reasoning.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `frame_count?: number`

                Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

                `minimum: 2`, `maximum: 16`

              - `frame_duration_ms?: number`

                Duration of each GIF frame in milliseconds, rounded to 10 ms.
                Requires `output_format` to be `gif`. Default: 200.

                `minimum: 20`, `maximum: 2000`

              - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

                - `"high"`

                - `"low"`

              - `input_image_mask?: InputImageMask`

                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" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                Deprecated values:

                - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

                - `(string & {})`

                - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                  The image generation model to use. One of `gpt-image-1-mini`,
                  `gpt-image-1.5`, `gpt-image-2`,
                  `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                  `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                  `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                  `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                  `gpt-image-2`.

                  `gpt-image-1` was shut down on October 23, 2026. Use
                  `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                  - `"gpt-image-1"`

                  - `"gpt-image-1-mini"`

                  - `"gpt-image-2"`

                  - `"gpt-image-2-2026-04-21"`

                  - `"gpt-image-2.5-sunburst"`

                  - `"gpt-image-2.5-sunburst-2026-09-08"`

                  - `"gpt-image-2.5-flare"`

                  - `"gpt-image-2.5-flare-2026-09-08"`

                  - `"gpt-image-2.6-sunburst"`

                  - `"gpt-image-2.6-flare"`

                  - `"gpt-image-1.5"`

                  - `"chatgpt-image-latest"`

              - `moderation?: "auto" | "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression?: number`

                Compression level for the output image. Default: 100.

                `minimum: 0`, `maximum: 100`

              - `output_format?: "png" | "webp" | "jpeg" | 2 more`

                The output format of the generated image. One of `png`, `webp`, `jpeg`,
                `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
                that supports the selected format. GIF output does not support
                partial image streaming (`partial_images` greater than `0`),
                `input_image_mask`, or custom `output_compression`.
                Responses lifecycle events can still be streamed for GIF output.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

                - `"gif"`

                - `"svg"`

              - `partial_images?: number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

                `minimum: 0`, `maximum: 3`

              - `quality?: "low" | "medium" | "high" | 3 more`

                The quality of the generated image. The GPT image models support `low`,
                `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
                including their `2026-09-08` snapshots, also support `xhigh` and `max`.
                Default: `auto`.

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

                - `"auto"`

              - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

                - `(string & {})`

                - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

              - `svg?: Svg`

                SVG author model settings. Requires `output_format` to be `svg`.
                When SVG model selection is enabled, omitting this object uses the
                outer response model. Otherwise, the default SVG author is used and
                explicit model overrides are unavailable.

                - `model?: string`

                  `minLength: 1`

                - `reasoning?: Reasoning | null`

                  Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                  - `effort?: "none" | "minimal" | "low" | 4 more`

                    Controls how much effort the model should spend on reasoning for this request.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

            - `LocalShell`

              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`.

                - `"local_shell"`

            - `BetaFunctionShellTool`

              A tool that allows the model to execute shell commands.

            - `BetaCustomTool`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `BetaNamespaceTool`

              Groups function/custom tools under a shared namespace.

              - `description: string`

                A description of the namespace shown to the model.

              - `name: string`

                The namespace name used in tool calls (for example, `crm`).

                `minLength: 1`

              - `tools: Array<Function | BetaCustomTool>`

                The function/custom tools available inside this namespace.

                `minItems: 1`

                - `Function`

                  - `name: string`

                    `minLength: 1`, `maxLength: 128`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                    The tool invocation context(s).

                    `minItems: 1`

                    - `"direct"`

                    - `"programmatic"`

                  - `async?: boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `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`

                  A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

              - `type: "namespace"`

                The type of the tool. Always `namespace`.

                - `"namespace"`

            - `BetaToolSearchTool`

              Hosted or BYOT tool search configuration for deferred tools.

            - `BetaWebSearchPreviewTool`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `BetaApplyPatchTool`

              Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "additional_tools"`

            The item type. Always `additional_tools`.

            - `"additional_tools"`

          - `id?: string | null`

            The unique ID of this additional tools item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `BetaResponseConfigurationUpdateItemParam`

          An update to the conversation's response configuration. Supply reasoning,
          text, or both. Each setting stays in effect until a later update replaces it.

          - `type: "configuration_update"`

            The item type. Always `configuration_update`.

            - `"configuration_update"`

          - `id?: string | null`

            The unique ID of the configuration update item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reasoning?: Reasoning`

            Updates to reasoning configuration. Only effort is supported.

            - `effort?: "none" | "minimal" | "low" | 4 more | null`

              The reasoning effort to use for subsequent responses until another
              configuration update replaces it.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

          - `text?: Text`

            The text output configuration for subsequent responses.

            - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

              Use a JSON schema for structured output or text to return to plain text.

              - `Text`

                Default response format. Used to generate text responses.

                - `type: "text"`

                  The type of response format being defined. Always `text`.

                  - `"text"`

              - `BetaResponseFormatTextJSONSchemaConfig`

                JSON Schema response format. Used to generate structured JSON responses.
                Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

                - `name: string`

                  The name of the response format. Must be a-z, A-Z, 0-9, or contain
                  underscores and dashes, with a maximum length of 64.

                - `schema: Record<string, unknown>`

                  The schema for the response format, described as a JSON Schema object.
                  Learn how to build JSON schemas [here](https://json-schema.org/).

                - `type: "json_schema"`

                  The type of response format being defined. Always `json_schema`.

                  - `"json_schema"`

                - `description?: string`

                  A description of what the response format is for, used by the model to
                  determine how to respond in the format.

                - `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](/api/docs/guides/structured-outputs).

        - `BetaResponseReasoningItem`

          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](/api/docs/guides/conversation-state).

          - `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`.

              - `"summary_text"`

          - `type: "reasoning"`

            The type of the object. Always `reasoning`.

            - `"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`.

              - `"reasoning_text"`

          - `encrypted_content?: string | null`

            The encrypted content of the reasoning item. This is populated by default
            for reasoning items returned by `POST /v1/responses` and WebSocket
            `response.create` requests.

            When streaming, use the completed reasoning item and its
            `encrypted_content` from the `response.output_item.done` event in
            subsequent requests. The `encrypted_content` in
            `response.output_item.added` may be incomplete. This is especially
            important when `store` is `false` or when using Zero Data Retention.

          - `status?: "in_progress" | "completed" | "incomplete"`

            The status of the item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseCompactionItemParam`

          A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

          - `encrypted_content: string`

            The encrypted content of the compaction summary.

            `maxLength: 104857600`

          - `type: "compaction"`

            The type of the item. Always `compaction`.

            - `"compaction"`

          - `id?: string | null`

            The ID of the compaction item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ImageGenerationCall`

          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.

            - `"in_progress"`

            - `"completed"`

            - `"generating"`

            - `"failed"`

          - `type: "image_generation_call"`

            The type of the image generation call. Always `image_generation_call`.

            - `"image_generation_call"`

          - `action?: "generate" | "edit" | "auto" | null`

            The action used for image generation.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `background?: "transparent" | "opaque" | "auto" | null`

            The background setting used for generation.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `error?: Error`

            Details of a moderation failure, when available.

            - `code: string | null`

              The error code.

            - `message: string`

              A description of the error.

            - `param: string | null`

              The related request parameter.

            - `type: string`

              The error type.

            - `moderation_details?: ModerationDetails`

              Public details for a `moderation_blocked` error, when available.

              - `categories: Array<string>`

                Public moderation categories. New category values may be added over time.

              - `moderation_stage: "input" | "output" | "unknown"`

                The stage where moderation blocked the image generation call.

                - `"input"`

                - `"output"`

                - `"unknown"`

          - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

            The output format used for generation.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

            - `"gif"`

            - `"svg"`

          - `quality?: "low" | "medium" | "high" | 3 more | null`

            The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

            - `"auto"`

          - `revised_prompt?: string | null`

            The prompt that was used after any model prompt rewriting.

          - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `(string & {})`

            - `"1024x1024" | "1024x1536" | "1536x1024"`

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

          - `svg_usage?: SvgUsage`

            - `input_tokens: number`

            - `model: string`

            - `output_tokens: number`

            - `reasoning_tokens: number`

            - `total_tokens: number`

        - `BetaResponseCodeInterpreterToolCall`

          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 | Image> | null`

            The outputs generated by the code interpreter, such as logs or images.
            Can be null if no outputs are available.

            - `Logs`

              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`.

                - `"logs"`

            - `Image`

              The image output from the code interpreter.

              - `type: "image"`

                The type of the output. Always `image`.

                - `"image"`

              - `url: string`

                The URL of the image output from the code interpreter.

                `format: uri`

          - `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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"interpreting"`

            - `"failed"`

          - `type: "code_interpreter_call"`

            The type of the code interpreter tool call. Always `code_interpreter_call`.

            - `"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`

          A tool call to run a command on the local shell.

          - `id: string`

            The unique ID of the local shell call.

          - `action: Action`

            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`.

              - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "local_shell_call"`

            The type of the local shell call. Always `local_shell_call`.

            - `"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`

          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`.

            - `"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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCall`

          A tool representing a request to execute one or more shell commands.

          - `action: Action`

            The shell commands and limits that describe how to run the tool call.

            - `commands: Array<string>`

              Ordered shell commands for the execution environment to run.

            - `max_output_length?: number | null`

              Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

            - `timeout_ms?: number | null`

              Maximum wall-clock time in milliseconds to allow the shell commands to run.

          - `call_id: string`

            The unique ID of the shell tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `type: "shell_call"`

            The type of the item. Always `shell_call`.

            - `"shell_call"`

          - `id?: string | null`

            The unique ID of the shell tool call. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

            The environment to execute the shell commands in.

            - `BetaLocalEnvironment`

            - `BetaContainerReference`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCallOutput`

          The streamed output items emitted by a shell tool call.

          - `call_id: string`

            The unique ID of the shell tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `output: Array<BetaResponseFunctionShellCallOutputContent>`

            Captured chunks of stdout and stderr output, along with their associated outcomes.

            - `outcome: Timeout | Exit`

              The exit or timeout outcome associated with this shell call.

              - `Timeout`

                Indicates that the shell call exceeded its configured time limit.

                - `type: "timeout"`

                  The outcome type. Always `timeout`.

                  - `"timeout"`

              - `Exit`

                Indicates that the shell commands finished and returned an exit code.

                - `exit_code: number`

                  The exit code returned by the shell process.

                - `type: "exit"`

                  The outcome type. Always `exit`.

                  - `"exit"`

            - `stderr: string`

              Captured stderr output for the shell call.

              `maxLength: 10485760`

            - `stdout: string`

              Captured stdout output for the shell call.

              `maxLength: 10485760`

          - `type: "shell_call_output"`

            The type of the item. Always `shell_call_output`.

            - `"shell_call_output"`

          - `id?: string | null`

            The unique ID of the shell tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `max_output_length?: number | null`

            The maximum number of UTF-8 characters captured for this shell call's combined output.

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the shell call output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ApplyPatchCall`

          A tool call representing a request to create, delete, or update files using diff patches.

          - `call_id: string`

            The unique ID of the apply patch tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `operation: CreateFile | DeleteFile | UpdateFile`

            The specific create, delete, or update instruction for the apply_patch tool call.

            - `CreateFile`

              Instruction for creating a new file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply when creating the file.

                `maxLength: 10485760`

              - `path: string`

                Path of the file to create relative to the workspace root.

                `minLength: 1`

              - `type: "create_file"`

                The operation type. Always `create_file`.

                - `"create_file"`

            - `DeleteFile`

              Instruction for deleting an existing file via the apply_patch tool.

              - `path: string`

                Path of the file to delete relative to the workspace root.

                `minLength: 1`

              - `type: "delete_file"`

                The operation type. Always `delete_file`.

                - `"delete_file"`

            - `UpdateFile`

              Instruction for updating an existing file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply to the existing file.

                `maxLength: 10485760`

              - `path: string`

                Path of the file to update relative to the workspace root.

                `minLength: 1`

              - `type: "update_file"`

                The operation type. Always `update_file`.

                - `"update_file"`

          - `status: "in_progress" | "completed"`

            The status of the apply patch tool call. One of `in_progress` or `completed`.

            - `"in_progress"`

            - `"completed"`

          - `type: "apply_patch_call"`

            The type of the item. Always `apply_patch_call`.

            - `"apply_patch_call"`

          - `id?: string | null`

            The unique ID of the apply patch tool call. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `ApplyPatchCallOutput`

          The streamed output emitted by an apply patch tool call.

          - `call_id: string`

            The unique ID of the apply patch tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `status: "completed" | "failed"`

            The status of the apply patch tool call output. One of `completed` or `failed`.

            - `"completed"`

            - `"failed"`

          - `type: "apply_patch_call_output"`

            The type of the item. Always `apply_patch_call_output`.

            - `"apply_patch_call_output"`

          - `id?: string | null`

            The unique ID of the apply patch tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `output?: string | null`

            Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

            `maxLength: 10485760`

        - `McpListTools`

          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`.

            - `"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`

          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`.

            - `"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`

          A response to an MCP approval request.

          - `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`.

            - `"mcp_approval_response"`

          - `id?: string | null`

            The unique ID of the 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.

        - `McpCall`

          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`.

            - `"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?: BetaMcpToolCallError | null`

            The error from the tool call, if any.

            - `McpProtocolError`

              - `code: number`

              - `message: string`

              - `type: "mcp_protocol_error"`

                - `"mcp_protocol_error"`

            - `McpToolExecutionError`

              - `content: unknown`

              - `type: "mcp_tool_execution_error"`

                - `"mcp_tool_execution_error"`

            - `HTTPError`

              - `code: number`

              - `message: string`

              - `type: "http_error"`

                - `"http_error"`

          - `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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"calling"`

            - `"failed"`

        - `BetaResponseCustomToolCallOutput`

          The output of a custom tool call from your code, being sent back to the model.

          - `call_id: string`

            The call ID, used to map this custom tool call output to a custom tool call.

          - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            The output from the custom tool call generated by your code.
            Can be a string or an list of output content.

            - `string`

            - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

              - `BetaResponseInputText`

                A text input to the model.

              - `BetaResponseInputImage`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile`

                A file input to the model.

          - `type: "custom_tool_call_output"`

            The type of the custom tool call output. Always `custom_tool_call_output`.

            - `"custom_tool_call_output"`

          - `id?: string`

            The unique ID of the custom tool call output 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 | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `BetaResponseCustomToolCall`

          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`.

            - `"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.

          - `async?: boolean`

            Whether the custom tool call runs asynchronously.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace?: string`

            The namespace of the custom tool being called.

        - `CompactionTrigger`

          Compacts the current context. Must be the final input item.

          - `type: "compaction_trigger"`

            The type of the item. Always `compaction_trigger`.

            - `"compaction_trigger"`

          - `id?: string | null`

            The unique ID of this compaction trigger.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ItemReference`

          An internal identifier for an item to reference.

          - `id: string`

            The ID of the item to reference.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `type?: "item_reference" | null`

            The type of item to reference. Always `item_reference`.

            - `"item_reference"`

        - `Program`

          - `id: string`

            The unique ID of this program item.

          - `call_id: string`

            The stable call ID of the program item.

            `minLength: 1`, `maxLength: 64`

          - `code: string`

            The JavaScript source executed by programmatic tool calling.

            `maxLength: 10485760`

          - `fingerprint: string`

            Opaque program replay fingerprint that must be round-tripped.

            `maxLength: 10485760`

          - `type: "program"`

            The item type. Always `program`.

            - `"program"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ProgramOutput`

          - `id: string`

            The unique ID of this program output item.

          - `call_id: string`

            The call ID of the program item.

            `minLength: 1`, `maxLength: 64`

          - `result: string`

            The result produced by the program item.

            `maxLength: 10485760`

          - `status: "completed" | "incomplete"`

            The terminal status of the program output.

            - `"completed"`

            - `"incomplete"`

          - `type: "program_output"`

            The item type. Always `program_output`.

            - `"program_output"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

    - `metadata: Record<string, string> | 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: "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more | (string & {})`

      Model ID used to generate the response, like `gpt-6-astra`. OpenAI
      offers a wide range of models with different capabilities, performance
      characteristics, and price points. Refer to the [model guide](/api/docs/models)
      to browse and compare available models.

      Deprecated values:

      - "gpt-5.4-nano", "gpt-5.4-nano-2026-03-17", "gpt-5.1", "gpt-5.1-2025-11-13": Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.3-chat-latest", "gpt-5.2-chat-latest": Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.1-codex", "gpt-5.1-chat-latest", "gpt-5-chat-latest", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", "o3-deep-research", "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5-codex", "gpt-5.1-codex-max": Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.1-mini": Not a supported model ID. Retained for SDK compatibility.
      - "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "o3", "o3-2025-04-16", "o3-pro", "o3-pro-2025-06-10", "gpt-5-pro", "gpt-5-pro-2025-10-06": Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-mini", "gpt-4o-mini-2024-07-18": Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4.1-nano", "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3-mini", "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "gpt-4o-2024-05-13", "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-1106-preview", "gpt-4", "gpt-4-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-0125", "o1-pro", "o1-pro-2025-03-19": Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "o1-preview", "o1-preview-2024-09-12": Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "o1-mini", "o1-mini-2024-09-12": Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-audio-mini", "gpt-audio-mini-2025-12-15": Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-12-17", "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", "gpt-4o-mini-audio-preview-2024-12-17": Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4o-audio-preview-2024-10-01": Announced shutdown date: 2025-10-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "chatgpt-4o-latest": Announced shutdown date: 2026-02-17. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "codex-mini-latest": Announced shutdown date: 2026-02-12. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-0125-preview", "gpt-4-turbo-preview", "gpt-4-0314": Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-vision-preview": Announced shutdown date: 2024-12-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-0613": Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k-0613": Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-3.5-turbo-1106": Announced shutdown date: 2026-09-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.

      - `"gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more`

        Model ID used to generate the response, like `gpt-6-astra`. OpenAI
        offers a wide range of models with different capabilities, performance
        characteristics, and price points. Refer to the [model guide](/api/docs/models)
        to browse and compare available models.

        - `"gpt-6-astra"`

        - `"gpt-6.1-sol"`

        - `"gpt-6.1-terra"`

        - `"gpt-6-sol"`

        - `"gpt-6-luna"`

        - `"gpt-5.6-sol"`

        - `"gpt-5.6-terra"`

        - `"gpt-5.6-luna"`

        - `"gpt-5.5"`

        - `"gpt-5.5-2026-04-23"`

        - `"gpt-5.4"`

        - `"gpt-5.4-mini"`

        - `"gpt-5.4-nano"`

        - `"gpt-5.4-mini-2026-03-17"`

        - `"gpt-5.4-nano-2026-03-17"`

        - `"gpt-5.3-chat-latest"`

        - `"gpt-5.2"`

        - `"gpt-5.2-2025-12-11"`

        - `"gpt-5.2-chat-latest"`

        - `"gpt-5.2-pro"`

        - `"gpt-5.2-pro-2025-12-11"`

        - `"gpt-5.1"`

        - `"gpt-5.1-2025-11-13"`

        - `"gpt-5.1-codex"`

        - `"gpt-5.1-mini"`

        - `"gpt-5.1-chat-latest"`

        - `"gpt-5"`

        - `"gpt-5-mini"`

        - `"gpt-5-nano"`

        - `"gpt-5-2025-08-07"`

        - `"gpt-5-mini-2025-08-07"`

        - `"gpt-5-nano-2025-08-07"`

        - `"gpt-5-chat-latest"`

        - `"gpt-4.1"`

        - `"gpt-4.1-mini"`

        - `"gpt-4.1-nano"`

        - `"gpt-4.1-2025-04-14"`

        - `"gpt-4.1-mini-2025-04-14"`

        - `"gpt-4.1-nano-2025-04-14"`

        - `"o4-mini"`

        - `"o4-mini-2025-04-16"`

        - `"o3"`

        - `"o3-2025-04-16"`

        - `"o3-mini"`

        - `"o3-mini-2025-01-31"`

        - `"o1"`

        - `"o1-2024-12-17"`

        - `"o1-preview"`

        - `"o1-preview-2024-09-12"`

        - `"o1-mini"`

        - `"o1-mini-2024-09-12"`

        - `"gpt-4o"`

        - `"gpt-4o-2024-11-20"`

        - `"gpt-4o-2024-08-06"`

        - `"gpt-4o-2024-05-13"`

        - `"gpt-audio-mini"`

        - `"gpt-audio-mini-2025-12-15"`

        - `"gpt-4o-audio-preview"`

        - `"gpt-4o-audio-preview-2024-10-01"`

        - `"gpt-4o-audio-preview-2024-12-17"`

        - `"gpt-4o-audio-preview-2025-06-03"`

        - `"gpt-4o-mini-audio-preview"`

        - `"gpt-4o-mini-audio-preview-2024-12-17"`

        - `"gpt-4o-search-preview"`

        - `"gpt-4o-mini-search-preview"`

        - `"gpt-4o-search-preview-2025-03-11"`

        - `"gpt-4o-mini-search-preview-2025-03-11"`

        - `"chatgpt-4o-latest"`

        - `"codex-mini-latest"`

        - `"gpt-4o-mini"`

        - `"gpt-4o-mini-2024-07-18"`

        - `"gpt-4-turbo"`

        - `"gpt-4-turbo-2024-04-09"`

        - `"gpt-4-0125-preview"`

        - `"gpt-4-turbo-preview"`

        - `"gpt-4-1106-preview"`

        - `"gpt-4-vision-preview"`

        - `"gpt-4"`

        - `"gpt-4-0314"`

        - `"gpt-4-0613"`

        - `"gpt-4-32k"`

        - `"gpt-4-32k-0314"`

        - `"gpt-4-32k-0613"`

        - `"gpt-3.5-turbo"`

        - `"gpt-3.5-turbo-16k"`

        - `"gpt-3.5-turbo-0301"`

        - `"gpt-3.5-turbo-0613"`

        - `"gpt-3.5-turbo-1106"`

        - `"gpt-3.5-turbo-0125"`

        - `"gpt-3.5-turbo-16k-0613"`

        - `"o1-pro"`

        - `"o1-pro-2025-03-19"`

        - `"o3-pro"`

        - `"o3-pro-2025-06-10"`

        - `"o3-deep-research"`

        - `"o3-deep-research-2025-06-26"`

        - `"o4-mini-deep-research"`

        - `"o4-mini-deep-research-2025-06-26"`

        - `"computer-use-preview"`

        - `"computer-use-preview-2025-03-11"`

        - `"gpt-5.5-pro"`

        - `"gpt-5.5-pro-2026-04-23"`

        - `"gpt-5-codex"`

        - `"gpt-5-pro"`

        - `"gpt-5-pro-2025-10-06"`

        - `"gpt-5.1-codex-max"`

        - `"gpt-daybreak-blue-latest"`

        - `"gpt-daybreak-red-latest"`

        - `"gpt-5.6-cyber"`

        - `"gpt-6-cyber"`

        - `"gpt-rosalind-research"`

        - `"gpt-6-rosalind"`

      - `(string & {})`

    - `object: "response"`

      The object type of this resource - always set to `response`.

      - `"response"`

    - `output: Array<BetaResponseOutputItem>`

      An array of content items generated by the model.

      - The length and order of items in the `output` array is dependent
        on the model's response.
      - Rather than accessing the first item in the `output` array and
        assuming it's an `assistant` message with the content generated by
        the model, you might consider using the `output_text` property where
        supported in SDKs.

      - `BetaResponseOutputMessage`

        An output message from the model.

      - `BetaResponseFileSearchToolCall`

        The results of a file search tool call. See the
        [file search guide](/api/docs/guides/tools-file-search) for more information.

      - `BetaResponseFunctionToolCall`

        A tool call to run a function. See the
        [function calling guide](/api/docs/guides/function-calling) for more information.

      - `BetaResponseFunctionToolCallOutputItem`

        - `id: string`

          The unique ID of the function call tool output.

        - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          The output from the function call generated by your code.
          Can be a string or an list of output content.

          - `string`

          - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            - `BetaResponseInputText`

              A text input to the model.

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile`

              A file input to the model.

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "function_call_output"`

          The type of the function tool call output. Always `function_call_output`.

          - `"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.

        - `call_id?: string`

          The unique ID of the function tool call generated by the model.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by?: string`

          The identifier of the actor that created the item.

        - `name?: string`

          The name of the tool that produced the output.

        - `namespace?: string`

          The namespace of the tool that produced the output.

      - `AgentMessage`

        - `id: string`

          The unique ID of the agent message.

        - `author: string`

          The sending agent identity.

        - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

          Encrypted content sent between agents.

          - `BetaResponseInputText`

            A text input to the model.

          - `BetaResponseOutputText`

            A text output from the model.

          - `Text`

            A text content.

            - `text: string`

            - `type: "text"`

              - `"text"`

          - `SummaryText`

            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`.

              - `"summary_text"`

          - `ReasoningText`

            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`.

              - `"reasoning_text"`

          - `BetaResponseOutputRefusal`

            A refusal from the model.

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `ComputerScreenshot`

            A screenshot of a computer.

            - `detail: BetaImageDetail`

              The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

            - `file_id: string | null`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: string | null`

              The URL of the screenshot image.

              `format: uri`

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFile`

            A file input to the model.

          - `EncryptedContent`

            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`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The type of the item. Always `agent_message`.

          - `"agent_message"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall`

        - `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.

          - `"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`.

          - `"multi_agent_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput`

        - `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.

          - `"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>`

          Text output returned by the multi-agent action.

          - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

            The annotations of the text output.

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

          - `logprobs?: Array<Logprob>`

        - `type: "multi_agent_call_output"`

          The type of the multi-agent result. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseFunctionWebSearch`

        The results of a web search tool call. See the
        [web search guide](/api/docs/guides/tools-web-search) for more information.

      - `BetaResponseComputerToolCall`

        A tool call to a computer use tool. See the
        [computer use guide](/api/docs/guides/tools-computer-use) for more information.

      - `BetaResponseComputerToolCallOutputItem`

        - `id: string`

          The ID of the computer tool call output.

        - `call_id: string`

          The ID of the computer tool call that produced the output.

        - `output: BetaResponseComputerToolCallOutputScreenshot`

          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.

          - `"completed"`

          - `"incomplete"`

          - `"failed"`

          - `"in_progress"`

        - `type: "computer_call_output"`

          The type of the computer tool call output. Always `computer_call_output`.

          - `"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`

        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](/api/docs/guides/conversation-state).

      - `Program`

        - `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`.

          - `"program"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput`

        - `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.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The type of the item. Always `program_output`.

          - `"program_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseToolSearchCall`

        - `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.

          - `"server"`

          - `"client"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the tool search call item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "tool_search_call"`

          The type of the item. Always `tool_search_call`.

          - `"tool_search_call"`

        - `agent?: Agent`

          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: 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.

          - `"server"`

          - `"client"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the tool search output item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `tools: Array<BetaTool>`

          The loaded tool definitions returned by tool search.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

          - `CodeInterpreter`

            A tool that runs Python code to help generate a response to a prompt.

          - `ProgrammaticToolCalling`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

          - `LocalShell`

            A tool that allows the model to execute shell commands in a local environment.

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "tool_search_output"`

          The type of the item. Always `tool_search_output`.

          - `"tool_search_output"`

        - `agent?: Agent`

          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: string`

          The unique ID of the additional tools item.

        - `role: "unknown" | "user" | "assistant" | 5 more`

          The role that provided the additional tools.

          - `"unknown"`

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"critic"`

          - `"discriminator"`

          - `"developer"`

          - `"tool"`

        - `tools: Array<BetaTool>`

          The additional tool definitions made available at this item.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

          - `CodeInterpreter`

            A tool that runs Python code to help generate a response to a prompt.

          - `ProgrammaticToolCalling`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

          - `LocalShell`

            A tool that allows the model to execute shell commands in a local environment.

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "additional_tools"`

          The type of the item. Always `additional_tools`.

          - `"additional_tools"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseCompactionItem`

        A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

        - `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`.

          - `"compaction"`

        - `agent?: Agent`

          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`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"generating"`

          - `"failed"`

        - `type: "image_generation_call"`

          The type of the image generation call. Always `image_generation_call`.

          - `"image_generation_call"`

        - `action?: "generate" | "edit" | "auto" | null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background?: "transparent" | "opaque" | "auto" | null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error?: Error`

          Details of a moderation failure, when available.

          - `code: string | null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string | null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details?: ModerationDetails`

            Public details for a `moderation_blocked` error, when available.

            - `categories: Array<string>`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" | "output" | "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `quality?: "low" | "medium" | "high" | 3 more | null`

          The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `revised_prompt?: string | null`

          The prompt that was used after any model prompt rewriting.

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

        - `svg_usage?: SvgUsage`

          - `input_tokens: number`

          - `model: string`

          - `output_tokens: number`

          - `reasoning_tokens: number`

          - `total_tokens: number`

      - `BetaResponseCodeInterpreterToolCall`

        A tool call to run code.

      - `LocalShellCall`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: Action`

          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`.

            - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "local_shell_call"`

          The type of the local shell call. Always `local_shell_call`.

          - `"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`

        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`.

          - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseFunctionShellToolCall`

        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`

          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 | BetaResponseContainerReference | null`

          Represents the use of a local environment to perform shell actions.

          - `BetaResponseLocalEnvironment`

            Represents the use of a local environment to perform shell actions.

            - `type: "local"`

              The environment type. Always `local`.

              - `"local"`

          - `BetaResponseContainerReference`

            Represents a container created with /v1/containers.

            - `container_id: string`

            - `type: "container_reference"`

              The environment type. Always `container_reference`.

              - `"container_reference"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The ID of the entity that created this tool call.

      - `BetaResponseFunctionShellToolCallOutput`

        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 | Exit`

            Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

            - `Timeout`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit`

              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`.

                - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "shell_call_output"`

          The type of the shell call output. Always `shell_call_output`.

          - `"shell_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The identifier of the actor that created the item.

      - `BetaResponseApplyPatchToolCall`

        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 | DeleteFile | UpdateFile`

          One of the create_file, delete_file, or update_file operations applied via apply_patch.

          - `CreateFile`

            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.

              - `"create_file"`

          - `DeleteFile`

            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.

              - `"delete_file"`

          - `UpdateFile`

            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.

              - `"update_file"`

        - `status: "in_progress" | "completed"`

          The status of the apply patch tool call. One of `in_progress` or `completed`.

          - `"in_progress"`

          - `"completed"`

        - `type: "apply_patch_call"`

          The type of the item. Always `apply_patch_call`.

          - `"apply_patch_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The ID of the entity that created this tool call.

      - `BetaResponseApplyPatchToolCallOutput`

        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`.

          - `"completed"`

          - `"failed"`

        - `type: "apply_patch_call_output"`

          The type of the item. Always `apply_patch_call_output`.

          - `"apply_patch_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"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`

        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`.

          - `"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?: BetaMcpToolCallError | 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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `McpListTools`

        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`.

          - `"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`

        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`.

          - `"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`

        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`.

          - `"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`

        A call to a custom tool created by the model.

      - `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `created_by?: string`

          The identifier of the actor that created the item.

    - `parallel_tool_calls: boolean`

      Whether to allow the model to run tool calls in parallel.

    - `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.
      We generally recommend altering this or `top_p` but not both.

      `minimum: 0`, `maximum: 2`

    - `tool_choice: BetaToolChoiceOptions | BetaToolChoiceAllowed | BetaToolChoiceTypes | 6 more`

      How the model should select which tool (or tools) to use when generating
      a response. See the `tools` parameter to see how to specify which tools
      the model can call.

      - `BetaToolChoiceOptions = "none" | "auto" | "required"`

        Controls which (if any) tool is called by the model.

        `none` means the model will not call any tool and instead generates a message.

        `auto` means the model can pick between generating a message or calling one or
        more tools.

        `required` means the model must call one or more tools.

        - `"none"`

        - `"auto"`

        - `"required"`

      - `BetaToolChoiceAllowed`

        Constrains the tools available to the model to a pre-defined set.

        - `mode: "auto" | "required"`

          Constrains the tools available to the model to a pre-defined set.

          `auto` allows the model to pick from among the allowed tools and generate a
          message.

          `required` requires the model to call one or more of the allowed tools.

          - `"auto"`

          - `"required"`

        - `tools: Array<Record<string, unknown>>`

          A list of tool definitions that the model should be allowed to call.

          For the Responses API, the list of tool definitions might look like:

          ```json
          [
            { "type": "function", "name": "get_weather" },
            { "type": "mcp", "server_label": "deepwiki" },
            { "type": "image_generation" }
          ]
          ```

        - `type: "allowed_tools"`

          Allowed tool configuration type. Always `allowed_tools`.

          - `"allowed_tools"`

      - `BetaToolChoiceTypes`

        Indicates that the model should use a built-in tool to generate a response.
        [Learn more about built-in tools](/api/docs/guides/tools).

        - `type: "file_search" | "web_search_preview" | "computer" | 5 more`

          The type of hosted tool the model should to use. Learn more about
          [built-in tools](/api/docs/guides/tools).

          Allowed values are:

          - `file_search`
          - `web_search_preview`
          - `computer`
          - `computer_use_preview`
          - `computer_use`
          - `code_interpreter`
          - `image_generation`

          - `"file_search"`

          - `"web_search_preview"`

          - `"computer"`

          - `"computer_use_preview"`

          - `"computer_use"`

          - `"web_search_preview_2025_03_11"`

          - `"image_generation"`

          - `"code_interpreter"`

      - `BetaToolChoiceFunction`

        Use this option to force the model to call a specific function.

        - `name: string`

          The name of the function to call.

        - `type: "function"`

          For function calling, the type is always `function`.

          - `"function"`

      - `BetaToolChoiceMcp`

        Use this option to force the model to call a specific tool on a remote MCP server.

        - `server_label: string`

          The label of the MCP server to use.

        - `type: "mcp"`

          For MCP tools, the type is always `mcp`.

          - `"mcp"`

        - `name?: string | null`

          The name of the tool to call on the server.

      - `BetaToolChoiceCustom`

        Use this option to force the model to call a specific custom tool.

        - `name: string`

          The name of the custom tool to call.

        - `type: "custom"`

          For custom tool calling, the type is always `custom`.

          - `"custom"`

      - `BetaSpecificProgrammaticToolCallingParam`

        - `type: "programmatic_tool_calling"`

          The tool to call. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `BetaToolChoiceApplyPatch`

        Forces the model to call the apply_patch tool when executing a tool call.

        - `type: "apply_patch"`

          The tool to call. Always `apply_patch`.

          - `"apply_patch"`

      - `BetaToolChoiceShell`

        Forces the model to call the shell tool when a tool call is required.

        - `type: "shell"`

          The tool to call. Always `shell`.

          - `"shell"`

    - `tools: Array<BetaTool>`

      An array of tools the model may call while generating a response. You
      can specify which tool to use by setting the `tool_choice` parameter.

      We support the following categories of tools:

      - **Built-in tools**: Tools that are provided by OpenAI that extend the
        model's capabilities, like [web search](/api/docs/guides/tools-web-search)
        or [file search](/api/docs/guides/tools-file-search). Learn more about
        [built-in tools](/api/docs/guides/tools).
      - **MCP Tools**: Integrations with third-party systems via custom MCP servers
        or predefined connectors such as Google Drive and SharePoint. Learn more about
        [MCP Tools](/api/docs/guides/tools-connectors-mcp).
      - **Function calls (custom tools)**: Functions that are defined by you,
        enabling the model to call your own code with strongly typed arguments
        and outputs. Learn more about
        [function calling](/api/docs/guides/function-calling). You can also use
        custom tools to call your own code.

      - `BetaFunctionTool`

        Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

      - `BetaFileSearchTool`

        A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

      - `BetaComputerTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaComputerUsePreviewTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaWebSearchTool`

        Search the Internet for sources related to the prompt. Learn more about the
        [web search tool](/api/docs/guides/tools-web-search).

      - `Mcp`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

      - `CodeInterpreter`

        A tool that runs Python code to help generate a response to a prompt.

      - `ProgrammaticToolCalling`

      - `ImageGeneration`

        A tool that generates images using the GPT image models.

      - `LocalShell`

        A tool that allows the model to execute shell commands in a local environment.

      - `BetaFunctionShellTool`

        A tool that allows the model to execute shell commands.

      - `BetaCustomTool`

        A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

      - `BetaNamespaceTool`

        Groups function/custom tools under a shared namespace.

      - `BetaToolSearchTool`

        Hosted or BYOT tool search configuration for deferred tools.

      - `BetaWebSearchPreviewTool`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

      - `BetaApplyPatchTool`

        Allows the assistant to create, delete, or update files using unified diffs.

    - `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.

      `minimum: 0`, `maximum: 1`

    - `background?: boolean | null`

      Whether to run the model response in the background.
      [Learn more](/api/docs/guides/background).

    - `completed_at?: number | null`

      Unix timestamp (in seconds) of when this Response was completed.
      Only present when the status is `completed`.

      `format: unixtime`

    - `conversation?: Conversation | null`

      The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation.

      - `id: string`

        The unique ID of the conversation that this response was associated with.

    - `image?: Image`

      - `context_compression: "enabled" | "disabled"`

        Effective image context optimization policy.

        - `"enabled"`

        - `"disabled"`

    - `max_output_tokens?: number | null`

      An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/api/docs/guides/reasoning).

    - `max_tool_calls?: number | null`

      The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

    - `moderation?: Moderation | null`

      Moderation results for the response input and output, if moderated completions were requested.

      - `input: ModerationResult | Error`

        Moderation for the response input.

        - `ModerationResult`

          A moderation result produced for the response input or output.

          - `categories: Record<string, boolean>`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: Record<string, Array<"text" | "image">>`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: Record<string, number>`

            A dictionary of moderation categories to scores.

          - `flagged: boolean`

            A boolean indicating whether the content was flagged by any category.

          - `model: string`

            The moderation model that produced this result.

          - `type: "moderation_result"`

            The object type, which was always `moderation_result` for successful moderation results.

            - `"moderation_result"`

        - `Error`

          An error produced while attempting moderation for the response input or output.

          - `code: string`

            The error code.

          - `message: string`

            The error message.

          - `type: "error"`

            The object type, which was always `error` for moderation failures.

            - `"error"`

      - `output: ModerationResult | Error`

        Moderation for the response output.

        - `ModerationResult`

          A moderation result produced for the response input or output.

          - `categories: Record<string, boolean>`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: Record<string, Array<"text" | "image">>`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: Record<string, number>`

            A dictionary of moderation categories to scores.

          - `flagged: boolean`

            A boolean indicating whether the content was flagged by any category.

          - `model: string`

            The moderation model that produced this result.

          - `type: "moderation_result"`

            The object type, which was always `moderation_result` for successful moderation results.

            - `"moderation_result"`

        - `Error`

          An error produced while attempting moderation for the response input or output.

          - `code: string`

            The error code.

          - `message: string`

            The error message.

          - `type: "error"`

            The object type, which was always `error` for moderation failures.

            - `"error"`

    - `previous_response_id?: string | null`

      The unique ID of the previous response to the model. Use this to
      create multi-turn conversations. Learn more about
      [conversation state](/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.

    - `prompt?: BetaResponsePrompt | null`

      Reference to a prompt template and its variables.
      [Learn more](/api/docs/guides/text?api-mode=responses#version-prompts-in-code).

      - `id: string`

        The unique identifier of the prompt template to use.

      - `variables?: Record<string, string | BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile> | null`

        Optional map of values to substitute in for variables in your
        prompt. The substitution values can either be strings, or other
        Response input types like images or files.

        - `string`

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile`

          A file input to the model.

      - `version?: string | null`

        Optional version of the prompt template.

    - `prompt_cache_diagnostics?: CacheMiss | CacheHit | ComparisonResponseNotFound | Unavailable`

      Prompt cache diagnostics requested for this response.

      - `CacheMiss`

        - `cache_missed_tokens: number`

          The estimated number of input tokens affected after the first detected divergence.

        - `reason: "model_changed" | "prompt_cache_key_changed" | "tools_changed" | 6 more`

          The reason prompt cache reuse did not occur.

          - `"model_changed"`

          - `"prompt_cache_key_changed"`

          - `"tools_changed"`

          - `"text_format_changed"`

          - `"reasoning_effort_changed"`

          - `"verbosity_changed"`

          - `"context_compacted"`

          - `"input_changed"`

          - `"service_tier_changed"`

        - `type: "cache_miss"`

          - `"cache_miss"`

        - `comparison_reusable_tokens?: number`

          The raw token count of the reusable prefix in the compared response.

      - `CacheHit`

        - `type: "cache_hit"`

          - `"cache_hit"`

      - `ComparisonResponseNotFound`

        - `type: "comparison_response_not_found"`

          - `"comparison_response_not_found"`

      - `Unavailable`

        - `type: "unavailable"`

          - `"unavailable"`

    - `prompt_cache_key?: string | null`

      Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/api/docs/guides/prompt-caching).

    - `prompt_cache_options?: PromptCacheOptions`

      The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

      - `mode: "implicit" | "explicit"`

        Whether implicit prompt-cache breakpoints were enabled.

        - `"implicit"`

        - `"explicit"`

      - `ttl: "30m" | "12h"`

        The minimum lifetime applied to each cache breakpoint.

        - `"30m"`

        - `"12h"`

      - `comparison_response_id?: string | null`

        The response ID supplied as the prompt cache diagnostics comparison.

    - `prompt_cache_retention?: "in_memory" | "24h" | null`

      Deprecated. Use `prompt_cache_options.ttl` instead.

      The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/api/docs/guides/prompt-caching#prompt-cache-retention).
      This field expresses a maximum retention policy, while
      `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two
      fields are independent and do not interact.
      For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported.

      For older models that support both `in_memory` and `24h`, the default depends on your organization's data retention policy:

      - Organizations without ZDR enabled default to `24h`.
      - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified.

      - `"in_memory"`

      - `"24h"`

    - `reasoning?: Reasoning | null`

      Configuration options for
      [reasoning models](/api/docs/guides/reasoning).

      - `context?: "auto" | "current_turn" | "all_turns" | null`

        Controls which reasoning items are rendered back to the model on later turns.
        If omitted or set to `auto`, the model determines the context mode. The
        `gpt-5.6` model family defaults to `all_turns`; earlier models default to
        `current_turn`.

        When returned on a response, this is the effective reasoning context mode
        used for the response.

        - `"auto"`

        - `"current_turn"`

        - `"all_turns"`

      - `effort?: "none" | "minimal" | "low" | 4 more | null`

        Constrains effort on reasoning for reasoning models. Currently supported
        values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
        Reducing reasoning effort can result in faster responses and fewer tokens
        used on reasoning in a response. Not all reasoning models support every
        value. See the
        [reasoning guide](/api/docs/guides/reasoning)
        for model-specific support.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `generate_summary?: "auto" | "concise" | "detailed" | null`

        **Deprecated:** use `summary` instead.

        A summary of the reasoning performed by the model. This can be
        useful for debugging and understanding the model's reasoning process.
        One of `auto`, `concise`, or `detailed`.

        - `"auto"`

        - `"concise"`

        - `"detailed"`

      - `mode?: (string & {}) | "standard" | "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `(string & {})`

        - `"standard" | "pro"`

          - `"standard"`

          - `"pro"`

      - `summary?: "auto" | "concise" | "detailed" | null`

        A summary of the reasoning performed by the model. This can be
        useful for debugging and understanding the model's reasoning process.
        One of `auto`, `concise`, or `detailed`.

        `concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.

        - `"auto"`

        - `"concise"`

        - `"detailed"`

    - `safety_identifier?: string | null`

      A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.
      The IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

      `maxLength: 128`

    - `service_tier?: BetaServiceTier | null`

      Specifies the processing type used for serving the request.

      - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
      - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
      - If set to '[flex](/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.
      - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.
      - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for `gpt-5.6-sol`; a response served through it will show `service_tier=ultrafast`.
      - When not set, the default behavior is 'auto'.

      When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

      - `"auto"`

      - `"default"`

      - `"flex"`

      - `"scale"`

      - `"priority"`

      - `"fast"`

      - `"ultrafast"`

    - `status?: BetaResponseStatus`

      The status of the response generation. One of `completed`, `failed`,
      `in_progress`, `cancelled`, `queued`, or `incomplete`.

      - `"completed"`

      - `"failed"`

      - `"in_progress"`

      - `"cancelled"`

      - `"queued"`

      - `"incomplete"`

    - `text?: BetaResponseTextConfig`

      Configuration options for a text response from the model. Can be plain
      text or structured JSON data. Learn more:

      - [Text inputs and outputs](/api/docs/guides/text)
      - [Structured Outputs](/api/docs/guides/structured-outputs)

      - `format?: BetaResponseFormatTextConfig`

        An object specifying the format that the model must output.

        Configuring `{ "type": "json_schema" }` enables Structured Outputs,
        which ensures the model will match your supplied JSON schema. Learn more in the
        [Structured Outputs guide](/api/docs/guides/structured-outputs).

        The default format is `{ "type": "text" }` with no additional options.

        **Not recommended for gpt-4o and newer models:**

        Setting to `{ "type": "json_object" }` enables the older JSON mode, which
        ensures the message the model generates is valid JSON. Using `json_schema`
        is preferred for models that support it.

        - `Text`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig`

          JSON Schema response format. Used to generate structured JSON responses.
          Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

        - `JSONObject`

          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`.

            - `"json_object"`

      - `verbosity?: "low" | "medium" | "high" | null`

        Constrains the verbosity of the model's response. Lower values will result in
        more concise responses, while higher values will result in more verbose responses.
        Currently supported values are `low`, `medium`, and `high`. The default is
        `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tool_usage?: ToolUsage`

      Usage reported by hosted tools, separate from base model `usage`. The field
      can be omitted when tool usage is unavailable. When present, tool families
      with no recorded usage have zero counts.

      `image_gen` sums available token counts across image generation calls.
      Calls with missing or incomplete usage records may be skipped. Output
      token details and cached input counts can be omitted. An omitted cache
      count means cache usage is unknown.

      `web_search.num_requests` counts billable searches. Discounted searches
      and actions such as opening a page are excluded. Use billing records to
      reconcile final charges.

      - `image_gen: ImageGen`

        Aggregated usage statistics for image generation tool calls.

        - `input_tokens: number`

          The number of tokens (images and text) in the input prompt.

        - `input_tokens_details: InputTokensDetails`

          The input tokens detailed information for the image generation.

          - `image_tokens: number`

            The number of image tokens in the input prompt.

          - `text_tokens: number`

            The number of text tokens in the input prompt.

        - `output_tokens: number`

          The number of output tokens generated by the model.

        - `total_tokens: number`

          The total number of tokens (images and text) used for the image generation.

        - `cached_tokens?: number`

        - `cached_tokens_details?: CachedTokensDetails`

          - `cached_image_tokens: number`

          - `cached_text_tokens: number`

        - `output_tokens_details?: OutputTokensDetails`

          The output token details for the image generation.

          - `image_tokens: number`

            The number of image output tokens generated by the model.

          - `text_tokens: number`

            The number of text output tokens generated by the model.

      - `web_search: WebSearch`

        Aggregated billable usage statistics for web search tool calls.

        - `num_requests: number`

          The number of billable web search requests issued.

    - `top_logprobs?: number | null`

      An integer between 0 and 20 specifying the maximum number of most likely
      tokens to return at each token position, each with an associated log
      probability. In some cases, the number of returned tokens may be fewer than
      requested.

      `minimum: 0`, `maximum: 20`

    - `truncation?: "auto" | "disabled" | null`

      The truncation strategy to use for the model response.

      - `auto`: If the input to this Response exceeds
        the model's context window size, the model will truncate the
        response to fit the context window by dropping items from the beginning of the conversation.
        On some models, trimming can begin earlier because the API subtracts the model's
        maximum output allowance from its input limit, even if you set a lower `max_output_tokens`.
      - `disabled` (default): If the input size will exceed the context window
        size for a model, the request will fail with a 400 error.

      - `"auto"`

      - `"disabled"`

    - `usage?: BetaResponseUsage`

      Represents token usage details including input tokens, output tokens,
      a breakdown of output tokens, and the total tokens used.

      - `input_tokens: number`

        The number of input tokens.

      - `input_tokens_details: InputTokensDetails`

        A detailed breakdown of the input tokens.

        - `cache_write_tokens: number`

          The number of input tokens that were written to the cache.

        - `cached_tokens: number`

          The number of tokens that were retrieved from the cache.
          [More on prompt caching](/api/docs/guides/prompt-caching).

        - `cache_write_tokens_details?: CacheWriteTokensDetails`

          - `ttl_12h_tokens: number`

            The number of input tokens written with 12-hour retention.

          - `ttl_30m_tokens: number`

            The number of input tokens written with 30-minute retention.

      - `output_tokens: number`

        The number of output tokens.

      - `output_tokens_details: OutputTokensDetails`

        A detailed breakdown of the output tokens.

        - `reasoning_tokens: number`

          The number of reasoning tokens.

      - `total_tokens: number`

        The total number of tokens used.

    - `user?: string`

      This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.
      A stable identifier for your end-users.
      Used to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

  - `sequence_number: number`

    The sequence number for this event.

  - `type: "response.completed"`

    The type of the event. Always `response.completed`.

    - `"response.completed"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Computer Tool Call

- `BetaResponseComputerToolCall`

  A tool call to a computer use tool. See the
  [computer use guide](/api/docs/guides/tools-computer-use) 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.

    - `"in_progress"`

    - `"completed"`

    - `"incomplete"`

  - `type: "computer_call"`

    The type of the computer call. Always `computer_call`.

    - `"computer_call"`

  - `action?: BetaComputerAction`

    A click action.

    - `Click`

      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`.

        - `"left"`

        - `"right"`

        - `"wheel"`

        - `"back"`

        - `"forward"`

      - `type: "click"`

        Specifies the event type. For a click action, this property is always `click`.

        - `"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`

      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`.

        - `"double_click"`

      - `x: number`

        The x-coordinate where the double click occurred.

      - `y: number`

        The y-coordinate where the double click occurred.

    - `Drag`

      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`.

        - `"drag"`

      - `keys?: Array<string> | null`

        The keys being held while dragging the mouse.

    - `Keypress`

      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`.

        - `"keypress"`

    - `Move`

      A mouse move action.

      - `type: "move"`

        Specifies the event type. For a move action, this property is always set to `move`.

        - `"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`

      A screenshot action.

      - `type: "screenshot"`

        Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

        - `"screenshot"`

    - `Scroll`

      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`.

        - `"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`

      An action to type in text.

      - `text: string`

        The text to type.

      - `type: "type"`

        Specifies the event type. For a type action, this property is always set to `type`.

        - `"type"`

    - `Wait`

      A wait action.

      - `type: "wait"`

        Specifies the event type. For a wait action, this property is always set to `wait`.

        - `"wait"`

  - `actions?: BetaComputerActionList`

    Flattened batched actions for `computer_use`. Each action includes an
    `type` discriminator and action-specific fields.

    - `Click`

      A click action.

    - `DoubleClick`

      A double click action.

    - `Drag`

      A drag action.

    - `Keypress`

      A collection of keypresses the model would like to perform.

    - `Move`

      A mouse move action.

    - `Screenshot`

      A screenshot action.

    - `Scroll`

      A scroll action.

    - `Type`

      An action to type in text.

    - `Wait`

      A wait action.

  - `agent?: Agent | null`

    The agent that produced this item.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Computer Tool Call Output Item

- `BetaResponseComputerToolCallOutputItem`

  - `id: string`

    The ID of the computer tool call output.

  - `call_id: string`

    The ID of the computer tool call that produced the output.

  - `output: BetaResponseComputerToolCallOutputScreenshot`

    A computer screenshot image used with the computer use tool.

    - `type: "computer_screenshot"`

      Specifies the event type. For a computer screenshot, this property is
      always set to `computer_screenshot`.

      - `"computer_screenshot"`

    - `file_id?: string`

      The identifier of an uploaded file that contains the screenshot.

    - `image_url?: string`

      The URL of the screenshot image.

      `format: uri`

  - `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.

    - `"completed"`

    - `"incomplete"`

    - `"failed"`

    - `"in_progress"`

  - `type: "computer_call_output"`

    The type of the computer tool call output. Always `computer_call_output`.

    - `"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.

### Beta Response Computer Tool Call Output Screenshot

- `BetaResponseComputerToolCallOutputScreenshot`

  A computer screenshot image used with the computer use tool.

  - `type: "computer_screenshot"`

    Specifies the event type. For a computer screenshot, this property is
    always set to `computer_screenshot`.

    - `"computer_screenshot"`

  - `file_id?: string`

    The identifier of an uploaded file that contains the screenshot.

  - `image_url?: string`

    The URL of the screenshot image.

    `format: uri`

### Beta Response Configuration Update Item

- `BetaResponseConfigurationUpdateItem`

  A configuration update for subsequent responses. Each setting stays in effect
  until a later update replaces that setting.

  - `id: string`

    The unique ID of the configuration update item.

  - `type: "configuration_update"`

    The item type. Always `configuration_update`.

    - `"configuration_update"`

  - `agent?: Agent`

    The agent that produced this item.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

  - `reasoning?: Reasoning`

    The reasoning configuration applied by this update.

    - `effort?: "none" | "minimal" | "low" | 4 more | null`

      The reasoning effort used for subsequent responses until another
      configuration update replaces it.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

  - `text?: Text`

    The text output configuration for subsequent responses.

    - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

      Use a JSON schema for structured output or text to return to plain text.

      - `Text`

        Default response format. Used to generate text responses.

        - `type: "text"`

          The type of response format being defined. Always `text`.

          - `"text"`

      - `BetaResponseFormatTextJSONSchemaConfig`

        JSON Schema response format. Used to generate structured JSON responses.
        Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `schema: Record<string, unknown>`

          The schema for the response format, described as a JSON Schema object.
          Learn how to build JSON schemas [here](https://json-schema.org/).

        - `type: "json_schema"`

          The type of response format being defined. Always `json_schema`.

          - `"json_schema"`

        - `description?: string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `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](/api/docs/guides/structured-outputs).

### Beta Response Configuration Update Item Param

- `BetaResponseConfigurationUpdateItemParam`

  An update to the conversation's response configuration. Supply reasoning,
  text, or both. Each setting stays in effect until a later update replaces it.

  - `type: "configuration_update"`

    The item type. Always `configuration_update`.

    - `"configuration_update"`

  - `id?: string | null`

    The unique ID of the configuration update item.

  - `agent?: Agent | null`

    The agent that produced this item.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

  - `reasoning?: Reasoning`

    Updates to reasoning configuration. Only effort is supported.

    - `effort?: "none" | "minimal" | "low" | 4 more | null`

      The reasoning effort to use for subsequent responses until another
      configuration update replaces it.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

  - `text?: Text`

    The text output configuration for subsequent responses.

    - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

      Use a JSON schema for structured output or text to return to plain text.

      - `Text`

        Default response format. Used to generate text responses.

        - `type: "text"`

          The type of response format being defined. Always `text`.

          - `"text"`

      - `BetaResponseFormatTextJSONSchemaConfig`

        JSON Schema response format. Used to generate structured JSON responses.
        Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `schema: Record<string, unknown>`

          The schema for the response format, described as a JSON Schema object.
          Learn how to build JSON schemas [here](https://json-schema.org/).

        - `type: "json_schema"`

          The type of response format being defined. Always `json_schema`.

          - `"json_schema"`

        - `description?: string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `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](/api/docs/guides/structured-outputs).

### Beta Response Container Reference

- `BetaResponseContainerReference`

  Represents a container created with /v1/containers.

  - `container_id: string`

  - `type: "container_reference"`

    The environment type. Always `container_reference`.

    - `"container_reference"`

### Beta Response Content

- `BetaResponseContent = BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile | 3 more`

  Multi-modal input and output contents.

  - `BetaResponseInputText`

    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`.

      - `"input_text"`

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

  - `BetaResponseInputImage`

    An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

    - `detail: BetaImageDetail`

      The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

      - `"low"`

      - `"high"`

      - `"auto"`

      - `"original"`

    - `type: "input_image"`

      The type of the input item. Always `input_image`.

      - `"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.

      `format: uri`

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

  - `BetaResponseInputFile`

    A file input to the model.

    - `type: "input_file"`

      The type of the input item. Always `input_file`.

      - `"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`.

      - `"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.

      `format: uri`

    - `filename?: string`

      The name of the file to be sent to the model.

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

  - `BetaResponseOutputText`

    A text output from the model.

    - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

      The annotations of the text output.

      - `FileCitation`

        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 in the output text at which to insert the file citation.

        - `type: "file_citation"`

          The type of the file citation. Always `file_citation`.

          - `"file_citation"`

      - `URLCitation`

        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_citation"`

        - `url: string`

          The URL of the web resource.

          `format: uri`

      - `ContainerFileCitation`

        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`.

          - `"container_file_citation"`

      - `FilePath`

        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`.

          - `"file_path"`

    - `text: string`

      The text output from the model.

    - `type: "output_text"`

      The type of the output text. Always `output_text`.

      - `"output_text"`

    - `logprobs?: Array<Logprob>`

      - `token: string`

      - `bytes: Array<number>`

      - `logprob: number`

      - `top_logprobs: Array<TopLogprob>`

        - `token: string`

        - `bytes: Array<number>`

        - `logprob: number`

  - `BetaResponseOutputRefusal`

    A refusal from the model.

    - `refusal: string`

      The refusal explanation from the model.

    - `type: "refusal"`

      The type of the refusal. Always `refusal`.

      - `"refusal"`

  - `ReasoningText`

    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`.

      - `"reasoning_text"`

### Beta Response Content Part Added Event

- `BetaResponseContentPartAddedEvent`

  Emitted when a new content part is added.

  - `content_index: number`

    The index of the content part that was added.

  - `item_id: string`

    The ID of the output item that the content part was added to.

  - `output_index: number`

    The index of the output item that the content part was added to.

  - `part: BetaResponseOutputText | BetaResponseOutputRefusal | ReasoningText`

    The content part that was added.

    - `BetaResponseOutputText`

      A text output from the model.

      - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

        The annotations of the text output.

        - `FileCitation`

          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 in the output text at which to insert the file citation.

          - `type: "file_citation"`

            The type of the file citation. Always `file_citation`.

            - `"file_citation"`

        - `URLCitation`

          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_citation"`

          - `url: string`

            The URL of the web resource.

            `format: uri`

        - `ContainerFileCitation`

          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`.

            - `"container_file_citation"`

        - `FilePath`

          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`.

            - `"file_path"`

      - `text: string`

        The text output from the model.

      - `type: "output_text"`

        The type of the output text. Always `output_text`.

        - `"output_text"`

      - `logprobs?: Array<Logprob>`

        - `token: string`

        - `bytes: Array<number>`

        - `logprob: number`

        - `top_logprobs: Array<TopLogprob>`

          - `token: string`

          - `bytes: Array<number>`

          - `logprob: number`

    - `BetaResponseOutputRefusal`

      A refusal from the model.

      - `refusal: string`

        The refusal explanation from the model.

      - `type: "refusal"`

        The type of the refusal. Always `refusal`.

        - `"refusal"`

    - `ReasoningText`

      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`.

        - `"reasoning_text"`

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.content_part.added"`

    The type of the event. Always `response.content_part.added`.

    - `"response.content_part.added"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Content Part Done Event

- `BetaResponseContentPartDoneEvent`

  Emitted when a content part is done.

  - `content_index: number`

    The index of the content part that is done.

  - `item_id: string`

    The ID of the output item that the content part was added to.

  - `output_index: number`

    The index of the output item that the content part was added to.

  - `part: BetaResponseOutputText | BetaResponseOutputRefusal | ReasoningText`

    The content part that is done.

    - `BetaResponseOutputText`

      A text output from the model.

      - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

        The annotations of the text output.

        - `FileCitation`

          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 in the output text at which to insert the file citation.

          - `type: "file_citation"`

            The type of the file citation. Always `file_citation`.

            - `"file_citation"`

        - `URLCitation`

          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_citation"`

          - `url: string`

            The URL of the web resource.

            `format: uri`

        - `ContainerFileCitation`

          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`.

            - `"container_file_citation"`

        - `FilePath`

          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`.

            - `"file_path"`

      - `text: string`

        The text output from the model.

      - `type: "output_text"`

        The type of the output text. Always `output_text`.

        - `"output_text"`

      - `logprobs?: Array<Logprob>`

        - `token: string`

        - `bytes: Array<number>`

        - `logprob: number`

        - `top_logprobs: Array<TopLogprob>`

          - `token: string`

          - `bytes: Array<number>`

          - `logprob: number`

    - `BetaResponseOutputRefusal`

      A refusal from the model.

      - `refusal: string`

        The refusal explanation from the model.

      - `type: "refusal"`

        The type of the refusal. Always `refusal`.

        - `"refusal"`

    - `ReasoningText`

      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`.

        - `"reasoning_text"`

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.content_part.done"`

    The type of the event. Always `response.content_part.done`.

    - `"response.content_part.done"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Conversation Param

- `BetaResponseConversationParam`

  The conversation that this response belongs to.

  - `id: string`

    The unique ID of the conversation.

### Beta Response Created Event

- `BetaResponseCreatedEvent`

  An event that is emitted when a response is created.

  - `response: BetaResponse`

    The response that was created.

    - `id: string`

      Unique identifier for this Response.

    - `access_programs: AccessPrograms | null`

      - `cyber: "standard" | "daybreak_blue" | "daybreak_red"`

        The effective Cyber access program used for this response.

        - `"standard"`

        - `"daybreak_blue"`

        - `"daybreak_red"`

    - `created_at: number`

      Unix timestamp (in seconds) of when this Response was created.

      `format: unixtime`

    - `error: BetaResponseError | null`

      An error object returned when the model fails to generate a Response.

      - `code: "server_error" | "rate_limit_exceeded" | "invalid_prompt" | 18 more`

        The error code for the response.

        - `"server_error"`

        - `"rate_limit_exceeded"`

        - `"invalid_prompt"`

        - `"data_residency_mismatch"`

        - `"bio_policy"`

        - `"misalignment_policy_violation"`

        - `"vector_store_timeout"`

        - `"invalid_image"`

        - `"invalid_image_format"`

        - `"invalid_base64_image"`

        - `"invalid_image_url"`

        - `"image_too_large"`

        - `"image_too_small"`

        - `"image_parse_error"`

        - `"image_content_policy_violation"`

        - `"invalid_image_mode"`

        - `"image_file_too_large"`

        - `"unsupported_image_media_type"`

        - `"empty_image_file"`

        - `"failed_to_download_image"`

        - `"image_file_not_found"`

      - `message: string`

        A human-readable description of the error.

      - `misalignment?: Misalignment`

        - `detailed_explanation?: string`

          The public explanation for this block.

        - `error_type?: (string & {}) | "potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

          An optional classification; clients must accept additional values.

          - `(string & {})`

          - `"potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

            - `"potentially_unintended_data_transfer"`

            - `"potentially_unintended_data_access"`

            - `"potentially_unintended_destructive_activity"`

            - `"other"`

        - `review_target?: string | null`

          An opaque target for explicitly continuing this review, or null when unavailable.

          `minLength: 1`, `maxLength: 96`

        - `steer?: Steer`

          An optional public continuation instruction.

          - `message: string`

            The public continuation instruction.

      - `param?: string | null`

        The request parameter associated with the error, or null if none was recorded.

      - `type?: string | null`

        The original error type, or null if it was not recorded.

    - `incomplete_details: IncompleteDetails | null`

      Details about why the response is incomplete.

      - `reason?: "max_output_tokens" | "max_messages" | "content_filter" | "steered"`

        The reason why the response is incomplete. `steered` means
        the response stopped at a safe output boundary after a
        WebSocket `response.steer` event. The server can then create
        a successor response automatically with the queued input.

        - `"max_output_tokens"`

        - `"max_messages"`

        - `"content_filter"`

        - `"steered"`

    - `instructions: string | Array<BetaResponseInputItem> | null`

      A system (or developer) message inserted into the model's context.

      When using along with `previous_response_id`, the instructions from a previous
      response will not be carried over to the next response. This makes it simple
      to swap out system (or developer) messages in new responses.

      - `string`

      - `Array<BetaResponseInputItem>`

        - `BetaEasyInputMessage`

          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.

            - `string`

            - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

              A list of one or many input items to the model, containing different content
              types.

              - `BetaResponseInputText`

                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`.

                  - `"input_text"`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImage`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

                - `detail: BetaImageDetail`

                  The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                  - `"low"`

                  - `"high"`

                  - `"auto"`

                  - `"original"`

                - `type: "input_image"`

                  The type of the input item. Always `input_image`.

                  - `"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.

                  `format: uri`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFile`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"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`.

                  - `"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.

                  `format: uri`

                - `filename?: string`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

          - `role: "user" | "assistant" | "system" | "developer"`

            The role of the message input. One of `user`, `assistant`, `system`, or
            `developer`.

            - `"user"`

            - `"assistant"`

            - `"system"`

            - `"developer"`

          - `phase?: "commentary" | "final_answer" | 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.

            - `"commentary"`

            - `"final_answer"`

          - `type?: "message"`

            The type of the message input. Always `message`.

            - `"message"`

        - `Message`

          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.

          - `content: BetaResponseInputMessageContentList`

            A list of one or many input items to the model, containing different content
            types.

          - `role: "user" | "system" | "developer"`

            The role of the message input. One of `user`, `system`, or `developer`.

            - `"user"`

            - `"system"`

            - `"developer"`

          - `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"`

            The status of item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type?: "message"`

            The type of the message input. Always set to `message`.

            - `"message"`

        - `BetaResponseOutputMessage`

          An output message from the model.

          - `id: string`

            The unique ID of the output message.

          - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

            The content of the output message.

            - `BetaResponseOutputText`

              A text output from the model.

              - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

                The annotations of the text output.

                - `FileCitation`

                  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 in the output text at which to insert the file citation.

                  - `type: "file_citation"`

                    The type of the file citation. Always `file_citation`.

                    - `"file_citation"`

                - `URLCitation`

                  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_citation"`

                  - `url: string`

                    The URL of the web resource.

                    `format: uri`

                - `ContainerFileCitation`

                  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`.

                    - `"container_file_citation"`

                - `FilePath`

                  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`.

                    - `"file_path"`

              - `text: string`

                The text output from the model.

              - `type: "output_text"`

                The type of the output text. Always `output_text`.

                - `"output_text"`

              - `logprobs?: Array<Logprob>`

                - `token: string`

                - `bytes: Array<number>`

                - `logprob: number`

                - `top_logprobs: Array<TopLogprob>`

                  - `token: string`

                  - `bytes: Array<number>`

                  - `logprob: number`

            - `BetaResponseOutputRefusal`

              A refusal from the model.

              - `refusal: string`

                The refusal explanation from the model.

              - `type: "refusal"`

                The type of the refusal. Always `refusal`.

                - `"refusal"`

          - `role: "assistant"`

            The role of the output message. Always `assistant`.

            - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "message"`

            The type of the output message. Always `message`.

            - `"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" | "final_answer" | 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.

            - `"commentary"`

            - `"final_answer"`

        - `BetaResponseFileSearchToolCall`

          The results of a file search tool call. See the
          [file search guide](/api/docs/guides/tools-file-search) 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`,

            - `"in_progress"`

            - `"searching"`

            - `"completed"`

            - `"incomplete"`

            - `"failed"`

          - `type: "file_search_call"`

            The type of the file search tool call. Always `file_search_call`.

            - `"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.

              - `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.

              `format: float`

            - `text?: string`

              The text that was retrieved from the file.

        - `BetaResponseComputerToolCall`

          A tool call to a computer use tool. See the
          [computer use guide](/api/docs/guides/tools-computer-use) 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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "computer_call"`

            The type of the computer call. Always `computer_call`.

            - `"computer_call"`

          - `action?: BetaComputerAction`

            A click action.

            - `Click`

              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`.

                - `"left"`

                - `"right"`

                - `"wheel"`

                - `"back"`

                - `"forward"`

              - `type: "click"`

                Specifies the event type. For a click action, this property is always `click`.

                - `"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`

              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`.

                - `"double_click"`

              - `x: number`

                The x-coordinate where the double click occurred.

              - `y: number`

                The y-coordinate where the double click occurred.

            - `Drag`

              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`.

                - `"drag"`

              - `keys?: Array<string> | null`

                The keys being held while dragging the mouse.

            - `Keypress`

              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`.

                - `"keypress"`

            - `Move`

              A mouse move action.

              - `type: "move"`

                Specifies the event type. For a move action, this property is always set to `move`.

                - `"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`

              A screenshot action.

              - `type: "screenshot"`

                Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

                - `"screenshot"`

            - `Scroll`

              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`.

                - `"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`

              An action to type in text.

              - `text: string`

                The text to type.

              - `type: "type"`

                Specifies the event type. For a type action, this property is always set to `type`.

                - `"type"`

            - `Wait`

              A wait action.

              - `type: "wait"`

                Specifies the event type. For a wait action, this property is always set to `wait`.

                - `"wait"`

          - `actions?: BetaComputerActionList`

            Flattened batched actions for `computer_use`. Each action includes an
            `type` discriminator and action-specific fields.

            - `Click`

              A click action.

            - `DoubleClick`

              A double click action.

            - `Drag`

              A drag action.

            - `Keypress`

              A collection of keypresses the model would like to perform.

            - `Move`

              A mouse move action.

            - `Screenshot`

              A screenshot action.

            - `Scroll`

              A scroll action.

            - `Type`

              An action to type in text.

            - `Wait`

              A wait action.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCallOutput`

          The output of a computer tool call.

          - `call_id: string`

            The ID of the computer tool call that produced the output.

            `minLength: 1`, `maxLength: 64`

          - `output: BetaResponseComputerToolCallOutputScreenshot`

            A computer screenshot image used with the computer use tool.

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is
              always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `file_id?: string`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url?: string`

              The URL of the screenshot image.

              `format: uri`

          - `type: "computer_call_output"`

            The type of the computer tool call output. Always `computer_call_output`.

            - `"computer_call_output"`

          - `id?: string | null`

            The ID of the computer tool call output.

          - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

            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.

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseFunctionWebSearch`

          The results of a web search tool call. See the
          [web search guide](/api/docs/guides/tools-web-search) for more information.

          - `id: string`

            The unique ID of the web search tool call.

          - `action: Search | OpenPage | FindInPage`

            An object describing the specific action taken in this web search call.
            Includes details on how the model used the web (search, open_page, find_in_page).

            - `Search`

              Action type "search" - Performs a web search query.

              - `type: "search"`

                The action type.

                - `"search"`

              - `queries?: Array<string>`

                The search queries.

              - `query?: string`

                The search query.

              - `sources?: Array<Source>`

                The sources used in the search.

                - `type: "url"`

                  The type of source. Always `url`.

                  - `"url"`

                - `url: string`

                  The URL of the source.

                  `format: uri`

            - `OpenPage`

              Action type "open_page" - Opens a specific URL from search results.

              - `type: "open_page"`

                The action type.

                - `"open_page"`

              - `url?: string | null`

                The URL opened by the model.

                `format: uri`

            - `FindInPage`

              Action type "find_in_page": Searches for a pattern within a loaded page.

              - `pattern: string`

                The pattern or text to search for within the page.

              - `type: "find_in_page"`

                The action type.

                - `"find_in_page"`

              - `url: string`

                The URL of the page searched for the pattern.

                `format: uri`

          - `status: "in_progress" | "searching" | "completed" | 2 more`

            The status of the web search tool call.

            - `"in_progress"`

            - `"searching"`

            - `"completed"`

            - `"failed"`

            - `"incomplete"`

          - `type: "web_search_call"`

            The type of the web search tool call. Always `web_search_call`.

            - `"web_search_call"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `BetaResponseFunctionToolCall`

          A tool call to run a function. See the
          [function calling guide](/api/docs/guides/function-calling) 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`.

            - `"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.

          - `async?: boolean`

            Whether the function tool call runs asynchronously.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `FunctionCallOutput`

          The output of a function tool call.

          - `output: string | BetaResponseFunctionCallOutputItemList`

            Text, image, or file output of the function tool call.

            - `string`

            - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                  `maxLength: 10485760`

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImageContent`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

                - `type: "input_image"`

                  The type of the input item. Always `input_image`.

                  - `"input_image"`

                - `detail?: BetaImageDetail | null`

                  The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                - `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.

                  `maxLength: 20971520`, `format: uri`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFileContent`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"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`.

                  - `"auto"`

                  - `"low"`

                  - `"high"`

                - `file_data?: string | null`

                  The base64-encoded data of the file to be sent to the model.

                  `maxLength: 73400320`

                - `file_id?: string | null`

                  The ID of the file to be sent to the model.

                - `file_url?: string | null`

                  The URL of the file to be sent to the model.

                  `format: uri`

                - `filename?: string | null`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

          - `type: "function_call_output"`

            The type of the function tool call output. Always `function_call_output`.

            - `"function_call_output"`

          - `id?: string | null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the function tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name?: string | null`

            The name of the tool that produced the output.

            `minLength: 1`, `maxLength: 128`

          - `namespace?: string | null`

            The namespace of the tool that produced the output.

            `minLength: 1`, `maxLength: 128`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AgentMessage`

          A message routed between agents.

          - `author: string`

            The sending agent identity.

          - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

            Plaintext, image, or encrypted content sent between agents.

            - `BetaResponseInputTextContent`

              A text input to the model.

            - `BetaResponseInputImageContent`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `EncryptedContent`

              Opaque encrypted content that Responses API decrypts inside trusted model execution.

              - `encrypted_content: string`

                Opaque encrypted content.

                `maxLength: 10485760`

              - `type: "encrypted_content"`

                The type of the input item. Always `encrypted_content`.

                - `"encrypted_content"`

          - `recipient: string`

            The destination agent identity.

          - `type: "agent_message"`

            The item type. Always `agent_message`.

            - `"agent_message"`

          - `id?: string | null`

            The unique ID of this agent message item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCall`

          - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

            The multi-agent action that was executed.

            - `"spawn_agent"`

            - `"interrupt_agent"`

            - `"list_agents"`

            - `"send_message"`

            - `"followup_task"`

            - `"wait_agent"`

          - `arguments: string`

            The action arguments as a JSON string.

          - `call_id: string`

            The unique ID linking this call to its output.

            `minLength: 1`, `maxLength: 64`

          - `type: "multi_agent_call"`

            The item type. Always `multi_agent_call`.

            - `"multi_agent_call"`

          - `id?: string | null`

            The unique ID of this multi-agent call.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCallOutput`

          - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

            The multi-agent action that produced this result.

            - `"spawn_agent"`

            - `"interrupt_agent"`

            - `"list_agents"`

            - `"send_message"`

            - `"followup_task"`

            - `"wait_agent"`

          - `call_id: string`

            The unique ID of the multi-agent call.

            `minLength: 1`, `maxLength: 64`

          - `output: Array<Output>`

            Text output returned by the multi-agent action.

            - `text: string`

              The text content.

              `maxLength: 10485760`

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

            - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

              Citations associated with the text content.

              - `FileCitation`

                - `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.

                  `minimum: 0`

                - `type: "file_citation"`

                  The citation type. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation`

                - `end_index: number`

                  The index of the last character of the citation in the message.

                  `minimum: 0`

                - `start_index: number`

                  The index of the first character of the citation in the message.

                  `minimum: 0`

                - `title: string`

                  The title of the cited resource.

                - `type: "url_citation"`

                  The citation type. Always `url_citation`.

                  - `"url_citation"`

                - `url: string`

                  The URL of the cited resource.

                  `format: uri`

              - `ContainerFileCitation`

                - `container_id: string`

                  The ID of the container.

                - `end_index: number`

                  The index of the last character of the citation in the message.

                  `minimum: 0`

                - `file_id: string`

                  The ID of the container file.

                - `filename: string`

                  The filename of the container file cited.

                - `start_index: number`

                  The index of the first character of the citation in the message.

                  `minimum: 0`

                - `type: "container_file_citation"`

                  The citation type. Always `container_file_citation`.

                  - `"container_file_citation"`

          - `type: "multi_agent_call_output"`

            The item type. Always `multi_agent_call_output`.

            - `"multi_agent_call_output"`

          - `id?: string | null`

            The unique ID of this multi-agent call output.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ToolSearchCall`

          - `arguments: unknown`

            The arguments supplied to the tool search call.

          - `type: "tool_search_call"`

            The item type. Always `tool_search_call`.

            - `"tool_search_call"`

          - `id?: string | null`

            The unique ID of this tool search call.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the tool search call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `execution?: "server" | "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the tool search call.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseToolSearchOutputItemParam`

          - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

            The loaded tool definitions returned by the tool search output.

            - `BetaFunctionTool`

              Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

                - `"function"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

              - `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`

              A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

              - `type: "file_search"`

                The type of the file search tool. Always `file_search`.

                - `"file_search"`

              - `vector_store_ids: Array<string>`

                The IDs of the vector stores to search.

              - `filters?: ComparisonFilter | CompoundFilter | null`

                A filter to apply.

                - `ComparisonFilter`

                  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

                    - `"eq"`

                    - `"ne"`

                    - `"gt"`

                    - `"gte"`

                    - `"lt"`

                    - `"lte"`

                    - `"in"`

                    - `"nin"`

                  - `value: string | number | boolean | Array<string | number>`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `Array<string | number>`

                      - `string`

                      - `number`

                - `CompoundFilter`

                  Combine multiple filters using `and` or `or`.

                  - `filters: Array<ComparisonFilter | unknown>`

                    Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

                    - `ComparisonFilter`

                      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

                        - `"eq"`

                        - `"ne"`

                        - `"gt"`

                        - `"gte"`

                        - `"lt"`

                        - `"lte"`

                        - `"in"`

                        - `"nin"`

                      - `value: string | number | boolean | Array<string | number>`

                        The value to compare against the attribute key; supports string, number, or boolean types.

                        - `string`

                        - `number`

                        - `boolean`

                        - `Array<string | number>`

                          - `string`

                          - `number`

                    - `unknown`

                  - `type: "and" | "or"`

                    Type of operation: `and` or `or`.

                    - `"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`

                Ranking options for search.

                - `hybrid_search?: HybridSearch`

                  Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

                  - `embedding_weight: number`

                    The weight of the embedding in the reciprocal ranking fusion.

                  - `text_weight: number`

                    The weight of the text in the reciprocal ranking fusion.

                - `ranker?: "auto" | "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"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`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

              - `type: "computer"`

                The type of the computer tool. Always `computer`.

                - `"computer"`

            - `BetaComputerUsePreviewTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

              - `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.

                - `"windows"`

                - `"mac"`

                - `"linux"`

                - `"ubuntu"`

                - `"browser"`

              - `type: "computer_use_preview"`

                The type of the computer use tool. Always `computer_use_preview`.

                - `"computer_use_preview"`

            - `BetaWebSearchTool`

              Search the Internet for sources related to the prompt. Learn more about the
              [web search tool](/api/docs/guides/tools-web-search).

              - `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`.

                - `"web_search"`

                - `"web_search_2025_08_26"`

              - `external_web_access?: boolean`

                Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

              - `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.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `user_location?: UserLocation | null`

                The approximate location of the user. If omitted or null, defaults to the
                United States. To avoid this fallback, pass `{"type": "approximate"}` without
                location fields. To localize results, provide the relevant location fields.

                - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type?: "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

                - `"mcp"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools?: Array<string> | McpToolFilter | null`

                List of allowed tool names or a filter object.

                - `Array<string>`

                - `McpToolFilter`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

                This field is deprecated for models released after September 1, 2026.
                Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
                connect through a Secure MCP Tunnel.

                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`

                - `"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" | null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter`

                  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`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                      it will match this filter.

                    - `tool_names?: Array<string>`

                      List of allowed tool names.

                  - `never?: Never`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

                `format: uri`

              - `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`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string | CodeInterpreterToolAuto`

                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.

                - `string`

                - `CodeInterpreterToolAuto`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                      - `type: "disabled"`

                        Disable outbound network access. Always `disabled`.

                        - `"disabled"`

                    - `BetaContainerNetworkPolicyAllowlist`

                      - `allowed_domains: Array<string>`

                        A list of allowed domains when type is `allowlist`.

                        `minItems: 1`

                      - `type: "allowlist"`

                        Allow outbound network access only to specified domains. Always `allowlist`.

                        - `"allowlist"`

                      - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                        Optional domain-scoped secrets for allowlisted domains.

                        `minItems: 1`

                        - `domain: string`

                          The domain associated with the secret.

                          `minLength: 1`

                        - `name: string`

                          The name of the secret to inject for the domain.

                          `minLength: 1`

                        - `value: string`

                          The secret value to inject for the domain.

                          `minLength: 1`, `maxLength: 10485760`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action?: "generate" | "edit" | "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background?: "transparent" | "opaque" | "auto"`

                Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
                `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
                Transparent backgrounds are available for supported GPT Image models. For
                `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
                using `transparent`, set the output format to `png` or `webp`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `complexity?: "low" | "medium" | "high"`

                Computation spent planning the image, independently of rendering quality.
                Overrides the outer response's `reasoning.effort` for image generation.
                When omitted, inherits a supported outer reasoning effort or uses the
                image model's configured default.
                For SVG output, controls the reference image, not the SVG author's
                reasoning.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `frame_count?: number`

                Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

                `minimum: 2`, `maximum: 16`

              - `frame_duration_ms?: number`

                Duration of each GIF frame in milliseconds, rounded to 10 ms.
                Requires `output_format` to be `gif`. Default: 200.

                `minimum: 20`, `maximum: 2000`

              - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

                - `"high"`

                - `"low"`

              - `input_image_mask?: InputImageMask`

                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" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                Deprecated values:

                - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

                - `(string & {})`

                - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                  The image generation model to use. One of `gpt-image-1-mini`,
                  `gpt-image-1.5`, `gpt-image-2`,
                  `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                  `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                  `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                  `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                  `gpt-image-2`.

                  `gpt-image-1` was shut down on October 23, 2026. Use
                  `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                  - `"gpt-image-1"`

                  - `"gpt-image-1-mini"`

                  - `"gpt-image-2"`

                  - `"gpt-image-2-2026-04-21"`

                  - `"gpt-image-2.5-sunburst"`

                  - `"gpt-image-2.5-sunburst-2026-09-08"`

                  - `"gpt-image-2.5-flare"`

                  - `"gpt-image-2.5-flare-2026-09-08"`

                  - `"gpt-image-2.6-sunburst"`

                  - `"gpt-image-2.6-flare"`

                  - `"gpt-image-1.5"`

                  - `"chatgpt-image-latest"`

              - `moderation?: "auto" | "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression?: number`

                Compression level for the output image. Default: 100.

                `minimum: 0`, `maximum: 100`

              - `output_format?: "png" | "webp" | "jpeg" | 2 more`

                The output format of the generated image. One of `png`, `webp`, `jpeg`,
                `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
                that supports the selected format. GIF output does not support
                partial image streaming (`partial_images` greater than `0`),
                `input_image_mask`, or custom `output_compression`.
                Responses lifecycle events can still be streamed for GIF output.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

                - `"gif"`

                - `"svg"`

              - `partial_images?: number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

                `minimum: 0`, `maximum: 3`

              - `quality?: "low" | "medium" | "high" | 3 more`

                The quality of the generated image. The GPT image models support `low`,
                `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
                including their `2026-09-08` snapshots, also support `xhigh` and `max`.
                Default: `auto`.

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

                - `"auto"`

              - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

                - `(string & {})`

                - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

              - `svg?: Svg`

                SVG author model settings. Requires `output_format` to be `svg`.
                When SVG model selection is enabled, omitting this object uses the
                outer response model. Otherwise, the default SVG author is used and
                explicit model overrides are unavailable.

                - `model?: string`

                  `minLength: 1`

                - `reasoning?: Reasoning | null`

                  Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                  - `effort?: "none" | "minimal" | "low" | 4 more`

                    Controls how much effort the model should spend on reasoning for this request.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

            - `LocalShell`

              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`.

                - `"local_shell"`

            - `BetaFunctionShellTool`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

                - `BetaContainerAuto`

                  - `type: "container_auto"`

                    Automatically creates a container for this request

                    - `"container_auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                    - `BetaContainerNetworkPolicyAllowlist`

                  - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

                    An optional list of skills referenced by id or inline data.

                    `maxItems: 200`

                    - `BetaSkillReference`

                      - `skill_id: string`

                        The ID of the referenced skill.

                        `minLength: 1`, `maxLength: 64`

                      - `type: "skill_reference"`

                        References a skill created with the /v1/skills endpoint.

                        - `"skill_reference"`

                      - `version?: string`

                        Optional skill version. Use a positive integer or 'latest'. Omit for default.

                    - `BetaInlineSkill`

                      - `description: string`

                        The description of the skill.

                      - `name: string`

                        The name of the skill.

                      - `source: BetaInlineSkillSource`

                        Inline skill payload

                        - `data: string`

                          Base64-encoded skill zip bundle.

                          `minLength: 1`, `maxLength: 70254592`

                        - `media_type: "application/zip"`

                          The media type of the inline skill payload. Must be `application/zip`.

                          - `"application/zip"`

                        - `type: "base64"`

                          The type of the inline skill source. Must be `base64`.

                          - `"base64"`

                      - `type: "inline"`

                        Defines an inline skill for this request.

                        - `"inline"`

                - `BetaLocalEnvironment`

                  - `type: "local"`

                    Use a local computer environment.

                    - `"local"`

                  - `skills?: Array<BetaLocalSkill>`

                    An optional list of skills.

                    `maxItems: 200`

                    - `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: string`

                    The ID of the referenced container.

                  - `type: "container_reference"`

                    References a container created with the /v1/containers endpoint

                    - `"container_reference"`

            - `BetaCustomTool`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

                - `"custom"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `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 | Grammar`

                The input format for the custom tool. Default is unconstrained text.

                - `Text`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar`

                  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`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `BetaToolSearchOutputNamespaceTool`

              Groups function/custom tools under a shared namespace.

              - `description: string`

                A description of the namespace shown to the model.

              - `name: string`

                The namespace name used in tool calls (for example, `crm`).

                `minLength: 1`

              - `tools: Array<Function | BetaCustomTool>`

                The function/custom tools loaded inside this namespace.

                `minItems: 1`

                - `Function`

                  - `name: string`

                    The name of the loaded function tool.

                    `minLength: 1`, `maxLength: 128`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                    The tool invocation context(s).

                    `minItems: 1`

                    - `"direct"`

                    - `"programmatic"`

                  - `async?: boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `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`

                  A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

              - `type: "namespace"`

                The type of the tool. Always `namespace`.

                - `"namespace"`

            - `BetaToolSearchTool`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"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.

                - `"server"`

                - `"client"`

              - `parameters?: unknown`

                Parameter schema for a client-executed tool search tool.

            - `BetaWebSearchPreviewTool`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `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`.

                - `"web_search_preview"`

                - `"web_search_preview_2025_03_11"`

              - `search_content_types?: Array<"text" | "image">`

                - `"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.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `user_location?: UserLocation | null`

                The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

                - `type: "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `BetaApplyPatchTool`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

          - `type: "tool_search_output"`

            The item type. Always `tool_search_output`.

            - `"tool_search_output"`

          - `id?: string | null`

            The unique ID of this tool search output.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the tool search call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `execution?: "server" | "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the tool search output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AdditionalTools`

          - `role: "developer"`

            The role that provided the additional tools. Only `developer` is supported.

            - `"developer"`

          - `tools: Array<BetaTool>`

            A list of additional tools made available at this item.

            - `BetaFunctionTool`

              Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

            - `BetaFileSearchTool`

              A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

            - `BetaComputerTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `BetaComputerUsePreviewTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `BetaWebSearchTool`

              Search the Internet for sources related to the prompt. Learn more about the
              [web search tool](/api/docs/guides/tools-web-search).

            - `Mcp`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

                - `"mcp"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools?: Array<string> | McpToolFilter | null`

                List of allowed tool names or a filter object.

                - `Array<string>`

                - `McpToolFilter`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

                This field is deprecated for models released after September 1, 2026.
                Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
                connect through a Secure MCP Tunnel.

                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`

                - `"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" | null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter`

                  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`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                      it will match this filter.

                    - `tool_names?: Array<string>`

                      List of allowed tool names.

                  - `never?: Never`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

                `format: uri`

              - `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`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string | CodeInterpreterToolAuto`

                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.

                - `string`

                - `CodeInterpreterToolAuto`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                    - `BetaContainerNetworkPolicyAllowlist`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action?: "generate" | "edit" | "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background?: "transparent" | "opaque" | "auto"`

                Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
                `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
                Transparent backgrounds are available for supported GPT Image models. For
                `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
                using `transparent`, set the output format to `png` or `webp`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `complexity?: "low" | "medium" | "high"`

                Computation spent planning the image, independently of rendering quality.
                Overrides the outer response's `reasoning.effort` for image generation.
                When omitted, inherits a supported outer reasoning effort or uses the
                image model's configured default.
                For SVG output, controls the reference image, not the SVG author's
                reasoning.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `frame_count?: number`

                Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

                `minimum: 2`, `maximum: 16`

              - `frame_duration_ms?: number`

                Duration of each GIF frame in milliseconds, rounded to 10 ms.
                Requires `output_format` to be `gif`. Default: 200.

                `minimum: 20`, `maximum: 2000`

              - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

                - `"high"`

                - `"low"`

              - `input_image_mask?: InputImageMask`

                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" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                Deprecated values:

                - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

                - `(string & {})`

                - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                  The image generation model to use. One of `gpt-image-1-mini`,
                  `gpt-image-1.5`, `gpt-image-2`,
                  `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                  `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                  `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                  `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                  `gpt-image-2`.

                  `gpt-image-1` was shut down on October 23, 2026. Use
                  `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                  - `"gpt-image-1"`

                  - `"gpt-image-1-mini"`

                  - `"gpt-image-2"`

                  - `"gpt-image-2-2026-04-21"`

                  - `"gpt-image-2.5-sunburst"`

                  - `"gpt-image-2.5-sunburst-2026-09-08"`

                  - `"gpt-image-2.5-flare"`

                  - `"gpt-image-2.5-flare-2026-09-08"`

                  - `"gpt-image-2.6-sunburst"`

                  - `"gpt-image-2.6-flare"`

                  - `"gpt-image-1.5"`

                  - `"chatgpt-image-latest"`

              - `moderation?: "auto" | "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression?: number`

                Compression level for the output image. Default: 100.

                `minimum: 0`, `maximum: 100`

              - `output_format?: "png" | "webp" | "jpeg" | 2 more`

                The output format of the generated image. One of `png`, `webp`, `jpeg`,
                `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
                that supports the selected format. GIF output does not support
                partial image streaming (`partial_images` greater than `0`),
                `input_image_mask`, or custom `output_compression`.
                Responses lifecycle events can still be streamed for GIF output.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

                - `"gif"`

                - `"svg"`

              - `partial_images?: number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

                `minimum: 0`, `maximum: 3`

              - `quality?: "low" | "medium" | "high" | 3 more`

                The quality of the generated image. The GPT image models support `low`,
                `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
                including their `2026-09-08` snapshots, also support `xhigh` and `max`.
                Default: `auto`.

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

                - `"auto"`

              - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

                - `(string & {})`

                - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

              - `svg?: Svg`

                SVG author model settings. Requires `output_format` to be `svg`.
                When SVG model selection is enabled, omitting this object uses the
                outer response model. Otherwise, the default SVG author is used and
                explicit model overrides are unavailable.

                - `model?: string`

                  `minLength: 1`

                - `reasoning?: Reasoning | null`

                  Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                  - `effort?: "none" | "minimal" | "low" | 4 more`

                    Controls how much effort the model should spend on reasoning for this request.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

            - `LocalShell`

              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`.

                - `"local_shell"`

            - `BetaFunctionShellTool`

              A tool that allows the model to execute shell commands.

            - `BetaCustomTool`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `BetaNamespaceTool`

              Groups function/custom tools under a shared namespace.

              - `description: string`

                A description of the namespace shown to the model.

              - `name: string`

                The namespace name used in tool calls (for example, `crm`).

                `minLength: 1`

              - `tools: Array<Function | BetaCustomTool>`

                The function/custom tools available inside this namespace.

                `minItems: 1`

                - `Function`

                  - `name: string`

                    `minLength: 1`, `maxLength: 128`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                    The tool invocation context(s).

                    `minItems: 1`

                    - `"direct"`

                    - `"programmatic"`

                  - `async?: boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `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`

                  A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

              - `type: "namespace"`

                The type of the tool. Always `namespace`.

                - `"namespace"`

            - `BetaToolSearchTool`

              Hosted or BYOT tool search configuration for deferred tools.

            - `BetaWebSearchPreviewTool`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `BetaApplyPatchTool`

              Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "additional_tools"`

            The item type. Always `additional_tools`.

            - `"additional_tools"`

          - `id?: string | null`

            The unique ID of this additional tools item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `BetaResponseConfigurationUpdateItemParam`

          An update to the conversation's response configuration. Supply reasoning,
          text, or both. Each setting stays in effect until a later update replaces it.

          - `type: "configuration_update"`

            The item type. Always `configuration_update`.

            - `"configuration_update"`

          - `id?: string | null`

            The unique ID of the configuration update item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reasoning?: Reasoning`

            Updates to reasoning configuration. Only effort is supported.

            - `effort?: "none" | "minimal" | "low" | 4 more | null`

              The reasoning effort to use for subsequent responses until another
              configuration update replaces it.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

          - `text?: Text`

            The text output configuration for subsequent responses.

            - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

              Use a JSON schema for structured output or text to return to plain text.

              - `Text`

                Default response format. Used to generate text responses.

                - `type: "text"`

                  The type of response format being defined. Always `text`.

                  - `"text"`

              - `BetaResponseFormatTextJSONSchemaConfig`

                JSON Schema response format. Used to generate structured JSON responses.
                Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

                - `name: string`

                  The name of the response format. Must be a-z, A-Z, 0-9, or contain
                  underscores and dashes, with a maximum length of 64.

                - `schema: Record<string, unknown>`

                  The schema for the response format, described as a JSON Schema object.
                  Learn how to build JSON schemas [here](https://json-schema.org/).

                - `type: "json_schema"`

                  The type of response format being defined. Always `json_schema`.

                  - `"json_schema"`

                - `description?: string`

                  A description of what the response format is for, used by the model to
                  determine how to respond in the format.

                - `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](/api/docs/guides/structured-outputs).

        - `BetaResponseReasoningItem`

          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](/api/docs/guides/conversation-state).

          - `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`.

              - `"summary_text"`

          - `type: "reasoning"`

            The type of the object. Always `reasoning`.

            - `"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`.

              - `"reasoning_text"`

          - `encrypted_content?: string | null`

            The encrypted content of the reasoning item. This is populated by default
            for reasoning items returned by `POST /v1/responses` and WebSocket
            `response.create` requests.

            When streaming, use the completed reasoning item and its
            `encrypted_content` from the `response.output_item.done` event in
            subsequent requests. The `encrypted_content` in
            `response.output_item.added` may be incomplete. This is especially
            important when `store` is `false` or when using Zero Data Retention.

          - `status?: "in_progress" | "completed" | "incomplete"`

            The status of the item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseCompactionItemParam`

          A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

          - `encrypted_content: string`

            The encrypted content of the compaction summary.

            `maxLength: 104857600`

          - `type: "compaction"`

            The type of the item. Always `compaction`.

            - `"compaction"`

          - `id?: string | null`

            The ID of the compaction item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ImageGenerationCall`

          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.

            - `"in_progress"`

            - `"completed"`

            - `"generating"`

            - `"failed"`

          - `type: "image_generation_call"`

            The type of the image generation call. Always `image_generation_call`.

            - `"image_generation_call"`

          - `action?: "generate" | "edit" | "auto" | null`

            The action used for image generation.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `background?: "transparent" | "opaque" | "auto" | null`

            The background setting used for generation.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `error?: Error`

            Details of a moderation failure, when available.

            - `code: string | null`

              The error code.

            - `message: string`

              A description of the error.

            - `param: string | null`

              The related request parameter.

            - `type: string`

              The error type.

            - `moderation_details?: ModerationDetails`

              Public details for a `moderation_blocked` error, when available.

              - `categories: Array<string>`

                Public moderation categories. New category values may be added over time.

              - `moderation_stage: "input" | "output" | "unknown"`

                The stage where moderation blocked the image generation call.

                - `"input"`

                - `"output"`

                - `"unknown"`

          - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

            The output format used for generation.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

            - `"gif"`

            - `"svg"`

          - `quality?: "low" | "medium" | "high" | 3 more | null`

            The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

            - `"auto"`

          - `revised_prompt?: string | null`

            The prompt that was used after any model prompt rewriting.

          - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `(string & {})`

            - `"1024x1024" | "1024x1536" | "1536x1024"`

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

          - `svg_usage?: SvgUsage`

            - `input_tokens: number`

            - `model: string`

            - `output_tokens: number`

            - `reasoning_tokens: number`

            - `total_tokens: number`

        - `BetaResponseCodeInterpreterToolCall`

          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 | Image> | null`

            The outputs generated by the code interpreter, such as logs or images.
            Can be null if no outputs are available.

            - `Logs`

              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`.

                - `"logs"`

            - `Image`

              The image output from the code interpreter.

              - `type: "image"`

                The type of the output. Always `image`.

                - `"image"`

              - `url: string`

                The URL of the image output from the code interpreter.

                `format: uri`

          - `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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"interpreting"`

            - `"failed"`

          - `type: "code_interpreter_call"`

            The type of the code interpreter tool call. Always `code_interpreter_call`.

            - `"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`

          A tool call to run a command on the local shell.

          - `id: string`

            The unique ID of the local shell call.

          - `action: Action`

            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`.

              - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "local_shell_call"`

            The type of the local shell call. Always `local_shell_call`.

            - `"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`

          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`.

            - `"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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCall`

          A tool representing a request to execute one or more shell commands.

          - `action: Action`

            The shell commands and limits that describe how to run the tool call.

            - `commands: Array<string>`

              Ordered shell commands for the execution environment to run.

            - `max_output_length?: number | null`

              Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

            - `timeout_ms?: number | null`

              Maximum wall-clock time in milliseconds to allow the shell commands to run.

          - `call_id: string`

            The unique ID of the shell tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `type: "shell_call"`

            The type of the item. Always `shell_call`.

            - `"shell_call"`

          - `id?: string | null`

            The unique ID of the shell tool call. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

            The environment to execute the shell commands in.

            - `BetaLocalEnvironment`

            - `BetaContainerReference`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCallOutput`

          The streamed output items emitted by a shell tool call.

          - `call_id: string`

            The unique ID of the shell tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `output: Array<BetaResponseFunctionShellCallOutputContent>`

            Captured chunks of stdout and stderr output, along with their associated outcomes.

            - `outcome: Timeout | Exit`

              The exit or timeout outcome associated with this shell call.

              - `Timeout`

                Indicates that the shell call exceeded its configured time limit.

                - `type: "timeout"`

                  The outcome type. Always `timeout`.

                  - `"timeout"`

              - `Exit`

                Indicates that the shell commands finished and returned an exit code.

                - `exit_code: number`

                  The exit code returned by the shell process.

                - `type: "exit"`

                  The outcome type. Always `exit`.

                  - `"exit"`

            - `stderr: string`

              Captured stderr output for the shell call.

              `maxLength: 10485760`

            - `stdout: string`

              Captured stdout output for the shell call.

              `maxLength: 10485760`

          - `type: "shell_call_output"`

            The type of the item. Always `shell_call_output`.

            - `"shell_call_output"`

          - `id?: string | null`

            The unique ID of the shell tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `max_output_length?: number | null`

            The maximum number of UTF-8 characters captured for this shell call's combined output.

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the shell call output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ApplyPatchCall`

          A tool call representing a request to create, delete, or update files using diff patches.

          - `call_id: string`

            The unique ID of the apply patch tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `operation: CreateFile | DeleteFile | UpdateFile`

            The specific create, delete, or update instruction for the apply_patch tool call.

            - `CreateFile`

              Instruction for creating a new file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply when creating the file.

                `maxLength: 10485760`

              - `path: string`

                Path of the file to create relative to the workspace root.

                `minLength: 1`

              - `type: "create_file"`

                The operation type. Always `create_file`.

                - `"create_file"`

            - `DeleteFile`

              Instruction for deleting an existing file via the apply_patch tool.

              - `path: string`

                Path of the file to delete relative to the workspace root.

                `minLength: 1`

              - `type: "delete_file"`

                The operation type. Always `delete_file`.

                - `"delete_file"`

            - `UpdateFile`

              Instruction for updating an existing file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply to the existing file.

                `maxLength: 10485760`

              - `path: string`

                Path of the file to update relative to the workspace root.

                `minLength: 1`

              - `type: "update_file"`

                The operation type. Always `update_file`.

                - `"update_file"`

          - `status: "in_progress" | "completed"`

            The status of the apply patch tool call. One of `in_progress` or `completed`.

            - `"in_progress"`

            - `"completed"`

          - `type: "apply_patch_call"`

            The type of the item. Always `apply_patch_call`.

            - `"apply_patch_call"`

          - `id?: string | null`

            The unique ID of the apply patch tool call. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `ApplyPatchCallOutput`

          The streamed output emitted by an apply patch tool call.

          - `call_id: string`

            The unique ID of the apply patch tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `status: "completed" | "failed"`

            The status of the apply patch tool call output. One of `completed` or `failed`.

            - `"completed"`

            - `"failed"`

          - `type: "apply_patch_call_output"`

            The type of the item. Always `apply_patch_call_output`.

            - `"apply_patch_call_output"`

          - `id?: string | null`

            The unique ID of the apply patch tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `output?: string | null`

            Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

            `maxLength: 10485760`

        - `McpListTools`

          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`.

            - `"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`

          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`.

            - `"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`

          A response to an MCP approval request.

          - `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`.

            - `"mcp_approval_response"`

          - `id?: string | null`

            The unique ID of the 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.

        - `McpCall`

          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`.

            - `"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?: BetaMcpToolCallError | null`

            The error from the tool call, if any.

            - `McpProtocolError`

              - `code: number`

              - `message: string`

              - `type: "mcp_protocol_error"`

                - `"mcp_protocol_error"`

            - `McpToolExecutionError`

              - `content: unknown`

              - `type: "mcp_tool_execution_error"`

                - `"mcp_tool_execution_error"`

            - `HTTPError`

              - `code: number`

              - `message: string`

              - `type: "http_error"`

                - `"http_error"`

          - `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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"calling"`

            - `"failed"`

        - `BetaResponseCustomToolCallOutput`

          The output of a custom tool call from your code, being sent back to the model.

          - `call_id: string`

            The call ID, used to map this custom tool call output to a custom tool call.

          - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            The output from the custom tool call generated by your code.
            Can be a string or an list of output content.

            - `string`

            - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

              - `BetaResponseInputText`

                A text input to the model.

              - `BetaResponseInputImage`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile`

                A file input to the model.

          - `type: "custom_tool_call_output"`

            The type of the custom tool call output. Always `custom_tool_call_output`.

            - `"custom_tool_call_output"`

          - `id?: string`

            The unique ID of the custom tool call output 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 | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `BetaResponseCustomToolCall`

          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`.

            - `"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.

          - `async?: boolean`

            Whether the custom tool call runs asynchronously.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace?: string`

            The namespace of the custom tool being called.

        - `CompactionTrigger`

          Compacts the current context. Must be the final input item.

          - `type: "compaction_trigger"`

            The type of the item. Always `compaction_trigger`.

            - `"compaction_trigger"`

          - `id?: string | null`

            The unique ID of this compaction trigger.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ItemReference`

          An internal identifier for an item to reference.

          - `id: string`

            The ID of the item to reference.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `type?: "item_reference" | null`

            The type of item to reference. Always `item_reference`.

            - `"item_reference"`

        - `Program`

          - `id: string`

            The unique ID of this program item.

          - `call_id: string`

            The stable call ID of the program item.

            `minLength: 1`, `maxLength: 64`

          - `code: string`

            The JavaScript source executed by programmatic tool calling.

            `maxLength: 10485760`

          - `fingerprint: string`

            Opaque program replay fingerprint that must be round-tripped.

            `maxLength: 10485760`

          - `type: "program"`

            The item type. Always `program`.

            - `"program"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ProgramOutput`

          - `id: string`

            The unique ID of this program output item.

          - `call_id: string`

            The call ID of the program item.

            `minLength: 1`, `maxLength: 64`

          - `result: string`

            The result produced by the program item.

            `maxLength: 10485760`

          - `status: "completed" | "incomplete"`

            The terminal status of the program output.

            - `"completed"`

            - `"incomplete"`

          - `type: "program_output"`

            The item type. Always `program_output`.

            - `"program_output"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

    - `metadata: Record<string, string> | 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: "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more | (string & {})`

      Model ID used to generate the response, like `gpt-6-astra`. OpenAI
      offers a wide range of models with different capabilities, performance
      characteristics, and price points. Refer to the [model guide](/api/docs/models)
      to browse and compare available models.

      Deprecated values:

      - "gpt-5.4-nano", "gpt-5.4-nano-2026-03-17", "gpt-5.1", "gpt-5.1-2025-11-13": Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.3-chat-latest", "gpt-5.2-chat-latest": Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.1-codex", "gpt-5.1-chat-latest", "gpt-5-chat-latest", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", "o3-deep-research", "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5-codex", "gpt-5.1-codex-max": Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.1-mini": Not a supported model ID. Retained for SDK compatibility.
      - "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "o3", "o3-2025-04-16", "o3-pro", "o3-pro-2025-06-10", "gpt-5-pro", "gpt-5-pro-2025-10-06": Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-mini", "gpt-4o-mini-2024-07-18": Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4.1-nano", "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3-mini", "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "gpt-4o-2024-05-13", "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-1106-preview", "gpt-4", "gpt-4-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-0125", "o1-pro", "o1-pro-2025-03-19": Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "o1-preview", "o1-preview-2024-09-12": Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "o1-mini", "o1-mini-2024-09-12": Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-audio-mini", "gpt-audio-mini-2025-12-15": Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-12-17", "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", "gpt-4o-mini-audio-preview-2024-12-17": Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4o-audio-preview-2024-10-01": Announced shutdown date: 2025-10-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "chatgpt-4o-latest": Announced shutdown date: 2026-02-17. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "codex-mini-latest": Announced shutdown date: 2026-02-12. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-0125-preview", "gpt-4-turbo-preview", "gpt-4-0314": Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-vision-preview": Announced shutdown date: 2024-12-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-0613": Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k-0613": Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-3.5-turbo-1106": Announced shutdown date: 2026-09-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.

      - `"gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more`

        Model ID used to generate the response, like `gpt-6-astra`. OpenAI
        offers a wide range of models with different capabilities, performance
        characteristics, and price points. Refer to the [model guide](/api/docs/models)
        to browse and compare available models.

        - `"gpt-6-astra"`

        - `"gpt-6.1-sol"`

        - `"gpt-6.1-terra"`

        - `"gpt-6-sol"`

        - `"gpt-6-luna"`

        - `"gpt-5.6-sol"`

        - `"gpt-5.6-terra"`

        - `"gpt-5.6-luna"`

        - `"gpt-5.5"`

        - `"gpt-5.5-2026-04-23"`

        - `"gpt-5.4"`

        - `"gpt-5.4-mini"`

        - `"gpt-5.4-nano"`

        - `"gpt-5.4-mini-2026-03-17"`

        - `"gpt-5.4-nano-2026-03-17"`

        - `"gpt-5.3-chat-latest"`

        - `"gpt-5.2"`

        - `"gpt-5.2-2025-12-11"`

        - `"gpt-5.2-chat-latest"`

        - `"gpt-5.2-pro"`

        - `"gpt-5.2-pro-2025-12-11"`

        - `"gpt-5.1"`

        - `"gpt-5.1-2025-11-13"`

        - `"gpt-5.1-codex"`

        - `"gpt-5.1-mini"`

        - `"gpt-5.1-chat-latest"`

        - `"gpt-5"`

        - `"gpt-5-mini"`

        - `"gpt-5-nano"`

        - `"gpt-5-2025-08-07"`

        - `"gpt-5-mini-2025-08-07"`

        - `"gpt-5-nano-2025-08-07"`

        - `"gpt-5-chat-latest"`

        - `"gpt-4.1"`

        - `"gpt-4.1-mini"`

        - `"gpt-4.1-nano"`

        - `"gpt-4.1-2025-04-14"`

        - `"gpt-4.1-mini-2025-04-14"`

        - `"gpt-4.1-nano-2025-04-14"`

        - `"o4-mini"`

        - `"o4-mini-2025-04-16"`

        - `"o3"`

        - `"o3-2025-04-16"`

        - `"o3-mini"`

        - `"o3-mini-2025-01-31"`

        - `"o1"`

        - `"o1-2024-12-17"`

        - `"o1-preview"`

        - `"o1-preview-2024-09-12"`

        - `"o1-mini"`

        - `"o1-mini-2024-09-12"`

        - `"gpt-4o"`

        - `"gpt-4o-2024-11-20"`

        - `"gpt-4o-2024-08-06"`

        - `"gpt-4o-2024-05-13"`

        - `"gpt-audio-mini"`

        - `"gpt-audio-mini-2025-12-15"`

        - `"gpt-4o-audio-preview"`

        - `"gpt-4o-audio-preview-2024-10-01"`

        - `"gpt-4o-audio-preview-2024-12-17"`

        - `"gpt-4o-audio-preview-2025-06-03"`

        - `"gpt-4o-mini-audio-preview"`

        - `"gpt-4o-mini-audio-preview-2024-12-17"`

        - `"gpt-4o-search-preview"`

        - `"gpt-4o-mini-search-preview"`

        - `"gpt-4o-search-preview-2025-03-11"`

        - `"gpt-4o-mini-search-preview-2025-03-11"`

        - `"chatgpt-4o-latest"`

        - `"codex-mini-latest"`

        - `"gpt-4o-mini"`

        - `"gpt-4o-mini-2024-07-18"`

        - `"gpt-4-turbo"`

        - `"gpt-4-turbo-2024-04-09"`

        - `"gpt-4-0125-preview"`

        - `"gpt-4-turbo-preview"`

        - `"gpt-4-1106-preview"`

        - `"gpt-4-vision-preview"`

        - `"gpt-4"`

        - `"gpt-4-0314"`

        - `"gpt-4-0613"`

        - `"gpt-4-32k"`

        - `"gpt-4-32k-0314"`

        - `"gpt-4-32k-0613"`

        - `"gpt-3.5-turbo"`

        - `"gpt-3.5-turbo-16k"`

        - `"gpt-3.5-turbo-0301"`

        - `"gpt-3.5-turbo-0613"`

        - `"gpt-3.5-turbo-1106"`

        - `"gpt-3.5-turbo-0125"`

        - `"gpt-3.5-turbo-16k-0613"`

        - `"o1-pro"`

        - `"o1-pro-2025-03-19"`

        - `"o3-pro"`

        - `"o3-pro-2025-06-10"`

        - `"o3-deep-research"`

        - `"o3-deep-research-2025-06-26"`

        - `"o4-mini-deep-research"`

        - `"o4-mini-deep-research-2025-06-26"`

        - `"computer-use-preview"`

        - `"computer-use-preview-2025-03-11"`

        - `"gpt-5.5-pro"`

        - `"gpt-5.5-pro-2026-04-23"`

        - `"gpt-5-codex"`

        - `"gpt-5-pro"`

        - `"gpt-5-pro-2025-10-06"`

        - `"gpt-5.1-codex-max"`

        - `"gpt-daybreak-blue-latest"`

        - `"gpt-daybreak-red-latest"`

        - `"gpt-5.6-cyber"`

        - `"gpt-6-cyber"`

        - `"gpt-rosalind-research"`

        - `"gpt-6-rosalind"`

      - `(string & {})`

    - `object: "response"`

      The object type of this resource - always set to `response`.

      - `"response"`

    - `output: Array<BetaResponseOutputItem>`

      An array of content items generated by the model.

      - The length and order of items in the `output` array is dependent
        on the model's response.
      - Rather than accessing the first item in the `output` array and
        assuming it's an `assistant` message with the content generated by
        the model, you might consider using the `output_text` property where
        supported in SDKs.

      - `BetaResponseOutputMessage`

        An output message from the model.

      - `BetaResponseFileSearchToolCall`

        The results of a file search tool call. See the
        [file search guide](/api/docs/guides/tools-file-search) for more information.

      - `BetaResponseFunctionToolCall`

        A tool call to run a function. See the
        [function calling guide](/api/docs/guides/function-calling) for more information.

      - `BetaResponseFunctionToolCallOutputItem`

        - `id: string`

          The unique ID of the function call tool output.

        - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          The output from the function call generated by your code.
          Can be a string or an list of output content.

          - `string`

          - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            - `BetaResponseInputText`

              A text input to the model.

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile`

              A file input to the model.

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "function_call_output"`

          The type of the function tool call output. Always `function_call_output`.

          - `"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.

        - `call_id?: string`

          The unique ID of the function tool call generated by the model.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by?: string`

          The identifier of the actor that created the item.

        - `name?: string`

          The name of the tool that produced the output.

        - `namespace?: string`

          The namespace of the tool that produced the output.

      - `AgentMessage`

        - `id: string`

          The unique ID of the agent message.

        - `author: string`

          The sending agent identity.

        - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

          Encrypted content sent between agents.

          - `BetaResponseInputText`

            A text input to the model.

          - `BetaResponseOutputText`

            A text output from the model.

          - `Text`

            A text content.

            - `text: string`

            - `type: "text"`

              - `"text"`

          - `SummaryText`

            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`.

              - `"summary_text"`

          - `ReasoningText`

            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`.

              - `"reasoning_text"`

          - `BetaResponseOutputRefusal`

            A refusal from the model.

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `ComputerScreenshot`

            A screenshot of a computer.

            - `detail: BetaImageDetail`

              The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

            - `file_id: string | null`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: string | null`

              The URL of the screenshot image.

              `format: uri`

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFile`

            A file input to the model.

          - `EncryptedContent`

            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`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The type of the item. Always `agent_message`.

          - `"agent_message"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall`

        - `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.

          - `"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`.

          - `"multi_agent_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput`

        - `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.

          - `"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>`

          Text output returned by the multi-agent action.

          - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

            The annotations of the text output.

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

          - `logprobs?: Array<Logprob>`

        - `type: "multi_agent_call_output"`

          The type of the multi-agent result. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseFunctionWebSearch`

        The results of a web search tool call. See the
        [web search guide](/api/docs/guides/tools-web-search) for more information.

      - `BetaResponseComputerToolCall`

        A tool call to a computer use tool. See the
        [computer use guide](/api/docs/guides/tools-computer-use) for more information.

      - `BetaResponseComputerToolCallOutputItem`

        - `id: string`

          The ID of the computer tool call output.

        - `call_id: string`

          The ID of the computer tool call that produced the output.

        - `output: BetaResponseComputerToolCallOutputScreenshot`

          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.

          - `"completed"`

          - `"incomplete"`

          - `"failed"`

          - `"in_progress"`

        - `type: "computer_call_output"`

          The type of the computer tool call output. Always `computer_call_output`.

          - `"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`

        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](/api/docs/guides/conversation-state).

      - `Program`

        - `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`.

          - `"program"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput`

        - `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.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The type of the item. Always `program_output`.

          - `"program_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseToolSearchCall`

        - `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.

          - `"server"`

          - `"client"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the tool search call item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "tool_search_call"`

          The type of the item. Always `tool_search_call`.

          - `"tool_search_call"`

        - `agent?: Agent`

          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: 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.

          - `"server"`

          - `"client"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the tool search output item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `tools: Array<BetaTool>`

          The loaded tool definitions returned by tool search.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

          - `CodeInterpreter`

            A tool that runs Python code to help generate a response to a prompt.

          - `ProgrammaticToolCalling`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

          - `LocalShell`

            A tool that allows the model to execute shell commands in a local environment.

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "tool_search_output"`

          The type of the item. Always `tool_search_output`.

          - `"tool_search_output"`

        - `agent?: Agent`

          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: string`

          The unique ID of the additional tools item.

        - `role: "unknown" | "user" | "assistant" | 5 more`

          The role that provided the additional tools.

          - `"unknown"`

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"critic"`

          - `"discriminator"`

          - `"developer"`

          - `"tool"`

        - `tools: Array<BetaTool>`

          The additional tool definitions made available at this item.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

          - `CodeInterpreter`

            A tool that runs Python code to help generate a response to a prompt.

          - `ProgrammaticToolCalling`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

          - `LocalShell`

            A tool that allows the model to execute shell commands in a local environment.

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "additional_tools"`

          The type of the item. Always `additional_tools`.

          - `"additional_tools"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseCompactionItem`

        A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

        - `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`.

          - `"compaction"`

        - `agent?: Agent`

          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`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"generating"`

          - `"failed"`

        - `type: "image_generation_call"`

          The type of the image generation call. Always `image_generation_call`.

          - `"image_generation_call"`

        - `action?: "generate" | "edit" | "auto" | null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background?: "transparent" | "opaque" | "auto" | null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error?: Error`

          Details of a moderation failure, when available.

          - `code: string | null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string | null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details?: ModerationDetails`

            Public details for a `moderation_blocked` error, when available.

            - `categories: Array<string>`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" | "output" | "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `quality?: "low" | "medium" | "high" | 3 more | null`

          The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `revised_prompt?: string | null`

          The prompt that was used after any model prompt rewriting.

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

        - `svg_usage?: SvgUsage`

          - `input_tokens: number`

          - `model: string`

          - `output_tokens: number`

          - `reasoning_tokens: number`

          - `total_tokens: number`

      - `BetaResponseCodeInterpreterToolCall`

        A tool call to run code.

      - `LocalShellCall`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: Action`

          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`.

            - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "local_shell_call"`

          The type of the local shell call. Always `local_shell_call`.

          - `"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`

        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`.

          - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseFunctionShellToolCall`

        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`

          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 | BetaResponseContainerReference | null`

          Represents the use of a local environment to perform shell actions.

          - `BetaResponseLocalEnvironment`

            Represents the use of a local environment to perform shell actions.

            - `type: "local"`

              The environment type. Always `local`.

              - `"local"`

          - `BetaResponseContainerReference`

            Represents a container created with /v1/containers.

            - `container_id: string`

            - `type: "container_reference"`

              The environment type. Always `container_reference`.

              - `"container_reference"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The ID of the entity that created this tool call.

      - `BetaResponseFunctionShellToolCallOutput`

        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 | Exit`

            Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

            - `Timeout`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit`

              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`.

                - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "shell_call_output"`

          The type of the shell call output. Always `shell_call_output`.

          - `"shell_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The identifier of the actor that created the item.

      - `BetaResponseApplyPatchToolCall`

        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 | DeleteFile | UpdateFile`

          One of the create_file, delete_file, or update_file operations applied via apply_patch.

          - `CreateFile`

            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.

              - `"create_file"`

          - `DeleteFile`

            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.

              - `"delete_file"`

          - `UpdateFile`

            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.

              - `"update_file"`

        - `status: "in_progress" | "completed"`

          The status of the apply patch tool call. One of `in_progress` or `completed`.

          - `"in_progress"`

          - `"completed"`

        - `type: "apply_patch_call"`

          The type of the item. Always `apply_patch_call`.

          - `"apply_patch_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The ID of the entity that created this tool call.

      - `BetaResponseApplyPatchToolCallOutput`

        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`.

          - `"completed"`

          - `"failed"`

        - `type: "apply_patch_call_output"`

          The type of the item. Always `apply_patch_call_output`.

          - `"apply_patch_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"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`

        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`.

          - `"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?: BetaMcpToolCallError | 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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `McpListTools`

        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`.

          - `"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`

        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`.

          - `"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`

        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`.

          - `"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`

        A call to a custom tool created by the model.

      - `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `created_by?: string`

          The identifier of the actor that created the item.

    - `parallel_tool_calls: boolean`

      Whether to allow the model to run tool calls in parallel.

    - `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.
      We generally recommend altering this or `top_p` but not both.

      `minimum: 0`, `maximum: 2`

    - `tool_choice: BetaToolChoiceOptions | BetaToolChoiceAllowed | BetaToolChoiceTypes | 6 more`

      How the model should select which tool (or tools) to use when generating
      a response. See the `tools` parameter to see how to specify which tools
      the model can call.

      - `BetaToolChoiceOptions = "none" | "auto" | "required"`

        Controls which (if any) tool is called by the model.

        `none` means the model will not call any tool and instead generates a message.

        `auto` means the model can pick between generating a message or calling one or
        more tools.

        `required` means the model must call one or more tools.

        - `"none"`

        - `"auto"`

        - `"required"`

      - `BetaToolChoiceAllowed`

        Constrains the tools available to the model to a pre-defined set.

        - `mode: "auto" | "required"`

          Constrains the tools available to the model to a pre-defined set.

          `auto` allows the model to pick from among the allowed tools and generate a
          message.

          `required` requires the model to call one or more of the allowed tools.

          - `"auto"`

          - `"required"`

        - `tools: Array<Record<string, unknown>>`

          A list of tool definitions that the model should be allowed to call.

          For the Responses API, the list of tool definitions might look like:

          ```json
          [
            { "type": "function", "name": "get_weather" },
            { "type": "mcp", "server_label": "deepwiki" },
            { "type": "image_generation" }
          ]
          ```

        - `type: "allowed_tools"`

          Allowed tool configuration type. Always `allowed_tools`.

          - `"allowed_tools"`

      - `BetaToolChoiceTypes`

        Indicates that the model should use a built-in tool to generate a response.
        [Learn more about built-in tools](/api/docs/guides/tools).

        - `type: "file_search" | "web_search_preview" | "computer" | 5 more`

          The type of hosted tool the model should to use. Learn more about
          [built-in tools](/api/docs/guides/tools).

          Allowed values are:

          - `file_search`
          - `web_search_preview`
          - `computer`
          - `computer_use_preview`
          - `computer_use`
          - `code_interpreter`
          - `image_generation`

          - `"file_search"`

          - `"web_search_preview"`

          - `"computer"`

          - `"computer_use_preview"`

          - `"computer_use"`

          - `"web_search_preview_2025_03_11"`

          - `"image_generation"`

          - `"code_interpreter"`

      - `BetaToolChoiceFunction`

        Use this option to force the model to call a specific function.

        - `name: string`

          The name of the function to call.

        - `type: "function"`

          For function calling, the type is always `function`.

          - `"function"`

      - `BetaToolChoiceMcp`

        Use this option to force the model to call a specific tool on a remote MCP server.

        - `server_label: string`

          The label of the MCP server to use.

        - `type: "mcp"`

          For MCP tools, the type is always `mcp`.

          - `"mcp"`

        - `name?: string | null`

          The name of the tool to call on the server.

      - `BetaToolChoiceCustom`

        Use this option to force the model to call a specific custom tool.

        - `name: string`

          The name of the custom tool to call.

        - `type: "custom"`

          For custom tool calling, the type is always `custom`.

          - `"custom"`

      - `BetaSpecificProgrammaticToolCallingParam`

        - `type: "programmatic_tool_calling"`

          The tool to call. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `BetaToolChoiceApplyPatch`

        Forces the model to call the apply_patch tool when executing a tool call.

        - `type: "apply_patch"`

          The tool to call. Always `apply_patch`.

          - `"apply_patch"`

      - `BetaToolChoiceShell`

        Forces the model to call the shell tool when a tool call is required.

        - `type: "shell"`

          The tool to call. Always `shell`.

          - `"shell"`

    - `tools: Array<BetaTool>`

      An array of tools the model may call while generating a response. You
      can specify which tool to use by setting the `tool_choice` parameter.

      We support the following categories of tools:

      - **Built-in tools**: Tools that are provided by OpenAI that extend the
        model's capabilities, like [web search](/api/docs/guides/tools-web-search)
        or [file search](/api/docs/guides/tools-file-search). Learn more about
        [built-in tools](/api/docs/guides/tools).
      - **MCP Tools**: Integrations with third-party systems via custom MCP servers
        or predefined connectors such as Google Drive and SharePoint. Learn more about
        [MCP Tools](/api/docs/guides/tools-connectors-mcp).
      - **Function calls (custom tools)**: Functions that are defined by you,
        enabling the model to call your own code with strongly typed arguments
        and outputs. Learn more about
        [function calling](/api/docs/guides/function-calling). You can also use
        custom tools to call your own code.

      - `BetaFunctionTool`

        Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

      - `BetaFileSearchTool`

        A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

      - `BetaComputerTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaComputerUsePreviewTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaWebSearchTool`

        Search the Internet for sources related to the prompt. Learn more about the
        [web search tool](/api/docs/guides/tools-web-search).

      - `Mcp`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

      - `CodeInterpreter`

        A tool that runs Python code to help generate a response to a prompt.

      - `ProgrammaticToolCalling`

      - `ImageGeneration`

        A tool that generates images using the GPT image models.

      - `LocalShell`

        A tool that allows the model to execute shell commands in a local environment.

      - `BetaFunctionShellTool`

        A tool that allows the model to execute shell commands.

      - `BetaCustomTool`

        A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

      - `BetaNamespaceTool`

        Groups function/custom tools under a shared namespace.

      - `BetaToolSearchTool`

        Hosted or BYOT tool search configuration for deferred tools.

      - `BetaWebSearchPreviewTool`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

      - `BetaApplyPatchTool`

        Allows the assistant to create, delete, or update files using unified diffs.

    - `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.

      `minimum: 0`, `maximum: 1`

    - `background?: boolean | null`

      Whether to run the model response in the background.
      [Learn more](/api/docs/guides/background).

    - `completed_at?: number | null`

      Unix timestamp (in seconds) of when this Response was completed.
      Only present when the status is `completed`.

      `format: unixtime`

    - `conversation?: Conversation | null`

      The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation.

      - `id: string`

        The unique ID of the conversation that this response was associated with.

    - `image?: Image`

      - `context_compression: "enabled" | "disabled"`

        Effective image context optimization policy.

        - `"enabled"`

        - `"disabled"`

    - `max_output_tokens?: number | null`

      An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/api/docs/guides/reasoning).

    - `max_tool_calls?: number | null`

      The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

    - `moderation?: Moderation | null`

      Moderation results for the response input and output, if moderated completions were requested.

      - `input: ModerationResult | Error`

        Moderation for the response input.

        - `ModerationResult`

          A moderation result produced for the response input or output.

          - `categories: Record<string, boolean>`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: Record<string, Array<"text" | "image">>`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: Record<string, number>`

            A dictionary of moderation categories to scores.

          - `flagged: boolean`

            A boolean indicating whether the content was flagged by any category.

          - `model: string`

            The moderation model that produced this result.

          - `type: "moderation_result"`

            The object type, which was always `moderation_result` for successful moderation results.

            - `"moderation_result"`

        - `Error`

          An error produced while attempting moderation for the response input or output.

          - `code: string`

            The error code.

          - `message: string`

            The error message.

          - `type: "error"`

            The object type, which was always `error` for moderation failures.

            - `"error"`

      - `output: ModerationResult | Error`

        Moderation for the response output.

        - `ModerationResult`

          A moderation result produced for the response input or output.

          - `categories: Record<string, boolean>`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: Record<string, Array<"text" | "image">>`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: Record<string, number>`

            A dictionary of moderation categories to scores.

          - `flagged: boolean`

            A boolean indicating whether the content was flagged by any category.

          - `model: string`

            The moderation model that produced this result.

          - `type: "moderation_result"`

            The object type, which was always `moderation_result` for successful moderation results.

            - `"moderation_result"`

        - `Error`

          An error produced while attempting moderation for the response input or output.

          - `code: string`

            The error code.

          - `message: string`

            The error message.

          - `type: "error"`

            The object type, which was always `error` for moderation failures.

            - `"error"`

    - `previous_response_id?: string | null`

      The unique ID of the previous response to the model. Use this to
      create multi-turn conversations. Learn more about
      [conversation state](/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.

    - `prompt?: BetaResponsePrompt | null`

      Reference to a prompt template and its variables.
      [Learn more](/api/docs/guides/text?api-mode=responses#version-prompts-in-code).

      - `id: string`

        The unique identifier of the prompt template to use.

      - `variables?: Record<string, string | BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile> | null`

        Optional map of values to substitute in for variables in your
        prompt. The substitution values can either be strings, or other
        Response input types like images or files.

        - `string`

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile`

          A file input to the model.

      - `version?: string | null`

        Optional version of the prompt template.

    - `prompt_cache_diagnostics?: CacheMiss | CacheHit | ComparisonResponseNotFound | Unavailable`

      Prompt cache diagnostics requested for this response.

      - `CacheMiss`

        - `cache_missed_tokens: number`

          The estimated number of input tokens affected after the first detected divergence.

        - `reason: "model_changed" | "prompt_cache_key_changed" | "tools_changed" | 6 more`

          The reason prompt cache reuse did not occur.

          - `"model_changed"`

          - `"prompt_cache_key_changed"`

          - `"tools_changed"`

          - `"text_format_changed"`

          - `"reasoning_effort_changed"`

          - `"verbosity_changed"`

          - `"context_compacted"`

          - `"input_changed"`

          - `"service_tier_changed"`

        - `type: "cache_miss"`

          - `"cache_miss"`

        - `comparison_reusable_tokens?: number`

          The raw token count of the reusable prefix in the compared response.

      - `CacheHit`

        - `type: "cache_hit"`

          - `"cache_hit"`

      - `ComparisonResponseNotFound`

        - `type: "comparison_response_not_found"`

          - `"comparison_response_not_found"`

      - `Unavailable`

        - `type: "unavailable"`

          - `"unavailable"`

    - `prompt_cache_key?: string | null`

      Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/api/docs/guides/prompt-caching).

    - `prompt_cache_options?: PromptCacheOptions`

      The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

      - `mode: "implicit" | "explicit"`

        Whether implicit prompt-cache breakpoints were enabled.

        - `"implicit"`

        - `"explicit"`

      - `ttl: "30m" | "12h"`

        The minimum lifetime applied to each cache breakpoint.

        - `"30m"`

        - `"12h"`

      - `comparison_response_id?: string | null`

        The response ID supplied as the prompt cache diagnostics comparison.

    - `prompt_cache_retention?: "in_memory" | "24h" | null`

      Deprecated. Use `prompt_cache_options.ttl` instead.

      The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/api/docs/guides/prompt-caching#prompt-cache-retention).
      This field expresses a maximum retention policy, while
      `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two
      fields are independent and do not interact.
      For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported.

      For older models that support both `in_memory` and `24h`, the default depends on your organization's data retention policy:

      - Organizations without ZDR enabled default to `24h`.
      - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified.

      - `"in_memory"`

      - `"24h"`

    - `reasoning?: Reasoning | null`

      Configuration options for
      [reasoning models](/api/docs/guides/reasoning).

      - `context?: "auto" | "current_turn" | "all_turns" | null`

        Controls which reasoning items are rendered back to the model on later turns.
        If omitted or set to `auto`, the model determines the context mode. The
        `gpt-5.6` model family defaults to `all_turns`; earlier models default to
        `current_turn`.

        When returned on a response, this is the effective reasoning context mode
        used for the response.

        - `"auto"`

        - `"current_turn"`

        - `"all_turns"`

      - `effort?: "none" | "minimal" | "low" | 4 more | null`

        Constrains effort on reasoning for reasoning models. Currently supported
        values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
        Reducing reasoning effort can result in faster responses and fewer tokens
        used on reasoning in a response. Not all reasoning models support every
        value. See the
        [reasoning guide](/api/docs/guides/reasoning)
        for model-specific support.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `generate_summary?: "auto" | "concise" | "detailed" | null`

        **Deprecated:** use `summary` instead.

        A summary of the reasoning performed by the model. This can be
        useful for debugging and understanding the model's reasoning process.
        One of `auto`, `concise`, or `detailed`.

        - `"auto"`

        - `"concise"`

        - `"detailed"`

      - `mode?: (string & {}) | "standard" | "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `(string & {})`

        - `"standard" | "pro"`

          - `"standard"`

          - `"pro"`

      - `summary?: "auto" | "concise" | "detailed" | null`

        A summary of the reasoning performed by the model. This can be
        useful for debugging and understanding the model's reasoning process.
        One of `auto`, `concise`, or `detailed`.

        `concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.

        - `"auto"`

        - `"concise"`

        - `"detailed"`

    - `safety_identifier?: string | null`

      A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.
      The IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

      `maxLength: 128`

    - `service_tier?: BetaServiceTier | null`

      Specifies the processing type used for serving the request.

      - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
      - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
      - If set to '[flex](/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.
      - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.
      - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for `gpt-5.6-sol`; a response served through it will show `service_tier=ultrafast`.
      - When not set, the default behavior is 'auto'.

      When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

      - `"auto"`

      - `"default"`

      - `"flex"`

      - `"scale"`

      - `"priority"`

      - `"fast"`

      - `"ultrafast"`

    - `status?: BetaResponseStatus`

      The status of the response generation. One of `completed`, `failed`,
      `in_progress`, `cancelled`, `queued`, or `incomplete`.

      - `"completed"`

      - `"failed"`

      - `"in_progress"`

      - `"cancelled"`

      - `"queued"`

      - `"incomplete"`

    - `text?: BetaResponseTextConfig`

      Configuration options for a text response from the model. Can be plain
      text or structured JSON data. Learn more:

      - [Text inputs and outputs](/api/docs/guides/text)
      - [Structured Outputs](/api/docs/guides/structured-outputs)

      - `format?: BetaResponseFormatTextConfig`

        An object specifying the format that the model must output.

        Configuring `{ "type": "json_schema" }` enables Structured Outputs,
        which ensures the model will match your supplied JSON schema. Learn more in the
        [Structured Outputs guide](/api/docs/guides/structured-outputs).

        The default format is `{ "type": "text" }` with no additional options.

        **Not recommended for gpt-4o and newer models:**

        Setting to `{ "type": "json_object" }` enables the older JSON mode, which
        ensures the message the model generates is valid JSON. Using `json_schema`
        is preferred for models that support it.

        - `Text`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig`

          JSON Schema response format. Used to generate structured JSON responses.
          Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

        - `JSONObject`

          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`.

            - `"json_object"`

      - `verbosity?: "low" | "medium" | "high" | null`

        Constrains the verbosity of the model's response. Lower values will result in
        more concise responses, while higher values will result in more verbose responses.
        Currently supported values are `low`, `medium`, and `high`. The default is
        `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tool_usage?: ToolUsage`

      Usage reported by hosted tools, separate from base model `usage`. The field
      can be omitted when tool usage is unavailable. When present, tool families
      with no recorded usage have zero counts.

      `image_gen` sums available token counts across image generation calls.
      Calls with missing or incomplete usage records may be skipped. Output
      token details and cached input counts can be omitted. An omitted cache
      count means cache usage is unknown.

      `web_search.num_requests` counts billable searches. Discounted searches
      and actions such as opening a page are excluded. Use billing records to
      reconcile final charges.

      - `image_gen: ImageGen`

        Aggregated usage statistics for image generation tool calls.

        - `input_tokens: number`

          The number of tokens (images and text) in the input prompt.

        - `input_tokens_details: InputTokensDetails`

          The input tokens detailed information for the image generation.

          - `image_tokens: number`

            The number of image tokens in the input prompt.

          - `text_tokens: number`

            The number of text tokens in the input prompt.

        - `output_tokens: number`

          The number of output tokens generated by the model.

        - `total_tokens: number`

          The total number of tokens (images and text) used for the image generation.

        - `cached_tokens?: number`

        - `cached_tokens_details?: CachedTokensDetails`

          - `cached_image_tokens: number`

          - `cached_text_tokens: number`

        - `output_tokens_details?: OutputTokensDetails`

          The output token details for the image generation.

          - `image_tokens: number`

            The number of image output tokens generated by the model.

          - `text_tokens: number`

            The number of text output tokens generated by the model.

      - `web_search: WebSearch`

        Aggregated billable usage statistics for web search tool calls.

        - `num_requests: number`

          The number of billable web search requests issued.

    - `top_logprobs?: number | null`

      An integer between 0 and 20 specifying the maximum number of most likely
      tokens to return at each token position, each with an associated log
      probability. In some cases, the number of returned tokens may be fewer than
      requested.

      `minimum: 0`, `maximum: 20`

    - `truncation?: "auto" | "disabled" | null`

      The truncation strategy to use for the model response.

      - `auto`: If the input to this Response exceeds
        the model's context window size, the model will truncate the
        response to fit the context window by dropping items from the beginning of the conversation.
        On some models, trimming can begin earlier because the API subtracts the model's
        maximum output allowance from its input limit, even if you set a lower `max_output_tokens`.
      - `disabled` (default): If the input size will exceed the context window
        size for a model, the request will fail with a 400 error.

      - `"auto"`

      - `"disabled"`

    - `usage?: BetaResponseUsage`

      Represents token usage details including input tokens, output tokens,
      a breakdown of output tokens, and the total tokens used.

      - `input_tokens: number`

        The number of input tokens.

      - `input_tokens_details: InputTokensDetails`

        A detailed breakdown of the input tokens.

        - `cache_write_tokens: number`

          The number of input tokens that were written to the cache.

        - `cached_tokens: number`

          The number of tokens that were retrieved from the cache.
          [More on prompt caching](/api/docs/guides/prompt-caching).

        - `cache_write_tokens_details?: CacheWriteTokensDetails`

          - `ttl_12h_tokens: number`

            The number of input tokens written with 12-hour retention.

          - `ttl_30m_tokens: number`

            The number of input tokens written with 30-minute retention.

      - `output_tokens: number`

        The number of output tokens.

      - `output_tokens_details: OutputTokensDetails`

        A detailed breakdown of the output tokens.

        - `reasoning_tokens: number`

          The number of reasoning tokens.

      - `total_tokens: number`

        The total number of tokens used.

    - `user?: string`

      This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.
      A stable identifier for your end-users.
      Used to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

  - `sequence_number: number`

    The sequence number for this event.

  - `type: "response.created"`

    The type of the event. Always `response.created`.

    - `"response.created"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Custom Tool Call

- `BetaResponseCustomToolCall`

  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`.

    - `"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.

  - `async?: boolean`

    Whether the custom tool call runs asynchronously.

  - `caller?: Direct | Program | null`

    The execution context that produced this tool call.

    - `Direct`

      - `type: "direct"`

        - `"direct"`

    - `Program`

      - `caller_id: string`

        The call ID of the program item that produced this tool call.

      - `type: "program"`

        - `"program"`

  - `namespace?: string`

    The namespace of the custom tool being called.

### Beta Response Custom Tool Call Input Delta Event

- `BetaResponseCustomToolCallInputDeltaEvent`

  Event representing a delta (partial update) to the input of a custom tool call.

  - `delta: string`

    The incremental input data (delta) for the custom tool call.

  - `item_id: string`

    Unique identifier for the API item associated with this event.

  - `output_index: number`

    The index of the output this delta applies to.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.custom_tool_call_input.delta"`

    The event type identifier.

    - `"response.custom_tool_call_input.delta"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Custom Tool Call Input Done Event

- `BetaResponseCustomToolCallInputDoneEvent`

  Event indicating that input for a custom tool call is complete.

  - `input: string`

    The complete input data for the custom tool call.

  - `item_id: string`

    Unique identifier for the API item associated with this event.

  - `output_index: number`

    The index of the output this event applies to.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.custom_tool_call_input.done"`

    The event type identifier.

    - `"response.custom_tool_call_input.done"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Custom Tool Call Item

- `BetaResponseCustomToolCallItem extends BetaResponseCustomToolCall`

  A call to a custom tool created by the model.

  - `id: string`

    The unique ID of the custom tool call 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.

    - `"in_progress"`

    - `"completed"`

    - `"incomplete"`

  - `created_by?: string`

    The identifier of the actor that created the item.

### Beta Response Custom Tool Call Output

- `BetaResponseCustomToolCallOutput`

  The output of a custom tool call from your code, being sent back to the model.

  - `call_id: string`

    The call ID, used to map this custom tool call output to a custom tool call.

  - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

    The output from the custom tool call generated by your code.
    Can be a string or an list of output content.

    - `string`

    - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

      - `BetaResponseInputText`

        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`.

          - `"input_text"`

        - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

          Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

          - `ttl?: "30m" | "12h"`

            The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

            - `"30m"`

            - `"12h"`

      - `BetaResponseInputImage`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `detail: BetaImageDetail`

          The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

          - `"low"`

          - `"high"`

          - `"auto"`

          - `"original"`

        - `type: "input_image"`

          The type of the input item. Always `input_image`.

          - `"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.

          `format: uri`

        - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

          Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

          - `ttl?: "30m" | "12h"`

            The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

            - `"30m"`

            - `"12h"`

      - `BetaResponseInputFile`

        A file input to the model.

        - `type: "input_file"`

          The type of the input item. Always `input_file`.

          - `"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`.

          - `"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.

          `format: uri`

        - `filename?: string`

          The name of the file to be sent to the model.

        - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

          Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

          - `ttl?: "30m" | "12h"`

            The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

            - `"30m"`

            - `"12h"`

  - `type: "custom_tool_call_output"`

    The type of the custom tool call output. Always `custom_tool_call_output`.

    - `"custom_tool_call_output"`

  - `id?: string`

    The unique ID of the custom tool call output 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 | Program | null`

    The execution context that produced this tool call.

    - `Direct`

      - `type: "direct"`

        The caller type. Always `direct`.

        - `"direct"`

    - `Program`

      - `caller_id: string`

        The call ID of the program item that produced this tool call.

        `minLength: 1`, `maxLength: 64`

      - `type: "program"`

        The caller type. Always `program`.

        - `"program"`

### Beta Response Custom Tool Call Output Item

- `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

  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.

    - `"in_progress"`

    - `"completed"`

    - `"incomplete"`

  - `created_by?: string`

    The identifier of the actor that created the item.

### Beta Response Error

- `BetaResponseError`

  An error object returned when the model fails to generate a Response.

  - `code: "server_error" | "rate_limit_exceeded" | "invalid_prompt" | 18 more`

    The error code for the response.

    - `"server_error"`

    - `"rate_limit_exceeded"`

    - `"invalid_prompt"`

    - `"data_residency_mismatch"`

    - `"bio_policy"`

    - `"misalignment_policy_violation"`

    - `"vector_store_timeout"`

    - `"invalid_image"`

    - `"invalid_image_format"`

    - `"invalid_base64_image"`

    - `"invalid_image_url"`

    - `"image_too_large"`

    - `"image_too_small"`

    - `"image_parse_error"`

    - `"image_content_policy_violation"`

    - `"invalid_image_mode"`

    - `"image_file_too_large"`

    - `"unsupported_image_media_type"`

    - `"empty_image_file"`

    - `"failed_to_download_image"`

    - `"image_file_not_found"`

  - `message: string`

    A human-readable description of the error.

  - `misalignment?: Misalignment`

    - `detailed_explanation?: string`

      The public explanation for this block.

    - `error_type?: (string & {}) | "potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

      An optional classification; clients must accept additional values.

      - `(string & {})`

      - `"potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

        - `"potentially_unintended_data_transfer"`

        - `"potentially_unintended_data_access"`

        - `"potentially_unintended_destructive_activity"`

        - `"other"`

    - `review_target?: string | null`

      An opaque target for explicitly continuing this review, or null when unavailable.

      `minLength: 1`, `maxLength: 96`

    - `steer?: Steer`

      An optional public continuation instruction.

      - `message: string`

        The public continuation instruction.

  - `param?: string | null`

    The request parameter associated with the error, or null if none was recorded.

  - `type?: string | null`

    The original error type, or null if it was not recorded.

### Beta Response Error Event

- `BetaResponseErrorEvent`

  Emitted when an error occurs.

  - `code: string | null`

    The error code.

  - `message: string`

    The error message.

  - `param: string | null`

    The error parameter.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "error"`

    The type of the event. Always `error`.

    - `"error"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Failed Event

- `BetaResponseFailedEvent`

  An event that is emitted when a response fails.

  - `response: BetaResponse`

    The response that failed.

    - `id: string`

      Unique identifier for this Response.

    - `access_programs: AccessPrograms | null`

      - `cyber: "standard" | "daybreak_blue" | "daybreak_red"`

        The effective Cyber access program used for this response.

        - `"standard"`

        - `"daybreak_blue"`

        - `"daybreak_red"`

    - `created_at: number`

      Unix timestamp (in seconds) of when this Response was created.

      `format: unixtime`

    - `error: BetaResponseError | null`

      An error object returned when the model fails to generate a Response.

      - `code: "server_error" | "rate_limit_exceeded" | "invalid_prompt" | 18 more`

        The error code for the response.

        - `"server_error"`

        - `"rate_limit_exceeded"`

        - `"invalid_prompt"`

        - `"data_residency_mismatch"`

        - `"bio_policy"`

        - `"misalignment_policy_violation"`

        - `"vector_store_timeout"`

        - `"invalid_image"`

        - `"invalid_image_format"`

        - `"invalid_base64_image"`

        - `"invalid_image_url"`

        - `"image_too_large"`

        - `"image_too_small"`

        - `"image_parse_error"`

        - `"image_content_policy_violation"`

        - `"invalid_image_mode"`

        - `"image_file_too_large"`

        - `"unsupported_image_media_type"`

        - `"empty_image_file"`

        - `"failed_to_download_image"`

        - `"image_file_not_found"`

      - `message: string`

        A human-readable description of the error.

      - `misalignment?: Misalignment`

        - `detailed_explanation?: string`

          The public explanation for this block.

        - `error_type?: (string & {}) | "potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

          An optional classification; clients must accept additional values.

          - `(string & {})`

          - `"potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

            - `"potentially_unintended_data_transfer"`

            - `"potentially_unintended_data_access"`

            - `"potentially_unintended_destructive_activity"`

            - `"other"`

        - `review_target?: string | null`

          An opaque target for explicitly continuing this review, or null when unavailable.

          `minLength: 1`, `maxLength: 96`

        - `steer?: Steer`

          An optional public continuation instruction.

          - `message: string`

            The public continuation instruction.

      - `param?: string | null`

        The request parameter associated with the error, or null if none was recorded.

      - `type?: string | null`

        The original error type, or null if it was not recorded.

    - `incomplete_details: IncompleteDetails | null`

      Details about why the response is incomplete.

      - `reason?: "max_output_tokens" | "max_messages" | "content_filter" | "steered"`

        The reason why the response is incomplete. `steered` means
        the response stopped at a safe output boundary after a
        WebSocket `response.steer` event. The server can then create
        a successor response automatically with the queued input.

        - `"max_output_tokens"`

        - `"max_messages"`

        - `"content_filter"`

        - `"steered"`

    - `instructions: string | Array<BetaResponseInputItem> | null`

      A system (or developer) message inserted into the model's context.

      When using along with `previous_response_id`, the instructions from a previous
      response will not be carried over to the next response. This makes it simple
      to swap out system (or developer) messages in new responses.

      - `string`

      - `Array<BetaResponseInputItem>`

        - `BetaEasyInputMessage`

          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.

            - `string`

            - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

              A list of one or many input items to the model, containing different content
              types.

              - `BetaResponseInputText`

                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`.

                  - `"input_text"`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImage`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

                - `detail: BetaImageDetail`

                  The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                  - `"low"`

                  - `"high"`

                  - `"auto"`

                  - `"original"`

                - `type: "input_image"`

                  The type of the input item. Always `input_image`.

                  - `"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.

                  `format: uri`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFile`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"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`.

                  - `"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.

                  `format: uri`

                - `filename?: string`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

          - `role: "user" | "assistant" | "system" | "developer"`

            The role of the message input. One of `user`, `assistant`, `system`, or
            `developer`.

            - `"user"`

            - `"assistant"`

            - `"system"`

            - `"developer"`

          - `phase?: "commentary" | "final_answer" | 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.

            - `"commentary"`

            - `"final_answer"`

          - `type?: "message"`

            The type of the message input. Always `message`.

            - `"message"`

        - `Message`

          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.

          - `content: BetaResponseInputMessageContentList`

            A list of one or many input items to the model, containing different content
            types.

          - `role: "user" | "system" | "developer"`

            The role of the message input. One of `user`, `system`, or `developer`.

            - `"user"`

            - `"system"`

            - `"developer"`

          - `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"`

            The status of item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type?: "message"`

            The type of the message input. Always set to `message`.

            - `"message"`

        - `BetaResponseOutputMessage`

          An output message from the model.

          - `id: string`

            The unique ID of the output message.

          - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

            The content of the output message.

            - `BetaResponseOutputText`

              A text output from the model.

              - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

                The annotations of the text output.

                - `FileCitation`

                  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 in the output text at which to insert the file citation.

                  - `type: "file_citation"`

                    The type of the file citation. Always `file_citation`.

                    - `"file_citation"`

                - `URLCitation`

                  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_citation"`

                  - `url: string`

                    The URL of the web resource.

                    `format: uri`

                - `ContainerFileCitation`

                  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`.

                    - `"container_file_citation"`

                - `FilePath`

                  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`.

                    - `"file_path"`

              - `text: string`

                The text output from the model.

              - `type: "output_text"`

                The type of the output text. Always `output_text`.

                - `"output_text"`

              - `logprobs?: Array<Logprob>`

                - `token: string`

                - `bytes: Array<number>`

                - `logprob: number`

                - `top_logprobs: Array<TopLogprob>`

                  - `token: string`

                  - `bytes: Array<number>`

                  - `logprob: number`

            - `BetaResponseOutputRefusal`

              A refusal from the model.

              - `refusal: string`

                The refusal explanation from the model.

              - `type: "refusal"`

                The type of the refusal. Always `refusal`.

                - `"refusal"`

          - `role: "assistant"`

            The role of the output message. Always `assistant`.

            - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "message"`

            The type of the output message. Always `message`.

            - `"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" | "final_answer" | 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.

            - `"commentary"`

            - `"final_answer"`

        - `BetaResponseFileSearchToolCall`

          The results of a file search tool call. See the
          [file search guide](/api/docs/guides/tools-file-search) 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`,

            - `"in_progress"`

            - `"searching"`

            - `"completed"`

            - `"incomplete"`

            - `"failed"`

          - `type: "file_search_call"`

            The type of the file search tool call. Always `file_search_call`.

            - `"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.

              - `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.

              `format: float`

            - `text?: string`

              The text that was retrieved from the file.

        - `BetaResponseComputerToolCall`

          A tool call to a computer use tool. See the
          [computer use guide](/api/docs/guides/tools-computer-use) 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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "computer_call"`

            The type of the computer call. Always `computer_call`.

            - `"computer_call"`

          - `action?: BetaComputerAction`

            A click action.

            - `Click`

              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`.

                - `"left"`

                - `"right"`

                - `"wheel"`

                - `"back"`

                - `"forward"`

              - `type: "click"`

                Specifies the event type. For a click action, this property is always `click`.

                - `"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`

              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`.

                - `"double_click"`

              - `x: number`

                The x-coordinate where the double click occurred.

              - `y: number`

                The y-coordinate where the double click occurred.

            - `Drag`

              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`.

                - `"drag"`

              - `keys?: Array<string> | null`

                The keys being held while dragging the mouse.

            - `Keypress`

              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`.

                - `"keypress"`

            - `Move`

              A mouse move action.

              - `type: "move"`

                Specifies the event type. For a move action, this property is always set to `move`.

                - `"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`

              A screenshot action.

              - `type: "screenshot"`

                Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

                - `"screenshot"`

            - `Scroll`

              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`.

                - `"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`

              An action to type in text.

              - `text: string`

                The text to type.

              - `type: "type"`

                Specifies the event type. For a type action, this property is always set to `type`.

                - `"type"`

            - `Wait`

              A wait action.

              - `type: "wait"`

                Specifies the event type. For a wait action, this property is always set to `wait`.

                - `"wait"`

          - `actions?: BetaComputerActionList`

            Flattened batched actions for `computer_use`. Each action includes an
            `type` discriminator and action-specific fields.

            - `Click`

              A click action.

            - `DoubleClick`

              A double click action.

            - `Drag`

              A drag action.

            - `Keypress`

              A collection of keypresses the model would like to perform.

            - `Move`

              A mouse move action.

            - `Screenshot`

              A screenshot action.

            - `Scroll`

              A scroll action.

            - `Type`

              An action to type in text.

            - `Wait`

              A wait action.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCallOutput`

          The output of a computer tool call.

          - `call_id: string`

            The ID of the computer tool call that produced the output.

            `minLength: 1`, `maxLength: 64`

          - `output: BetaResponseComputerToolCallOutputScreenshot`

            A computer screenshot image used with the computer use tool.

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is
              always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `file_id?: string`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url?: string`

              The URL of the screenshot image.

              `format: uri`

          - `type: "computer_call_output"`

            The type of the computer tool call output. Always `computer_call_output`.

            - `"computer_call_output"`

          - `id?: string | null`

            The ID of the computer tool call output.

          - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

            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.

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseFunctionWebSearch`

          The results of a web search tool call. See the
          [web search guide](/api/docs/guides/tools-web-search) for more information.

          - `id: string`

            The unique ID of the web search tool call.

          - `action: Search | OpenPage | FindInPage`

            An object describing the specific action taken in this web search call.
            Includes details on how the model used the web (search, open_page, find_in_page).

            - `Search`

              Action type "search" - Performs a web search query.

              - `type: "search"`

                The action type.

                - `"search"`

              - `queries?: Array<string>`

                The search queries.

              - `query?: string`

                The search query.

              - `sources?: Array<Source>`

                The sources used in the search.

                - `type: "url"`

                  The type of source. Always `url`.

                  - `"url"`

                - `url: string`

                  The URL of the source.

                  `format: uri`

            - `OpenPage`

              Action type "open_page" - Opens a specific URL from search results.

              - `type: "open_page"`

                The action type.

                - `"open_page"`

              - `url?: string | null`

                The URL opened by the model.

                `format: uri`

            - `FindInPage`

              Action type "find_in_page": Searches for a pattern within a loaded page.

              - `pattern: string`

                The pattern or text to search for within the page.

              - `type: "find_in_page"`

                The action type.

                - `"find_in_page"`

              - `url: string`

                The URL of the page searched for the pattern.

                `format: uri`

          - `status: "in_progress" | "searching" | "completed" | 2 more`

            The status of the web search tool call.

            - `"in_progress"`

            - `"searching"`

            - `"completed"`

            - `"failed"`

            - `"incomplete"`

          - `type: "web_search_call"`

            The type of the web search tool call. Always `web_search_call`.

            - `"web_search_call"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `BetaResponseFunctionToolCall`

          A tool call to run a function. See the
          [function calling guide](/api/docs/guides/function-calling) 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`.

            - `"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.

          - `async?: boolean`

            Whether the function tool call runs asynchronously.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `FunctionCallOutput`

          The output of a function tool call.

          - `output: string | BetaResponseFunctionCallOutputItemList`

            Text, image, or file output of the function tool call.

            - `string`

            - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                  `maxLength: 10485760`

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImageContent`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

                - `type: "input_image"`

                  The type of the input item. Always `input_image`.

                  - `"input_image"`

                - `detail?: BetaImageDetail | null`

                  The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                - `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.

                  `maxLength: 20971520`, `format: uri`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFileContent`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"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`.

                  - `"auto"`

                  - `"low"`

                  - `"high"`

                - `file_data?: string | null`

                  The base64-encoded data of the file to be sent to the model.

                  `maxLength: 73400320`

                - `file_id?: string | null`

                  The ID of the file to be sent to the model.

                - `file_url?: string | null`

                  The URL of the file to be sent to the model.

                  `format: uri`

                - `filename?: string | null`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

          - `type: "function_call_output"`

            The type of the function tool call output. Always `function_call_output`.

            - `"function_call_output"`

          - `id?: string | null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the function tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name?: string | null`

            The name of the tool that produced the output.

            `minLength: 1`, `maxLength: 128`

          - `namespace?: string | null`

            The namespace of the tool that produced the output.

            `minLength: 1`, `maxLength: 128`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AgentMessage`

          A message routed between agents.

          - `author: string`

            The sending agent identity.

          - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

            Plaintext, image, or encrypted content sent between agents.

            - `BetaResponseInputTextContent`

              A text input to the model.

            - `BetaResponseInputImageContent`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `EncryptedContent`

              Opaque encrypted content that Responses API decrypts inside trusted model execution.

              - `encrypted_content: string`

                Opaque encrypted content.

                `maxLength: 10485760`

              - `type: "encrypted_content"`

                The type of the input item. Always `encrypted_content`.

                - `"encrypted_content"`

          - `recipient: string`

            The destination agent identity.

          - `type: "agent_message"`

            The item type. Always `agent_message`.

            - `"agent_message"`

          - `id?: string | null`

            The unique ID of this agent message item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCall`

          - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

            The multi-agent action that was executed.

            - `"spawn_agent"`

            - `"interrupt_agent"`

            - `"list_agents"`

            - `"send_message"`

            - `"followup_task"`

            - `"wait_agent"`

          - `arguments: string`

            The action arguments as a JSON string.

          - `call_id: string`

            The unique ID linking this call to its output.

            `minLength: 1`, `maxLength: 64`

          - `type: "multi_agent_call"`

            The item type. Always `multi_agent_call`.

            - `"multi_agent_call"`

          - `id?: string | null`

            The unique ID of this multi-agent call.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCallOutput`

          - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

            The multi-agent action that produced this result.

            - `"spawn_agent"`

            - `"interrupt_agent"`

            - `"list_agents"`

            - `"send_message"`

            - `"followup_task"`

            - `"wait_agent"`

          - `call_id: string`

            The unique ID of the multi-agent call.

            `minLength: 1`, `maxLength: 64`

          - `output: Array<Output>`

            Text output returned by the multi-agent action.

            - `text: string`

              The text content.

              `maxLength: 10485760`

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

            - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

              Citations associated with the text content.

              - `FileCitation`

                - `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.

                  `minimum: 0`

                - `type: "file_citation"`

                  The citation type. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation`

                - `end_index: number`

                  The index of the last character of the citation in the message.

                  `minimum: 0`

                - `start_index: number`

                  The index of the first character of the citation in the message.

                  `minimum: 0`

                - `title: string`

                  The title of the cited resource.

                - `type: "url_citation"`

                  The citation type. Always `url_citation`.

                  - `"url_citation"`

                - `url: string`

                  The URL of the cited resource.

                  `format: uri`

              - `ContainerFileCitation`

                - `container_id: string`

                  The ID of the container.

                - `end_index: number`

                  The index of the last character of the citation in the message.

                  `minimum: 0`

                - `file_id: string`

                  The ID of the container file.

                - `filename: string`

                  The filename of the container file cited.

                - `start_index: number`

                  The index of the first character of the citation in the message.

                  `minimum: 0`

                - `type: "container_file_citation"`

                  The citation type. Always `container_file_citation`.

                  - `"container_file_citation"`

          - `type: "multi_agent_call_output"`

            The item type. Always `multi_agent_call_output`.

            - `"multi_agent_call_output"`

          - `id?: string | null`

            The unique ID of this multi-agent call output.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ToolSearchCall`

          - `arguments: unknown`

            The arguments supplied to the tool search call.

          - `type: "tool_search_call"`

            The item type. Always `tool_search_call`.

            - `"tool_search_call"`

          - `id?: string | null`

            The unique ID of this tool search call.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the tool search call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `execution?: "server" | "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the tool search call.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseToolSearchOutputItemParam`

          - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

            The loaded tool definitions returned by the tool search output.

            - `BetaFunctionTool`

              Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

                - `"function"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

              - `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`

              A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

              - `type: "file_search"`

                The type of the file search tool. Always `file_search`.

                - `"file_search"`

              - `vector_store_ids: Array<string>`

                The IDs of the vector stores to search.

              - `filters?: ComparisonFilter | CompoundFilter | null`

                A filter to apply.

                - `ComparisonFilter`

                  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

                    - `"eq"`

                    - `"ne"`

                    - `"gt"`

                    - `"gte"`

                    - `"lt"`

                    - `"lte"`

                    - `"in"`

                    - `"nin"`

                  - `value: string | number | boolean | Array<string | number>`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `Array<string | number>`

                      - `string`

                      - `number`

                - `CompoundFilter`

                  Combine multiple filters using `and` or `or`.

                  - `filters: Array<ComparisonFilter | unknown>`

                    Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

                    - `ComparisonFilter`

                      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

                        - `"eq"`

                        - `"ne"`

                        - `"gt"`

                        - `"gte"`

                        - `"lt"`

                        - `"lte"`

                        - `"in"`

                        - `"nin"`

                      - `value: string | number | boolean | Array<string | number>`

                        The value to compare against the attribute key; supports string, number, or boolean types.

                        - `string`

                        - `number`

                        - `boolean`

                        - `Array<string | number>`

                          - `string`

                          - `number`

                    - `unknown`

                  - `type: "and" | "or"`

                    Type of operation: `and` or `or`.

                    - `"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`

                Ranking options for search.

                - `hybrid_search?: HybridSearch`

                  Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

                  - `embedding_weight: number`

                    The weight of the embedding in the reciprocal ranking fusion.

                  - `text_weight: number`

                    The weight of the text in the reciprocal ranking fusion.

                - `ranker?: "auto" | "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"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`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

              - `type: "computer"`

                The type of the computer tool. Always `computer`.

                - `"computer"`

            - `BetaComputerUsePreviewTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

              - `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.

                - `"windows"`

                - `"mac"`

                - `"linux"`

                - `"ubuntu"`

                - `"browser"`

              - `type: "computer_use_preview"`

                The type of the computer use tool. Always `computer_use_preview`.

                - `"computer_use_preview"`

            - `BetaWebSearchTool`

              Search the Internet for sources related to the prompt. Learn more about the
              [web search tool](/api/docs/guides/tools-web-search).

              - `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`.

                - `"web_search"`

                - `"web_search_2025_08_26"`

              - `external_web_access?: boolean`

                Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

              - `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.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `user_location?: UserLocation | null`

                The approximate location of the user. If omitted or null, defaults to the
                United States. To avoid this fallback, pass `{"type": "approximate"}` without
                location fields. To localize results, provide the relevant location fields.

                - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type?: "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

                - `"mcp"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools?: Array<string> | McpToolFilter | null`

                List of allowed tool names or a filter object.

                - `Array<string>`

                - `McpToolFilter`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

                This field is deprecated for models released after September 1, 2026.
                Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
                connect through a Secure MCP Tunnel.

                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`

                - `"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" | null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter`

                  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`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                      it will match this filter.

                    - `tool_names?: Array<string>`

                      List of allowed tool names.

                  - `never?: Never`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

                `format: uri`

              - `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`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string | CodeInterpreterToolAuto`

                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.

                - `string`

                - `CodeInterpreterToolAuto`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                      - `type: "disabled"`

                        Disable outbound network access. Always `disabled`.

                        - `"disabled"`

                    - `BetaContainerNetworkPolicyAllowlist`

                      - `allowed_domains: Array<string>`

                        A list of allowed domains when type is `allowlist`.

                        `minItems: 1`

                      - `type: "allowlist"`

                        Allow outbound network access only to specified domains. Always `allowlist`.

                        - `"allowlist"`

                      - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                        Optional domain-scoped secrets for allowlisted domains.

                        `minItems: 1`

                        - `domain: string`

                          The domain associated with the secret.

                          `minLength: 1`

                        - `name: string`

                          The name of the secret to inject for the domain.

                          `minLength: 1`

                        - `value: string`

                          The secret value to inject for the domain.

                          `minLength: 1`, `maxLength: 10485760`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action?: "generate" | "edit" | "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background?: "transparent" | "opaque" | "auto"`

                Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
                `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
                Transparent backgrounds are available for supported GPT Image models. For
                `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
                using `transparent`, set the output format to `png` or `webp`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `complexity?: "low" | "medium" | "high"`

                Computation spent planning the image, independently of rendering quality.
                Overrides the outer response's `reasoning.effort` for image generation.
                When omitted, inherits a supported outer reasoning effort or uses the
                image model's configured default.
                For SVG output, controls the reference image, not the SVG author's
                reasoning.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `frame_count?: number`

                Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

                `minimum: 2`, `maximum: 16`

              - `frame_duration_ms?: number`

                Duration of each GIF frame in milliseconds, rounded to 10 ms.
                Requires `output_format` to be `gif`. Default: 200.

                `minimum: 20`, `maximum: 2000`

              - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

                - `"high"`

                - `"low"`

              - `input_image_mask?: InputImageMask`

                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" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                Deprecated values:

                - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

                - `(string & {})`

                - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                  The image generation model to use. One of `gpt-image-1-mini`,
                  `gpt-image-1.5`, `gpt-image-2`,
                  `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                  `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                  `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                  `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                  `gpt-image-2`.

                  `gpt-image-1` was shut down on October 23, 2026. Use
                  `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                  - `"gpt-image-1"`

                  - `"gpt-image-1-mini"`

                  - `"gpt-image-2"`

                  - `"gpt-image-2-2026-04-21"`

                  - `"gpt-image-2.5-sunburst"`

                  - `"gpt-image-2.5-sunburst-2026-09-08"`

                  - `"gpt-image-2.5-flare"`

                  - `"gpt-image-2.5-flare-2026-09-08"`

                  - `"gpt-image-2.6-sunburst"`

                  - `"gpt-image-2.6-flare"`

                  - `"gpt-image-1.5"`

                  - `"chatgpt-image-latest"`

              - `moderation?: "auto" | "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression?: number`

                Compression level for the output image. Default: 100.

                `minimum: 0`, `maximum: 100`

              - `output_format?: "png" | "webp" | "jpeg" | 2 more`

                The output format of the generated image. One of `png`, `webp`, `jpeg`,
                `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
                that supports the selected format. GIF output does not support
                partial image streaming (`partial_images` greater than `0`),
                `input_image_mask`, or custom `output_compression`.
                Responses lifecycle events can still be streamed for GIF output.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

                - `"gif"`

                - `"svg"`

              - `partial_images?: number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

                `minimum: 0`, `maximum: 3`

              - `quality?: "low" | "medium" | "high" | 3 more`

                The quality of the generated image. The GPT image models support `low`,
                `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
                including their `2026-09-08` snapshots, also support `xhigh` and `max`.
                Default: `auto`.

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

                - `"auto"`

              - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

                - `(string & {})`

                - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

              - `svg?: Svg`

                SVG author model settings. Requires `output_format` to be `svg`.
                When SVG model selection is enabled, omitting this object uses the
                outer response model. Otherwise, the default SVG author is used and
                explicit model overrides are unavailable.

                - `model?: string`

                  `minLength: 1`

                - `reasoning?: Reasoning | null`

                  Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                  - `effort?: "none" | "minimal" | "low" | 4 more`

                    Controls how much effort the model should spend on reasoning for this request.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

            - `LocalShell`

              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`.

                - `"local_shell"`

            - `BetaFunctionShellTool`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

                - `BetaContainerAuto`

                  - `type: "container_auto"`

                    Automatically creates a container for this request

                    - `"container_auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                    - `BetaContainerNetworkPolicyAllowlist`

                  - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

                    An optional list of skills referenced by id or inline data.

                    `maxItems: 200`

                    - `BetaSkillReference`

                      - `skill_id: string`

                        The ID of the referenced skill.

                        `minLength: 1`, `maxLength: 64`

                      - `type: "skill_reference"`

                        References a skill created with the /v1/skills endpoint.

                        - `"skill_reference"`

                      - `version?: string`

                        Optional skill version. Use a positive integer or 'latest'. Omit for default.

                    - `BetaInlineSkill`

                      - `description: string`

                        The description of the skill.

                      - `name: string`

                        The name of the skill.

                      - `source: BetaInlineSkillSource`

                        Inline skill payload

                        - `data: string`

                          Base64-encoded skill zip bundle.

                          `minLength: 1`, `maxLength: 70254592`

                        - `media_type: "application/zip"`

                          The media type of the inline skill payload. Must be `application/zip`.

                          - `"application/zip"`

                        - `type: "base64"`

                          The type of the inline skill source. Must be `base64`.

                          - `"base64"`

                      - `type: "inline"`

                        Defines an inline skill for this request.

                        - `"inline"`

                - `BetaLocalEnvironment`

                  - `type: "local"`

                    Use a local computer environment.

                    - `"local"`

                  - `skills?: Array<BetaLocalSkill>`

                    An optional list of skills.

                    `maxItems: 200`

                    - `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: string`

                    The ID of the referenced container.

                  - `type: "container_reference"`

                    References a container created with the /v1/containers endpoint

                    - `"container_reference"`

            - `BetaCustomTool`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

                - `"custom"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `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 | Grammar`

                The input format for the custom tool. Default is unconstrained text.

                - `Text`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar`

                  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`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `BetaToolSearchOutputNamespaceTool`

              Groups function/custom tools under a shared namespace.

              - `description: string`

                A description of the namespace shown to the model.

              - `name: string`

                The namespace name used in tool calls (for example, `crm`).

                `minLength: 1`

              - `tools: Array<Function | BetaCustomTool>`

                The function/custom tools loaded inside this namespace.

                `minItems: 1`

                - `Function`

                  - `name: string`

                    The name of the loaded function tool.

                    `minLength: 1`, `maxLength: 128`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                    The tool invocation context(s).

                    `minItems: 1`

                    - `"direct"`

                    - `"programmatic"`

                  - `async?: boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `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`

                  A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

              - `type: "namespace"`

                The type of the tool. Always `namespace`.

                - `"namespace"`

            - `BetaToolSearchTool`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"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.

                - `"server"`

                - `"client"`

              - `parameters?: unknown`

                Parameter schema for a client-executed tool search tool.

            - `BetaWebSearchPreviewTool`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `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`.

                - `"web_search_preview"`

                - `"web_search_preview_2025_03_11"`

              - `search_content_types?: Array<"text" | "image">`

                - `"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.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `user_location?: UserLocation | null`

                The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

                - `type: "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `BetaApplyPatchTool`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

          - `type: "tool_search_output"`

            The item type. Always `tool_search_output`.

            - `"tool_search_output"`

          - `id?: string | null`

            The unique ID of this tool search output.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the tool search call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `execution?: "server" | "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the tool search output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AdditionalTools`

          - `role: "developer"`

            The role that provided the additional tools. Only `developer` is supported.

            - `"developer"`

          - `tools: Array<BetaTool>`

            A list of additional tools made available at this item.

            - `BetaFunctionTool`

              Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

            - `BetaFileSearchTool`

              A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

            - `BetaComputerTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `BetaComputerUsePreviewTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `BetaWebSearchTool`

              Search the Internet for sources related to the prompt. Learn more about the
              [web search tool](/api/docs/guides/tools-web-search).

            - `Mcp`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

                - `"mcp"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools?: Array<string> | McpToolFilter | null`

                List of allowed tool names or a filter object.

                - `Array<string>`

                - `McpToolFilter`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

                This field is deprecated for models released after September 1, 2026.
                Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
                connect through a Secure MCP Tunnel.

                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`

                - `"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" | null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter`

                  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`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                      it will match this filter.

                    - `tool_names?: Array<string>`

                      List of allowed tool names.

                  - `never?: Never`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

                `format: uri`

              - `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`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string | CodeInterpreterToolAuto`

                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.

                - `string`

                - `CodeInterpreterToolAuto`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                    - `BetaContainerNetworkPolicyAllowlist`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action?: "generate" | "edit" | "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background?: "transparent" | "opaque" | "auto"`

                Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
                `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
                Transparent backgrounds are available for supported GPT Image models. For
                `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
                using `transparent`, set the output format to `png` or `webp`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `complexity?: "low" | "medium" | "high"`

                Computation spent planning the image, independently of rendering quality.
                Overrides the outer response's `reasoning.effort` for image generation.
                When omitted, inherits a supported outer reasoning effort or uses the
                image model's configured default.
                For SVG output, controls the reference image, not the SVG author's
                reasoning.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `frame_count?: number`

                Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

                `minimum: 2`, `maximum: 16`

              - `frame_duration_ms?: number`

                Duration of each GIF frame in milliseconds, rounded to 10 ms.
                Requires `output_format` to be `gif`. Default: 200.

                `minimum: 20`, `maximum: 2000`

              - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

                - `"high"`

                - `"low"`

              - `input_image_mask?: InputImageMask`

                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" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                Deprecated values:

                - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

                - `(string & {})`

                - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                  The image generation model to use. One of `gpt-image-1-mini`,
                  `gpt-image-1.5`, `gpt-image-2`,
                  `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                  `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                  `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                  `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                  `gpt-image-2`.

                  `gpt-image-1` was shut down on October 23, 2026. Use
                  `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                  - `"gpt-image-1"`

                  - `"gpt-image-1-mini"`

                  - `"gpt-image-2"`

                  - `"gpt-image-2-2026-04-21"`

                  - `"gpt-image-2.5-sunburst"`

                  - `"gpt-image-2.5-sunburst-2026-09-08"`

                  - `"gpt-image-2.5-flare"`

                  - `"gpt-image-2.5-flare-2026-09-08"`

                  - `"gpt-image-2.6-sunburst"`

                  - `"gpt-image-2.6-flare"`

                  - `"gpt-image-1.5"`

                  - `"chatgpt-image-latest"`

              - `moderation?: "auto" | "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression?: number`

                Compression level for the output image. Default: 100.

                `minimum: 0`, `maximum: 100`

              - `output_format?: "png" | "webp" | "jpeg" | 2 more`

                The output format of the generated image. One of `png`, `webp`, `jpeg`,
                `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
                that supports the selected format. GIF output does not support
                partial image streaming (`partial_images` greater than `0`),
                `input_image_mask`, or custom `output_compression`.
                Responses lifecycle events can still be streamed for GIF output.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

                - `"gif"`

                - `"svg"`

              - `partial_images?: number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

                `minimum: 0`, `maximum: 3`

              - `quality?: "low" | "medium" | "high" | 3 more`

                The quality of the generated image. The GPT image models support `low`,
                `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
                including their `2026-09-08` snapshots, also support `xhigh` and `max`.
                Default: `auto`.

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

                - `"auto"`

              - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

                - `(string & {})`

                - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

              - `svg?: Svg`

                SVG author model settings. Requires `output_format` to be `svg`.
                When SVG model selection is enabled, omitting this object uses the
                outer response model. Otherwise, the default SVG author is used and
                explicit model overrides are unavailable.

                - `model?: string`

                  `minLength: 1`

                - `reasoning?: Reasoning | null`

                  Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                  - `effort?: "none" | "minimal" | "low" | 4 more`

                    Controls how much effort the model should spend on reasoning for this request.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

            - `LocalShell`

              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`.

                - `"local_shell"`

            - `BetaFunctionShellTool`

              A tool that allows the model to execute shell commands.

            - `BetaCustomTool`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `BetaNamespaceTool`

              Groups function/custom tools under a shared namespace.

              - `description: string`

                A description of the namespace shown to the model.

              - `name: string`

                The namespace name used in tool calls (for example, `crm`).

                `minLength: 1`

              - `tools: Array<Function | BetaCustomTool>`

                The function/custom tools available inside this namespace.

                `minItems: 1`

                - `Function`

                  - `name: string`

                    `minLength: 1`, `maxLength: 128`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                    The tool invocation context(s).

                    `minItems: 1`

                    - `"direct"`

                    - `"programmatic"`

                  - `async?: boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `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`

                  A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

              - `type: "namespace"`

                The type of the tool. Always `namespace`.

                - `"namespace"`

            - `BetaToolSearchTool`

              Hosted or BYOT tool search configuration for deferred tools.

            - `BetaWebSearchPreviewTool`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `BetaApplyPatchTool`

              Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "additional_tools"`

            The item type. Always `additional_tools`.

            - `"additional_tools"`

          - `id?: string | null`

            The unique ID of this additional tools item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `BetaResponseConfigurationUpdateItemParam`

          An update to the conversation's response configuration. Supply reasoning,
          text, or both. Each setting stays in effect until a later update replaces it.

          - `type: "configuration_update"`

            The item type. Always `configuration_update`.

            - `"configuration_update"`

          - `id?: string | null`

            The unique ID of the configuration update item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reasoning?: Reasoning`

            Updates to reasoning configuration. Only effort is supported.

            - `effort?: "none" | "minimal" | "low" | 4 more | null`

              The reasoning effort to use for subsequent responses until another
              configuration update replaces it.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

          - `text?: Text`

            The text output configuration for subsequent responses.

            - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

              Use a JSON schema for structured output or text to return to plain text.

              - `Text`

                Default response format. Used to generate text responses.

                - `type: "text"`

                  The type of response format being defined. Always `text`.

                  - `"text"`

              - `BetaResponseFormatTextJSONSchemaConfig`

                JSON Schema response format. Used to generate structured JSON responses.
                Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

                - `name: string`

                  The name of the response format. Must be a-z, A-Z, 0-9, or contain
                  underscores and dashes, with a maximum length of 64.

                - `schema: Record<string, unknown>`

                  The schema for the response format, described as a JSON Schema object.
                  Learn how to build JSON schemas [here](https://json-schema.org/).

                - `type: "json_schema"`

                  The type of response format being defined. Always `json_schema`.

                  - `"json_schema"`

                - `description?: string`

                  A description of what the response format is for, used by the model to
                  determine how to respond in the format.

                - `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](/api/docs/guides/structured-outputs).

        - `BetaResponseReasoningItem`

          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](/api/docs/guides/conversation-state).

          - `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`.

              - `"summary_text"`

          - `type: "reasoning"`

            The type of the object. Always `reasoning`.

            - `"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`.

              - `"reasoning_text"`

          - `encrypted_content?: string | null`

            The encrypted content of the reasoning item. This is populated by default
            for reasoning items returned by `POST /v1/responses` and WebSocket
            `response.create` requests.

            When streaming, use the completed reasoning item and its
            `encrypted_content` from the `response.output_item.done` event in
            subsequent requests. The `encrypted_content` in
            `response.output_item.added` may be incomplete. This is especially
            important when `store` is `false` or when using Zero Data Retention.

          - `status?: "in_progress" | "completed" | "incomplete"`

            The status of the item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseCompactionItemParam`

          A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

          - `encrypted_content: string`

            The encrypted content of the compaction summary.

            `maxLength: 104857600`

          - `type: "compaction"`

            The type of the item. Always `compaction`.

            - `"compaction"`

          - `id?: string | null`

            The ID of the compaction item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ImageGenerationCall`

          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.

            - `"in_progress"`

            - `"completed"`

            - `"generating"`

            - `"failed"`

          - `type: "image_generation_call"`

            The type of the image generation call. Always `image_generation_call`.

            - `"image_generation_call"`

          - `action?: "generate" | "edit" | "auto" | null`

            The action used for image generation.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `background?: "transparent" | "opaque" | "auto" | null`

            The background setting used for generation.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `error?: Error`

            Details of a moderation failure, when available.

            - `code: string | null`

              The error code.

            - `message: string`

              A description of the error.

            - `param: string | null`

              The related request parameter.

            - `type: string`

              The error type.

            - `moderation_details?: ModerationDetails`

              Public details for a `moderation_blocked` error, when available.

              - `categories: Array<string>`

                Public moderation categories. New category values may be added over time.

              - `moderation_stage: "input" | "output" | "unknown"`

                The stage where moderation blocked the image generation call.

                - `"input"`

                - `"output"`

                - `"unknown"`

          - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

            The output format used for generation.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

            - `"gif"`

            - `"svg"`

          - `quality?: "low" | "medium" | "high" | 3 more | null`

            The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

            - `"auto"`

          - `revised_prompt?: string | null`

            The prompt that was used after any model prompt rewriting.

          - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `(string & {})`

            - `"1024x1024" | "1024x1536" | "1536x1024"`

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

          - `svg_usage?: SvgUsage`

            - `input_tokens: number`

            - `model: string`

            - `output_tokens: number`

            - `reasoning_tokens: number`

            - `total_tokens: number`

        - `BetaResponseCodeInterpreterToolCall`

          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 | Image> | null`

            The outputs generated by the code interpreter, such as logs or images.
            Can be null if no outputs are available.

            - `Logs`

              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`.

                - `"logs"`

            - `Image`

              The image output from the code interpreter.

              - `type: "image"`

                The type of the output. Always `image`.

                - `"image"`

              - `url: string`

                The URL of the image output from the code interpreter.

                `format: uri`

          - `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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"interpreting"`

            - `"failed"`

          - `type: "code_interpreter_call"`

            The type of the code interpreter tool call. Always `code_interpreter_call`.

            - `"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`

          A tool call to run a command on the local shell.

          - `id: string`

            The unique ID of the local shell call.

          - `action: Action`

            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`.

              - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "local_shell_call"`

            The type of the local shell call. Always `local_shell_call`.

            - `"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`

          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`.

            - `"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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCall`

          A tool representing a request to execute one or more shell commands.

          - `action: Action`

            The shell commands and limits that describe how to run the tool call.

            - `commands: Array<string>`

              Ordered shell commands for the execution environment to run.

            - `max_output_length?: number | null`

              Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

            - `timeout_ms?: number | null`

              Maximum wall-clock time in milliseconds to allow the shell commands to run.

          - `call_id: string`

            The unique ID of the shell tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `type: "shell_call"`

            The type of the item. Always `shell_call`.

            - `"shell_call"`

          - `id?: string | null`

            The unique ID of the shell tool call. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

            The environment to execute the shell commands in.

            - `BetaLocalEnvironment`

            - `BetaContainerReference`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCallOutput`

          The streamed output items emitted by a shell tool call.

          - `call_id: string`

            The unique ID of the shell tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `output: Array<BetaResponseFunctionShellCallOutputContent>`

            Captured chunks of stdout and stderr output, along with their associated outcomes.

            - `outcome: Timeout | Exit`

              The exit or timeout outcome associated with this shell call.

              - `Timeout`

                Indicates that the shell call exceeded its configured time limit.

                - `type: "timeout"`

                  The outcome type. Always `timeout`.

                  - `"timeout"`

              - `Exit`

                Indicates that the shell commands finished and returned an exit code.

                - `exit_code: number`

                  The exit code returned by the shell process.

                - `type: "exit"`

                  The outcome type. Always `exit`.

                  - `"exit"`

            - `stderr: string`

              Captured stderr output for the shell call.

              `maxLength: 10485760`

            - `stdout: string`

              Captured stdout output for the shell call.

              `maxLength: 10485760`

          - `type: "shell_call_output"`

            The type of the item. Always `shell_call_output`.

            - `"shell_call_output"`

          - `id?: string | null`

            The unique ID of the shell tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `max_output_length?: number | null`

            The maximum number of UTF-8 characters captured for this shell call's combined output.

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the shell call output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ApplyPatchCall`

          A tool call representing a request to create, delete, or update files using diff patches.

          - `call_id: string`

            The unique ID of the apply patch tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `operation: CreateFile | DeleteFile | UpdateFile`

            The specific create, delete, or update instruction for the apply_patch tool call.

            - `CreateFile`

              Instruction for creating a new file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply when creating the file.

                `maxLength: 10485760`

              - `path: string`

                Path of the file to create relative to the workspace root.

                `minLength: 1`

              - `type: "create_file"`

                The operation type. Always `create_file`.

                - `"create_file"`

            - `DeleteFile`

              Instruction for deleting an existing file via the apply_patch tool.

              - `path: string`

                Path of the file to delete relative to the workspace root.

                `minLength: 1`

              - `type: "delete_file"`

                The operation type. Always `delete_file`.

                - `"delete_file"`

            - `UpdateFile`

              Instruction for updating an existing file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply to the existing file.

                `maxLength: 10485760`

              - `path: string`

                Path of the file to update relative to the workspace root.

                `minLength: 1`

              - `type: "update_file"`

                The operation type. Always `update_file`.

                - `"update_file"`

          - `status: "in_progress" | "completed"`

            The status of the apply patch tool call. One of `in_progress` or `completed`.

            - `"in_progress"`

            - `"completed"`

          - `type: "apply_patch_call"`

            The type of the item. Always `apply_patch_call`.

            - `"apply_patch_call"`

          - `id?: string | null`

            The unique ID of the apply patch tool call. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `ApplyPatchCallOutput`

          The streamed output emitted by an apply patch tool call.

          - `call_id: string`

            The unique ID of the apply patch tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `status: "completed" | "failed"`

            The status of the apply patch tool call output. One of `completed` or `failed`.

            - `"completed"`

            - `"failed"`

          - `type: "apply_patch_call_output"`

            The type of the item. Always `apply_patch_call_output`.

            - `"apply_patch_call_output"`

          - `id?: string | null`

            The unique ID of the apply patch tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `output?: string | null`

            Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

            `maxLength: 10485760`

        - `McpListTools`

          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`.

            - `"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`

          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`.

            - `"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`

          A response to an MCP approval request.

          - `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`.

            - `"mcp_approval_response"`

          - `id?: string | null`

            The unique ID of the 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.

        - `McpCall`

          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`.

            - `"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?: BetaMcpToolCallError | null`

            The error from the tool call, if any.

            - `McpProtocolError`

              - `code: number`

              - `message: string`

              - `type: "mcp_protocol_error"`

                - `"mcp_protocol_error"`

            - `McpToolExecutionError`

              - `content: unknown`

              - `type: "mcp_tool_execution_error"`

                - `"mcp_tool_execution_error"`

            - `HTTPError`

              - `code: number`

              - `message: string`

              - `type: "http_error"`

                - `"http_error"`

          - `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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"calling"`

            - `"failed"`

        - `BetaResponseCustomToolCallOutput`

          The output of a custom tool call from your code, being sent back to the model.

          - `call_id: string`

            The call ID, used to map this custom tool call output to a custom tool call.

          - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            The output from the custom tool call generated by your code.
            Can be a string or an list of output content.

            - `string`

            - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

              - `BetaResponseInputText`

                A text input to the model.

              - `BetaResponseInputImage`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile`

                A file input to the model.

          - `type: "custom_tool_call_output"`

            The type of the custom tool call output. Always `custom_tool_call_output`.

            - `"custom_tool_call_output"`

          - `id?: string`

            The unique ID of the custom tool call output 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 | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `BetaResponseCustomToolCall`

          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`.

            - `"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.

          - `async?: boolean`

            Whether the custom tool call runs asynchronously.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace?: string`

            The namespace of the custom tool being called.

        - `CompactionTrigger`

          Compacts the current context. Must be the final input item.

          - `type: "compaction_trigger"`

            The type of the item. Always `compaction_trigger`.

            - `"compaction_trigger"`

          - `id?: string | null`

            The unique ID of this compaction trigger.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ItemReference`

          An internal identifier for an item to reference.

          - `id: string`

            The ID of the item to reference.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `type?: "item_reference" | null`

            The type of item to reference. Always `item_reference`.

            - `"item_reference"`

        - `Program`

          - `id: string`

            The unique ID of this program item.

          - `call_id: string`

            The stable call ID of the program item.

            `minLength: 1`, `maxLength: 64`

          - `code: string`

            The JavaScript source executed by programmatic tool calling.

            `maxLength: 10485760`

          - `fingerprint: string`

            Opaque program replay fingerprint that must be round-tripped.

            `maxLength: 10485760`

          - `type: "program"`

            The item type. Always `program`.

            - `"program"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ProgramOutput`

          - `id: string`

            The unique ID of this program output item.

          - `call_id: string`

            The call ID of the program item.

            `minLength: 1`, `maxLength: 64`

          - `result: string`

            The result produced by the program item.

            `maxLength: 10485760`

          - `status: "completed" | "incomplete"`

            The terminal status of the program output.

            - `"completed"`

            - `"incomplete"`

          - `type: "program_output"`

            The item type. Always `program_output`.

            - `"program_output"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

    - `metadata: Record<string, string> | 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: "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more | (string & {})`

      Model ID used to generate the response, like `gpt-6-astra`. OpenAI
      offers a wide range of models with different capabilities, performance
      characteristics, and price points. Refer to the [model guide](/api/docs/models)
      to browse and compare available models.

      Deprecated values:

      - "gpt-5.4-nano", "gpt-5.4-nano-2026-03-17", "gpt-5.1", "gpt-5.1-2025-11-13": Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.3-chat-latest", "gpt-5.2-chat-latest": Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.1-codex", "gpt-5.1-chat-latest", "gpt-5-chat-latest", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", "o3-deep-research", "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5-codex", "gpt-5.1-codex-max": Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.1-mini": Not a supported model ID. Retained for SDK compatibility.
      - "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "o3", "o3-2025-04-16", "o3-pro", "o3-pro-2025-06-10", "gpt-5-pro", "gpt-5-pro-2025-10-06": Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-mini", "gpt-4o-mini-2024-07-18": Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4.1-nano", "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3-mini", "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "gpt-4o-2024-05-13", "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-1106-preview", "gpt-4", "gpt-4-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-0125", "o1-pro", "o1-pro-2025-03-19": Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "o1-preview", "o1-preview-2024-09-12": Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "o1-mini", "o1-mini-2024-09-12": Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-audio-mini", "gpt-audio-mini-2025-12-15": Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-12-17", "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", "gpt-4o-mini-audio-preview-2024-12-17": Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4o-audio-preview-2024-10-01": Announced shutdown date: 2025-10-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "chatgpt-4o-latest": Announced shutdown date: 2026-02-17. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "codex-mini-latest": Announced shutdown date: 2026-02-12. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-0125-preview", "gpt-4-turbo-preview", "gpt-4-0314": Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-vision-preview": Announced shutdown date: 2024-12-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-0613": Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k-0613": Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-3.5-turbo-1106": Announced shutdown date: 2026-09-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.

      - `"gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more`

        Model ID used to generate the response, like `gpt-6-astra`. OpenAI
        offers a wide range of models with different capabilities, performance
        characteristics, and price points. Refer to the [model guide](/api/docs/models)
        to browse and compare available models.

        - `"gpt-6-astra"`

        - `"gpt-6.1-sol"`

        - `"gpt-6.1-terra"`

        - `"gpt-6-sol"`

        - `"gpt-6-luna"`

        - `"gpt-5.6-sol"`

        - `"gpt-5.6-terra"`

        - `"gpt-5.6-luna"`

        - `"gpt-5.5"`

        - `"gpt-5.5-2026-04-23"`

        - `"gpt-5.4"`

        - `"gpt-5.4-mini"`

        - `"gpt-5.4-nano"`

        - `"gpt-5.4-mini-2026-03-17"`

        - `"gpt-5.4-nano-2026-03-17"`

        - `"gpt-5.3-chat-latest"`

        - `"gpt-5.2"`

        - `"gpt-5.2-2025-12-11"`

        - `"gpt-5.2-chat-latest"`

        - `"gpt-5.2-pro"`

        - `"gpt-5.2-pro-2025-12-11"`

        - `"gpt-5.1"`

        - `"gpt-5.1-2025-11-13"`

        - `"gpt-5.1-codex"`

        - `"gpt-5.1-mini"`

        - `"gpt-5.1-chat-latest"`

        - `"gpt-5"`

        - `"gpt-5-mini"`

        - `"gpt-5-nano"`

        - `"gpt-5-2025-08-07"`

        - `"gpt-5-mini-2025-08-07"`

        - `"gpt-5-nano-2025-08-07"`

        - `"gpt-5-chat-latest"`

        - `"gpt-4.1"`

        - `"gpt-4.1-mini"`

        - `"gpt-4.1-nano"`

        - `"gpt-4.1-2025-04-14"`

        - `"gpt-4.1-mini-2025-04-14"`

        - `"gpt-4.1-nano-2025-04-14"`

        - `"o4-mini"`

        - `"o4-mini-2025-04-16"`

        - `"o3"`

        - `"o3-2025-04-16"`

        - `"o3-mini"`

        - `"o3-mini-2025-01-31"`

        - `"o1"`

        - `"o1-2024-12-17"`

        - `"o1-preview"`

        - `"o1-preview-2024-09-12"`

        - `"o1-mini"`

        - `"o1-mini-2024-09-12"`

        - `"gpt-4o"`

        - `"gpt-4o-2024-11-20"`

        - `"gpt-4o-2024-08-06"`

        - `"gpt-4o-2024-05-13"`

        - `"gpt-audio-mini"`

        - `"gpt-audio-mini-2025-12-15"`

        - `"gpt-4o-audio-preview"`

        - `"gpt-4o-audio-preview-2024-10-01"`

        - `"gpt-4o-audio-preview-2024-12-17"`

        - `"gpt-4o-audio-preview-2025-06-03"`

        - `"gpt-4o-mini-audio-preview"`

        - `"gpt-4o-mini-audio-preview-2024-12-17"`

        - `"gpt-4o-search-preview"`

        - `"gpt-4o-mini-search-preview"`

        - `"gpt-4o-search-preview-2025-03-11"`

        - `"gpt-4o-mini-search-preview-2025-03-11"`

        - `"chatgpt-4o-latest"`

        - `"codex-mini-latest"`

        - `"gpt-4o-mini"`

        - `"gpt-4o-mini-2024-07-18"`

        - `"gpt-4-turbo"`

        - `"gpt-4-turbo-2024-04-09"`

        - `"gpt-4-0125-preview"`

        - `"gpt-4-turbo-preview"`

        - `"gpt-4-1106-preview"`

        - `"gpt-4-vision-preview"`

        - `"gpt-4"`

        - `"gpt-4-0314"`

        - `"gpt-4-0613"`

        - `"gpt-4-32k"`

        - `"gpt-4-32k-0314"`

        - `"gpt-4-32k-0613"`

        - `"gpt-3.5-turbo"`

        - `"gpt-3.5-turbo-16k"`

        - `"gpt-3.5-turbo-0301"`

        - `"gpt-3.5-turbo-0613"`

        - `"gpt-3.5-turbo-1106"`

        - `"gpt-3.5-turbo-0125"`

        - `"gpt-3.5-turbo-16k-0613"`

        - `"o1-pro"`

        - `"o1-pro-2025-03-19"`

        - `"o3-pro"`

        - `"o3-pro-2025-06-10"`

        - `"o3-deep-research"`

        - `"o3-deep-research-2025-06-26"`

        - `"o4-mini-deep-research"`

        - `"o4-mini-deep-research-2025-06-26"`

        - `"computer-use-preview"`

        - `"computer-use-preview-2025-03-11"`

        - `"gpt-5.5-pro"`

        - `"gpt-5.5-pro-2026-04-23"`

        - `"gpt-5-codex"`

        - `"gpt-5-pro"`

        - `"gpt-5-pro-2025-10-06"`

        - `"gpt-5.1-codex-max"`

        - `"gpt-daybreak-blue-latest"`

        - `"gpt-daybreak-red-latest"`

        - `"gpt-5.6-cyber"`

        - `"gpt-6-cyber"`

        - `"gpt-rosalind-research"`

        - `"gpt-6-rosalind"`

      - `(string & {})`

    - `object: "response"`

      The object type of this resource - always set to `response`.

      - `"response"`

    - `output: Array<BetaResponseOutputItem>`

      An array of content items generated by the model.

      - The length and order of items in the `output` array is dependent
        on the model's response.
      - Rather than accessing the first item in the `output` array and
        assuming it's an `assistant` message with the content generated by
        the model, you might consider using the `output_text` property where
        supported in SDKs.

      - `BetaResponseOutputMessage`

        An output message from the model.

      - `BetaResponseFileSearchToolCall`

        The results of a file search tool call. See the
        [file search guide](/api/docs/guides/tools-file-search) for more information.

      - `BetaResponseFunctionToolCall`

        A tool call to run a function. See the
        [function calling guide](/api/docs/guides/function-calling) for more information.

      - `BetaResponseFunctionToolCallOutputItem`

        - `id: string`

          The unique ID of the function call tool output.

        - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          The output from the function call generated by your code.
          Can be a string or an list of output content.

          - `string`

          - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            - `BetaResponseInputText`

              A text input to the model.

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile`

              A file input to the model.

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "function_call_output"`

          The type of the function tool call output. Always `function_call_output`.

          - `"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.

        - `call_id?: string`

          The unique ID of the function tool call generated by the model.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by?: string`

          The identifier of the actor that created the item.

        - `name?: string`

          The name of the tool that produced the output.

        - `namespace?: string`

          The namespace of the tool that produced the output.

      - `AgentMessage`

        - `id: string`

          The unique ID of the agent message.

        - `author: string`

          The sending agent identity.

        - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

          Encrypted content sent between agents.

          - `BetaResponseInputText`

            A text input to the model.

          - `BetaResponseOutputText`

            A text output from the model.

          - `Text`

            A text content.

            - `text: string`

            - `type: "text"`

              - `"text"`

          - `SummaryText`

            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`.

              - `"summary_text"`

          - `ReasoningText`

            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`.

              - `"reasoning_text"`

          - `BetaResponseOutputRefusal`

            A refusal from the model.

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `ComputerScreenshot`

            A screenshot of a computer.

            - `detail: BetaImageDetail`

              The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

            - `file_id: string | null`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: string | null`

              The URL of the screenshot image.

              `format: uri`

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFile`

            A file input to the model.

          - `EncryptedContent`

            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`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The type of the item. Always `agent_message`.

          - `"agent_message"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall`

        - `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.

          - `"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`.

          - `"multi_agent_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput`

        - `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.

          - `"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>`

          Text output returned by the multi-agent action.

          - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

            The annotations of the text output.

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

          - `logprobs?: Array<Logprob>`

        - `type: "multi_agent_call_output"`

          The type of the multi-agent result. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseFunctionWebSearch`

        The results of a web search tool call. See the
        [web search guide](/api/docs/guides/tools-web-search) for more information.

      - `BetaResponseComputerToolCall`

        A tool call to a computer use tool. See the
        [computer use guide](/api/docs/guides/tools-computer-use) for more information.

      - `BetaResponseComputerToolCallOutputItem`

        - `id: string`

          The ID of the computer tool call output.

        - `call_id: string`

          The ID of the computer tool call that produced the output.

        - `output: BetaResponseComputerToolCallOutputScreenshot`

          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.

          - `"completed"`

          - `"incomplete"`

          - `"failed"`

          - `"in_progress"`

        - `type: "computer_call_output"`

          The type of the computer tool call output. Always `computer_call_output`.

          - `"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`

        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](/api/docs/guides/conversation-state).

      - `Program`

        - `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`.

          - `"program"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput`

        - `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.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The type of the item. Always `program_output`.

          - `"program_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseToolSearchCall`

        - `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.

          - `"server"`

          - `"client"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the tool search call item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "tool_search_call"`

          The type of the item. Always `tool_search_call`.

          - `"tool_search_call"`

        - `agent?: Agent`

          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: 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.

          - `"server"`

          - `"client"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the tool search output item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `tools: Array<BetaTool>`

          The loaded tool definitions returned by tool search.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

          - `CodeInterpreter`

            A tool that runs Python code to help generate a response to a prompt.

          - `ProgrammaticToolCalling`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

          - `LocalShell`

            A tool that allows the model to execute shell commands in a local environment.

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "tool_search_output"`

          The type of the item. Always `tool_search_output`.

          - `"tool_search_output"`

        - `agent?: Agent`

          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: string`

          The unique ID of the additional tools item.

        - `role: "unknown" | "user" | "assistant" | 5 more`

          The role that provided the additional tools.

          - `"unknown"`

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"critic"`

          - `"discriminator"`

          - `"developer"`

          - `"tool"`

        - `tools: Array<BetaTool>`

          The additional tool definitions made available at this item.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

          - `CodeInterpreter`

            A tool that runs Python code to help generate a response to a prompt.

          - `ProgrammaticToolCalling`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

          - `LocalShell`

            A tool that allows the model to execute shell commands in a local environment.

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "additional_tools"`

          The type of the item. Always `additional_tools`.

          - `"additional_tools"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseCompactionItem`

        A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

        - `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`.

          - `"compaction"`

        - `agent?: Agent`

          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`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"generating"`

          - `"failed"`

        - `type: "image_generation_call"`

          The type of the image generation call. Always `image_generation_call`.

          - `"image_generation_call"`

        - `action?: "generate" | "edit" | "auto" | null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background?: "transparent" | "opaque" | "auto" | null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error?: Error`

          Details of a moderation failure, when available.

          - `code: string | null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string | null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details?: ModerationDetails`

            Public details for a `moderation_blocked` error, when available.

            - `categories: Array<string>`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" | "output" | "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `quality?: "low" | "medium" | "high" | 3 more | null`

          The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `revised_prompt?: string | null`

          The prompt that was used after any model prompt rewriting.

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

        - `svg_usage?: SvgUsage`

          - `input_tokens: number`

          - `model: string`

          - `output_tokens: number`

          - `reasoning_tokens: number`

          - `total_tokens: number`

      - `BetaResponseCodeInterpreterToolCall`

        A tool call to run code.

      - `LocalShellCall`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: Action`

          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`.

            - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "local_shell_call"`

          The type of the local shell call. Always `local_shell_call`.

          - `"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`

        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`.

          - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseFunctionShellToolCall`

        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`

          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 | BetaResponseContainerReference | null`

          Represents the use of a local environment to perform shell actions.

          - `BetaResponseLocalEnvironment`

            Represents the use of a local environment to perform shell actions.

            - `type: "local"`

              The environment type. Always `local`.

              - `"local"`

          - `BetaResponseContainerReference`

            Represents a container created with /v1/containers.

            - `container_id: string`

            - `type: "container_reference"`

              The environment type. Always `container_reference`.

              - `"container_reference"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The ID of the entity that created this tool call.

      - `BetaResponseFunctionShellToolCallOutput`

        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 | Exit`

            Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

            - `Timeout`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit`

              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`.

                - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "shell_call_output"`

          The type of the shell call output. Always `shell_call_output`.

          - `"shell_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The identifier of the actor that created the item.

      - `BetaResponseApplyPatchToolCall`

        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 | DeleteFile | UpdateFile`

          One of the create_file, delete_file, or update_file operations applied via apply_patch.

          - `CreateFile`

            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.

              - `"create_file"`

          - `DeleteFile`

            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.

              - `"delete_file"`

          - `UpdateFile`

            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.

              - `"update_file"`

        - `status: "in_progress" | "completed"`

          The status of the apply patch tool call. One of `in_progress` or `completed`.

          - `"in_progress"`

          - `"completed"`

        - `type: "apply_patch_call"`

          The type of the item. Always `apply_patch_call`.

          - `"apply_patch_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The ID of the entity that created this tool call.

      - `BetaResponseApplyPatchToolCallOutput`

        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`.

          - `"completed"`

          - `"failed"`

        - `type: "apply_patch_call_output"`

          The type of the item. Always `apply_patch_call_output`.

          - `"apply_patch_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"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`

        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`.

          - `"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?: BetaMcpToolCallError | 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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `McpListTools`

        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`.

          - `"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`

        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`.

          - `"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`

        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`.

          - `"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`

        A call to a custom tool created by the model.

      - `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `created_by?: string`

          The identifier of the actor that created the item.

    - `parallel_tool_calls: boolean`

      Whether to allow the model to run tool calls in parallel.

    - `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.
      We generally recommend altering this or `top_p` but not both.

      `minimum: 0`, `maximum: 2`

    - `tool_choice: BetaToolChoiceOptions | BetaToolChoiceAllowed | BetaToolChoiceTypes | 6 more`

      How the model should select which tool (or tools) to use when generating
      a response. See the `tools` parameter to see how to specify which tools
      the model can call.

      - `BetaToolChoiceOptions = "none" | "auto" | "required"`

        Controls which (if any) tool is called by the model.

        `none` means the model will not call any tool and instead generates a message.

        `auto` means the model can pick between generating a message or calling one or
        more tools.

        `required` means the model must call one or more tools.

        - `"none"`

        - `"auto"`

        - `"required"`

      - `BetaToolChoiceAllowed`

        Constrains the tools available to the model to a pre-defined set.

        - `mode: "auto" | "required"`

          Constrains the tools available to the model to a pre-defined set.

          `auto` allows the model to pick from among the allowed tools and generate a
          message.

          `required` requires the model to call one or more of the allowed tools.

          - `"auto"`

          - `"required"`

        - `tools: Array<Record<string, unknown>>`

          A list of tool definitions that the model should be allowed to call.

          For the Responses API, the list of tool definitions might look like:

          ```json
          [
            { "type": "function", "name": "get_weather" },
            { "type": "mcp", "server_label": "deepwiki" },
            { "type": "image_generation" }
          ]
          ```

        - `type: "allowed_tools"`

          Allowed tool configuration type. Always `allowed_tools`.

          - `"allowed_tools"`

      - `BetaToolChoiceTypes`

        Indicates that the model should use a built-in tool to generate a response.
        [Learn more about built-in tools](/api/docs/guides/tools).

        - `type: "file_search" | "web_search_preview" | "computer" | 5 more`

          The type of hosted tool the model should to use. Learn more about
          [built-in tools](/api/docs/guides/tools).

          Allowed values are:

          - `file_search`
          - `web_search_preview`
          - `computer`
          - `computer_use_preview`
          - `computer_use`
          - `code_interpreter`
          - `image_generation`

          - `"file_search"`

          - `"web_search_preview"`

          - `"computer"`

          - `"computer_use_preview"`

          - `"computer_use"`

          - `"web_search_preview_2025_03_11"`

          - `"image_generation"`

          - `"code_interpreter"`

      - `BetaToolChoiceFunction`

        Use this option to force the model to call a specific function.

        - `name: string`

          The name of the function to call.

        - `type: "function"`

          For function calling, the type is always `function`.

          - `"function"`

      - `BetaToolChoiceMcp`

        Use this option to force the model to call a specific tool on a remote MCP server.

        - `server_label: string`

          The label of the MCP server to use.

        - `type: "mcp"`

          For MCP tools, the type is always `mcp`.

          - `"mcp"`

        - `name?: string | null`

          The name of the tool to call on the server.

      - `BetaToolChoiceCustom`

        Use this option to force the model to call a specific custom tool.

        - `name: string`

          The name of the custom tool to call.

        - `type: "custom"`

          For custom tool calling, the type is always `custom`.

          - `"custom"`

      - `BetaSpecificProgrammaticToolCallingParam`

        - `type: "programmatic_tool_calling"`

          The tool to call. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `BetaToolChoiceApplyPatch`

        Forces the model to call the apply_patch tool when executing a tool call.

        - `type: "apply_patch"`

          The tool to call. Always `apply_patch`.

          - `"apply_patch"`

      - `BetaToolChoiceShell`

        Forces the model to call the shell tool when a tool call is required.

        - `type: "shell"`

          The tool to call. Always `shell`.

          - `"shell"`

    - `tools: Array<BetaTool>`

      An array of tools the model may call while generating a response. You
      can specify which tool to use by setting the `tool_choice` parameter.

      We support the following categories of tools:

      - **Built-in tools**: Tools that are provided by OpenAI that extend the
        model's capabilities, like [web search](/api/docs/guides/tools-web-search)
        or [file search](/api/docs/guides/tools-file-search). Learn more about
        [built-in tools](/api/docs/guides/tools).
      - **MCP Tools**: Integrations with third-party systems via custom MCP servers
        or predefined connectors such as Google Drive and SharePoint. Learn more about
        [MCP Tools](/api/docs/guides/tools-connectors-mcp).
      - **Function calls (custom tools)**: Functions that are defined by you,
        enabling the model to call your own code with strongly typed arguments
        and outputs. Learn more about
        [function calling](/api/docs/guides/function-calling). You can also use
        custom tools to call your own code.

      - `BetaFunctionTool`

        Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

      - `BetaFileSearchTool`

        A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

      - `BetaComputerTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaComputerUsePreviewTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaWebSearchTool`

        Search the Internet for sources related to the prompt. Learn more about the
        [web search tool](/api/docs/guides/tools-web-search).

      - `Mcp`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

      - `CodeInterpreter`

        A tool that runs Python code to help generate a response to a prompt.

      - `ProgrammaticToolCalling`

      - `ImageGeneration`

        A tool that generates images using the GPT image models.

      - `LocalShell`

        A tool that allows the model to execute shell commands in a local environment.

      - `BetaFunctionShellTool`

        A tool that allows the model to execute shell commands.

      - `BetaCustomTool`

        A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

      - `BetaNamespaceTool`

        Groups function/custom tools under a shared namespace.

      - `BetaToolSearchTool`

        Hosted or BYOT tool search configuration for deferred tools.

      - `BetaWebSearchPreviewTool`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

      - `BetaApplyPatchTool`

        Allows the assistant to create, delete, or update files using unified diffs.

    - `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.

      `minimum: 0`, `maximum: 1`

    - `background?: boolean | null`

      Whether to run the model response in the background.
      [Learn more](/api/docs/guides/background).

    - `completed_at?: number | null`

      Unix timestamp (in seconds) of when this Response was completed.
      Only present when the status is `completed`.

      `format: unixtime`

    - `conversation?: Conversation | null`

      The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation.

      - `id: string`

        The unique ID of the conversation that this response was associated with.

    - `image?: Image`

      - `context_compression: "enabled" | "disabled"`

        Effective image context optimization policy.

        - `"enabled"`

        - `"disabled"`

    - `max_output_tokens?: number | null`

      An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/api/docs/guides/reasoning).

    - `max_tool_calls?: number | null`

      The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

    - `moderation?: Moderation | null`

      Moderation results for the response input and output, if moderated completions were requested.

      - `input: ModerationResult | Error`

        Moderation for the response input.

        - `ModerationResult`

          A moderation result produced for the response input or output.

          - `categories: Record<string, boolean>`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: Record<string, Array<"text" | "image">>`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: Record<string, number>`

            A dictionary of moderation categories to scores.

          - `flagged: boolean`

            A boolean indicating whether the content was flagged by any category.

          - `model: string`

            The moderation model that produced this result.

          - `type: "moderation_result"`

            The object type, which was always `moderation_result` for successful moderation results.

            - `"moderation_result"`

        - `Error`

          An error produced while attempting moderation for the response input or output.

          - `code: string`

            The error code.

          - `message: string`

            The error message.

          - `type: "error"`

            The object type, which was always `error` for moderation failures.

            - `"error"`

      - `output: ModerationResult | Error`

        Moderation for the response output.

        - `ModerationResult`

          A moderation result produced for the response input or output.

          - `categories: Record<string, boolean>`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: Record<string, Array<"text" | "image">>`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: Record<string, number>`

            A dictionary of moderation categories to scores.

          - `flagged: boolean`

            A boolean indicating whether the content was flagged by any category.

          - `model: string`

            The moderation model that produced this result.

          - `type: "moderation_result"`

            The object type, which was always `moderation_result` for successful moderation results.

            - `"moderation_result"`

        - `Error`

          An error produced while attempting moderation for the response input or output.

          - `code: string`

            The error code.

          - `message: string`

            The error message.

          - `type: "error"`

            The object type, which was always `error` for moderation failures.

            - `"error"`

    - `previous_response_id?: string | null`

      The unique ID of the previous response to the model. Use this to
      create multi-turn conversations. Learn more about
      [conversation state](/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.

    - `prompt?: BetaResponsePrompt | null`

      Reference to a prompt template and its variables.
      [Learn more](/api/docs/guides/text?api-mode=responses#version-prompts-in-code).

      - `id: string`

        The unique identifier of the prompt template to use.

      - `variables?: Record<string, string | BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile> | null`

        Optional map of values to substitute in for variables in your
        prompt. The substitution values can either be strings, or other
        Response input types like images or files.

        - `string`

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile`

          A file input to the model.

      - `version?: string | null`

        Optional version of the prompt template.

    - `prompt_cache_diagnostics?: CacheMiss | CacheHit | ComparisonResponseNotFound | Unavailable`

      Prompt cache diagnostics requested for this response.

      - `CacheMiss`

        - `cache_missed_tokens: number`

          The estimated number of input tokens affected after the first detected divergence.

        - `reason: "model_changed" | "prompt_cache_key_changed" | "tools_changed" | 6 more`

          The reason prompt cache reuse did not occur.

          - `"model_changed"`

          - `"prompt_cache_key_changed"`

          - `"tools_changed"`

          - `"text_format_changed"`

          - `"reasoning_effort_changed"`

          - `"verbosity_changed"`

          - `"context_compacted"`

          - `"input_changed"`

          - `"service_tier_changed"`

        - `type: "cache_miss"`

          - `"cache_miss"`

        - `comparison_reusable_tokens?: number`

          The raw token count of the reusable prefix in the compared response.

      - `CacheHit`

        - `type: "cache_hit"`

          - `"cache_hit"`

      - `ComparisonResponseNotFound`

        - `type: "comparison_response_not_found"`

          - `"comparison_response_not_found"`

      - `Unavailable`

        - `type: "unavailable"`

          - `"unavailable"`

    - `prompt_cache_key?: string | null`

      Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/api/docs/guides/prompt-caching).

    - `prompt_cache_options?: PromptCacheOptions`

      The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

      - `mode: "implicit" | "explicit"`

        Whether implicit prompt-cache breakpoints were enabled.

        - `"implicit"`

        - `"explicit"`

      - `ttl: "30m" | "12h"`

        The minimum lifetime applied to each cache breakpoint.

        - `"30m"`

        - `"12h"`

      - `comparison_response_id?: string | null`

        The response ID supplied as the prompt cache diagnostics comparison.

    - `prompt_cache_retention?: "in_memory" | "24h" | null`

      Deprecated. Use `prompt_cache_options.ttl` instead.

      The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/api/docs/guides/prompt-caching#prompt-cache-retention).
      This field expresses a maximum retention policy, while
      `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two
      fields are independent and do not interact.
      For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported.

      For older models that support both `in_memory` and `24h`, the default depends on your organization's data retention policy:

      - Organizations without ZDR enabled default to `24h`.
      - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified.

      - `"in_memory"`

      - `"24h"`

    - `reasoning?: Reasoning | null`

      Configuration options for
      [reasoning models](/api/docs/guides/reasoning).

      - `context?: "auto" | "current_turn" | "all_turns" | null`

        Controls which reasoning items are rendered back to the model on later turns.
        If omitted or set to `auto`, the model determines the context mode. The
        `gpt-5.6` model family defaults to `all_turns`; earlier models default to
        `current_turn`.

        When returned on a response, this is the effective reasoning context mode
        used for the response.

        - `"auto"`

        - `"current_turn"`

        - `"all_turns"`

      - `effort?: "none" | "minimal" | "low" | 4 more | null`

        Constrains effort on reasoning for reasoning models. Currently supported
        values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
        Reducing reasoning effort can result in faster responses and fewer tokens
        used on reasoning in a response. Not all reasoning models support every
        value. See the
        [reasoning guide](/api/docs/guides/reasoning)
        for model-specific support.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `generate_summary?: "auto" | "concise" | "detailed" | null`

        **Deprecated:** use `summary` instead.

        A summary of the reasoning performed by the model. This can be
        useful for debugging and understanding the model's reasoning process.
        One of `auto`, `concise`, or `detailed`.

        - `"auto"`

        - `"concise"`

        - `"detailed"`

      - `mode?: (string & {}) | "standard" | "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `(string & {})`

        - `"standard" | "pro"`

          - `"standard"`

          - `"pro"`

      - `summary?: "auto" | "concise" | "detailed" | null`

        A summary of the reasoning performed by the model. This can be
        useful for debugging and understanding the model's reasoning process.
        One of `auto`, `concise`, or `detailed`.

        `concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.

        - `"auto"`

        - `"concise"`

        - `"detailed"`

    - `safety_identifier?: string | null`

      A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.
      The IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

      `maxLength: 128`

    - `service_tier?: BetaServiceTier | null`

      Specifies the processing type used for serving the request.

      - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
      - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
      - If set to '[flex](/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.
      - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.
      - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for `gpt-5.6-sol`; a response served through it will show `service_tier=ultrafast`.
      - When not set, the default behavior is 'auto'.

      When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

      - `"auto"`

      - `"default"`

      - `"flex"`

      - `"scale"`

      - `"priority"`

      - `"fast"`

      - `"ultrafast"`

    - `status?: BetaResponseStatus`

      The status of the response generation. One of `completed`, `failed`,
      `in_progress`, `cancelled`, `queued`, or `incomplete`.

      - `"completed"`

      - `"failed"`

      - `"in_progress"`

      - `"cancelled"`

      - `"queued"`

      - `"incomplete"`

    - `text?: BetaResponseTextConfig`

      Configuration options for a text response from the model. Can be plain
      text or structured JSON data. Learn more:

      - [Text inputs and outputs](/api/docs/guides/text)
      - [Structured Outputs](/api/docs/guides/structured-outputs)

      - `format?: BetaResponseFormatTextConfig`

        An object specifying the format that the model must output.

        Configuring `{ "type": "json_schema" }` enables Structured Outputs,
        which ensures the model will match your supplied JSON schema. Learn more in the
        [Structured Outputs guide](/api/docs/guides/structured-outputs).

        The default format is `{ "type": "text" }` with no additional options.

        **Not recommended for gpt-4o and newer models:**

        Setting to `{ "type": "json_object" }` enables the older JSON mode, which
        ensures the message the model generates is valid JSON. Using `json_schema`
        is preferred for models that support it.

        - `Text`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig`

          JSON Schema response format. Used to generate structured JSON responses.
          Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

        - `JSONObject`

          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`.

            - `"json_object"`

      - `verbosity?: "low" | "medium" | "high" | null`

        Constrains the verbosity of the model's response. Lower values will result in
        more concise responses, while higher values will result in more verbose responses.
        Currently supported values are `low`, `medium`, and `high`. The default is
        `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tool_usage?: ToolUsage`

      Usage reported by hosted tools, separate from base model `usage`. The field
      can be omitted when tool usage is unavailable. When present, tool families
      with no recorded usage have zero counts.

      `image_gen` sums available token counts across image generation calls.
      Calls with missing or incomplete usage records may be skipped. Output
      token details and cached input counts can be omitted. An omitted cache
      count means cache usage is unknown.

      `web_search.num_requests` counts billable searches. Discounted searches
      and actions such as opening a page are excluded. Use billing records to
      reconcile final charges.

      - `image_gen: ImageGen`

        Aggregated usage statistics for image generation tool calls.

        - `input_tokens: number`

          The number of tokens (images and text) in the input prompt.

        - `input_tokens_details: InputTokensDetails`

          The input tokens detailed information for the image generation.

          - `image_tokens: number`

            The number of image tokens in the input prompt.

          - `text_tokens: number`

            The number of text tokens in the input prompt.

        - `output_tokens: number`

          The number of output tokens generated by the model.

        - `total_tokens: number`

          The total number of tokens (images and text) used for the image generation.

        - `cached_tokens?: number`

        - `cached_tokens_details?: CachedTokensDetails`

          - `cached_image_tokens: number`

          - `cached_text_tokens: number`

        - `output_tokens_details?: OutputTokensDetails`

          The output token details for the image generation.

          - `image_tokens: number`

            The number of image output tokens generated by the model.

          - `text_tokens: number`

            The number of text output tokens generated by the model.

      - `web_search: WebSearch`

        Aggregated billable usage statistics for web search tool calls.

        - `num_requests: number`

          The number of billable web search requests issued.

    - `top_logprobs?: number | null`

      An integer between 0 and 20 specifying the maximum number of most likely
      tokens to return at each token position, each with an associated log
      probability. In some cases, the number of returned tokens may be fewer than
      requested.

      `minimum: 0`, `maximum: 20`

    - `truncation?: "auto" | "disabled" | null`

      The truncation strategy to use for the model response.

      - `auto`: If the input to this Response exceeds
        the model's context window size, the model will truncate the
        response to fit the context window by dropping items from the beginning of the conversation.
        On some models, trimming can begin earlier because the API subtracts the model's
        maximum output allowance from its input limit, even if you set a lower `max_output_tokens`.
      - `disabled` (default): If the input size will exceed the context window
        size for a model, the request will fail with a 400 error.

      - `"auto"`

      - `"disabled"`

    - `usage?: BetaResponseUsage`

      Represents token usage details including input tokens, output tokens,
      a breakdown of output tokens, and the total tokens used.

      - `input_tokens: number`

        The number of input tokens.

      - `input_tokens_details: InputTokensDetails`

        A detailed breakdown of the input tokens.

        - `cache_write_tokens: number`

          The number of input tokens that were written to the cache.

        - `cached_tokens: number`

          The number of tokens that were retrieved from the cache.
          [More on prompt caching](/api/docs/guides/prompt-caching).

        - `cache_write_tokens_details?: CacheWriteTokensDetails`

          - `ttl_12h_tokens: number`

            The number of input tokens written with 12-hour retention.

          - `ttl_30m_tokens: number`

            The number of input tokens written with 30-minute retention.

      - `output_tokens: number`

        The number of output tokens.

      - `output_tokens_details: OutputTokensDetails`

        A detailed breakdown of the output tokens.

        - `reasoning_tokens: number`

          The number of reasoning tokens.

      - `total_tokens: number`

        The total number of tokens used.

    - `user?: string`

      This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.
      A stable identifier for your end-users.
      Used to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.failed"`

    The type of the event. Always `response.failed`.

    - `"response.failed"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response File Search Call Completed Event

- `BetaResponseFileSearchCallCompletedEvent`

  Emitted when a file search call is completed (results found).

  - `item_id: string`

    The ID of the output item that the file search call is initiated.

  - `output_index: number`

    The index of the output item that the file search call is initiated.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.file_search_call.completed"`

    The type of the event. Always `response.file_search_call.completed`.

    - `"response.file_search_call.completed"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response File Search Call In Progress Event

- `BetaResponseFileSearchCallInProgressEvent`

  Emitted when a file search call is initiated.

  - `item_id: string`

    The ID of the output item that the file search call is initiated.

  - `output_index: number`

    The index of the output item that the file search call is initiated.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.file_search_call.in_progress"`

    The type of the event. Always `response.file_search_call.in_progress`.

    - `"response.file_search_call.in_progress"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response File Search Call Searching Event

- `BetaResponseFileSearchCallSearchingEvent`

  Emitted when a file search is currently searching.

  - `item_id: string`

    The ID of the output item that the file search call is initiated.

  - `output_index: number`

    The index of the output item that the file search call is searching.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.file_search_call.searching"`

    The type of the event. Always `response.file_search_call.searching`.

    - `"response.file_search_call.searching"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response File Search Tool Call

- `BetaResponseFileSearchToolCall`

  The results of a file search tool call. See the
  [file search guide](/api/docs/guides/tools-file-search) 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`,

    - `"in_progress"`

    - `"searching"`

    - `"completed"`

    - `"incomplete"`

    - `"failed"`

  - `type: "file_search_call"`

    The type of the file search tool call. Always `file_search_call`.

    - `"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.

      - `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.

      `format: float`

    - `text?: string`

      The text that was retrieved from the file.

### Beta Response Format Text Config

- `BetaResponseFormatTextConfig = Text | BetaResponseFormatTextJSONSchemaConfig | JSONObject`

  An object specifying the format that the model must output.

  Configuring `{ "type": "json_schema" }` enables Structured Outputs,
  which ensures the model will match your supplied JSON schema. Learn more in the
  [Structured Outputs guide](/api/docs/guides/structured-outputs).

  The default format is `{ "type": "text" }` with no additional options.

  **Not recommended for gpt-4o and newer models:**

  Setting to `{ "type": "json_object" }` enables the older JSON mode, which
  ensures the message the model generates is valid JSON. Using `json_schema`
  is preferred for models that support it.

  - `Text`

    Default response format. Used to generate text responses.

    - `type: "text"`

      The type of response format being defined. Always `text`.

      - `"text"`

  - `BetaResponseFormatTextJSONSchemaConfig`

    JSON Schema response format. Used to generate structured JSON responses.
    Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

    - `name: string`

      The name of the response format. Must be a-z, A-Z, 0-9, or contain
      underscores and dashes, with a maximum length of 64.

    - `schema: Record<string, unknown>`

      The schema for the response format, described as a JSON Schema object.
      Learn how to build JSON schemas [here](https://json-schema.org/).

    - `type: "json_schema"`

      The type of response format being defined. Always `json_schema`.

      - `"json_schema"`

    - `description?: string`

      A description of what the response format is for, used by the model to
      determine how to respond in the format.

    - `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](/api/docs/guides/structured-outputs).

  - `JSONObject`

    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`.

      - `"json_object"`

### Beta Response Format Text JSON Schema Config

- `BetaResponseFormatTextJSONSchemaConfig`

  JSON Schema response format. Used to generate structured JSON responses.
  Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

  - `name: string`

    The name of the response format. Must be a-z, A-Z, 0-9, or contain
    underscores and dashes, with a maximum length of 64.

  - `schema: Record<string, unknown>`

    The schema for the response format, described as a JSON Schema object.
    Learn how to build JSON schemas [here](https://json-schema.org/).

  - `type: "json_schema"`

    The type of response format being defined. Always `json_schema`.

    - `"json_schema"`

  - `description?: string`

    A description of what the response format is for, used by the model to
    determine how to respond in the format.

  - `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](/api/docs/guides/structured-outputs).

### Beta Response Function Call Arguments Delta Event

- `BetaResponseFunctionCallArgumentsDeltaEvent`

  Emitted when there is a partial function-call arguments delta.

  - `delta: string`

    The function-call arguments delta that is added.

  - `item_id: string`

    The ID of the output item that the function-call arguments delta is added to.

  - `output_index: number`

    The index of the output item that the function-call arguments delta is added to.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.function_call_arguments.delta"`

    The type of the event. Always `response.function_call_arguments.delta`.

    - `"response.function_call_arguments.delta"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Function Call Arguments Done Event

- `BetaResponseFunctionCallArgumentsDoneEvent`

  Emitted when function-call arguments are finalized.

  - `arguments: string`

    The function-call arguments.

  - `item_id: string`

    The ID of the item.

  - `output_index: number`

    The index of the output item.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.function_call_arguments.done"`

    - `"response.function_call_arguments.done"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Function Call Output Item

- `BetaResponseFunctionCallOutputItem = BetaResponseInputTextContent | BetaResponseInputImageContent | BetaResponseInputFileContent`

  A piece of message content, such as text, an image, or a file.

  - `BetaResponseInputTextContent`

    A text input to the model.

    - `text: string`

      The text input to the model.

      `maxLength: 10485760`

    - `type: "input_text"`

      The type of the input item. Always `input_text`.

      - `"input_text"`

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

  - `BetaResponseInputImageContent`

    An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

    - `type: "input_image"`

      The type of the input item. Always `input_image`.

      - `"input_image"`

    - `detail?: BetaImageDetail | null`

      The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

      - `"low"`

      - `"high"`

      - `"auto"`

      - `"original"`

    - `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.

      `maxLength: 20971520`, `format: uri`

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

  - `BetaResponseInputFileContent`

    A file input to the model.

    - `type: "input_file"`

      The type of the input item. Always `input_file`.

      - `"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`.

      - `"auto"`

      - `"low"`

      - `"high"`

    - `file_data?: string | null`

      The base64-encoded data of the file to be sent to the model.

      `maxLength: 73400320`

    - `file_id?: string | null`

      The ID of the file to be sent to the model.

    - `file_url?: string | null`

      The URL of the file to be sent to the model.

      `format: uri`

    - `filename?: string | null`

      The name of the file to be sent to the model.

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

### Beta Response Function Call Output Item List

- `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

  An array of content outputs (text, image, file) for the function tool call.

  - `BetaResponseInputTextContent`

    A text input to the model.

    - `text: string`

      The text input to the model.

      `maxLength: 10485760`

    - `type: "input_text"`

      The type of the input item. Always `input_text`.

      - `"input_text"`

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

  - `BetaResponseInputImageContent`

    An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

    - `type: "input_image"`

      The type of the input item. Always `input_image`.

      - `"input_image"`

    - `detail?: BetaImageDetail | null`

      The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

      - `"low"`

      - `"high"`

      - `"auto"`

      - `"original"`

    - `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.

      `maxLength: 20971520`, `format: uri`

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

  - `BetaResponseInputFileContent`

    A file input to the model.

    - `type: "input_file"`

      The type of the input item. Always `input_file`.

      - `"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`.

      - `"auto"`

      - `"low"`

      - `"high"`

    - `file_data?: string | null`

      The base64-encoded data of the file to be sent to the model.

      `maxLength: 73400320`

    - `file_id?: string | null`

      The ID of the file to be sent to the model.

    - `file_url?: string | null`

      The URL of the file to be sent to the model.

      `format: uri`

    - `filename?: string | null`

      The name of the file to be sent to the model.

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

### Beta Response Function Shell Call Output Content

- `BetaResponseFunctionShellCallOutputContent`

  Captured stdout and stderr for a portion of a shell tool call output.

  - `outcome: Timeout | Exit`

    The exit or timeout outcome associated with this shell call.

    - `Timeout`

      Indicates that the shell call exceeded its configured time limit.

      - `type: "timeout"`

        The outcome type. Always `timeout`.

        - `"timeout"`

    - `Exit`

      Indicates that the shell commands finished and returned an exit code.

      - `exit_code: number`

        The exit code returned by the shell process.

      - `type: "exit"`

        The outcome type. Always `exit`.

        - `"exit"`

  - `stderr: string`

    Captured stderr output for the shell call.

    `maxLength: 10485760`

  - `stdout: string`

    Captured stdout output for the shell call.

    `maxLength: 10485760`

### Beta Response Function Shell Tool Call

- `BetaResponseFunctionShellToolCall`

  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`

    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 | BetaResponseContainerReference | null`

    Represents the use of a local environment to perform shell actions.

    - `BetaResponseLocalEnvironment`

      Represents the use of a local environment to perform shell actions.

      - `type: "local"`

        The environment type. Always `local`.

        - `"local"`

    - `BetaResponseContainerReference`

      Represents a container created with /v1/containers.

      - `container_id: string`

      - `type: "container_reference"`

        The environment type. Always `container_reference`.

        - `"container_reference"`

  - `status: "in_progress" | "completed" | "incomplete"`

    The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

    - `"in_progress"`

    - `"completed"`

    - `"incomplete"`

  - `type: "shell_call"`

    The type of the item. Always `shell_call`.

    - `"shell_call"`

  - `agent?: Agent`

    The agent that produced this item.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

  - `caller?: Direct | Program | null`

    The execution context that produced this tool call.

    - `Direct`

      - `type: "direct"`

        - `"direct"`

    - `Program`

      - `caller_id: string`

        The call ID of the program item that produced this tool call.

      - `type: "program"`

        - `"program"`

  - `created_by?: string`

    The ID of the entity that created this tool call.

### Beta Response Function Shell Tool Call Output

- `BetaResponseFunctionShellToolCallOutput`

  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 | Exit`

      Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

      - `Timeout`

        Indicates that the shell call exceeded its configured time limit.

        - `type: "timeout"`

          The outcome type. Always `timeout`.

          - `"timeout"`

      - `Exit`

        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`.

          - `"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`.

    - `"in_progress"`

    - `"completed"`

    - `"incomplete"`

  - `type: "shell_call_output"`

    The type of the shell call output. Always `shell_call_output`.

    - `"shell_call_output"`

  - `agent?: Agent`

    The agent that produced this item.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

  - `caller?: Direct | Program | null`

    The execution context that produced this tool call.

    - `Direct`

      - `type: "direct"`

        - `"direct"`

    - `Program`

      - `caller_id: string`

        The call ID of the program item that produced this tool call.

      - `type: "program"`

        - `"program"`

  - `created_by?: string`

    The identifier of the actor that created the item.

### Beta Response Function Tool Call

- `BetaResponseFunctionToolCall`

  A tool call to run a function. See the
  [function calling guide](/api/docs/guides/function-calling) 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`.

    - `"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.

  - `async?: boolean`

    Whether the function tool call runs asynchronously.

  - `caller?: Direct | Program | null`

    The execution context that produced this tool call.

    - `Direct`

      - `type: "direct"`

        - `"direct"`

    - `Program`

      - `caller_id: string`

        The call ID of the program item that produced this tool call.

      - `type: "program"`

        - `"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.

    - `"in_progress"`

    - `"completed"`

    - `"incomplete"`

### Beta Response Function Tool Call Item

- `BetaResponseFunctionToolCallItem extends BetaResponseFunctionToolCall`

  A tool call to run a function. See the
  [function calling guide](/api/docs/guides/function-calling) for more information.

  - `id: string`

    The unique ID of the function tool call.

  - `status: "in_progress" | "completed" | "incomplete"`

    The status of the item. One of `in_progress`, `completed`, or
    `incomplete`. Populated when items are returned via API.

    - `"in_progress"`

    - `"completed"`

    - `"incomplete"`

  - `created_by?: string`

    The identifier of the actor that created the item.

### Beta Response Function Tool Call Output Item

- `BetaResponseFunctionToolCallOutputItem`

  - `id: string`

    The unique ID of the function call tool output.

  - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

    The output from the function call generated by your code.
    Can be a string or an list of output content.

    - `string`

    - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

      - `BetaResponseInputText`

        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`.

          - `"input_text"`

        - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

          Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

          - `ttl?: "30m" | "12h"`

            The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

            - `"30m"`

            - `"12h"`

      - `BetaResponseInputImage`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `detail: BetaImageDetail`

          The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

          - `"low"`

          - `"high"`

          - `"auto"`

          - `"original"`

        - `type: "input_image"`

          The type of the input item. Always `input_image`.

          - `"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.

          `format: uri`

        - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

          Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

          - `ttl?: "30m" | "12h"`

            The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

            - `"30m"`

            - `"12h"`

      - `BetaResponseInputFile`

        A file input to the model.

        - `type: "input_file"`

          The type of the input item. Always `input_file`.

          - `"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`.

          - `"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.

          `format: uri`

        - `filename?: string`

          The name of the file to be sent to the model.

        - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

          Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

          - `ttl?: "30m" | "12h"`

            The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

            - `"30m"`

            - `"12h"`

  - `status: "in_progress" | "completed" | "incomplete"`

    The status of the item. One of `in_progress`, `completed`, or
    `incomplete`. Populated when items are returned via API.

    - `"in_progress"`

    - `"completed"`

    - `"incomplete"`

  - `type: "function_call_output"`

    The type of the function tool call output. Always `function_call_output`.

    - `"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.

  - `call_id?: string`

    The unique ID of the function tool call generated by the model.

  - `caller?: Direct | Program | null`

    The execution context that produced this tool call.

    - `Direct`

      - `type: "direct"`

        The caller type. Always `direct`.

        - `"direct"`

    - `Program`

      - `caller_id: string`

        The call ID of the program item that produced this tool call.

        `minLength: 1`, `maxLength: 64`

      - `type: "program"`

        The caller type. Always `program`.

        - `"program"`

  - `created_by?: string`

    The identifier of the actor that created the item.

  - `name?: string`

    The name of the tool that produced the output.

  - `namespace?: string`

    The namespace of the tool that produced the output.

### Beta Response Function Web Search

- `BetaResponseFunctionWebSearch`

  The results of a web search tool call. See the
  [web search guide](/api/docs/guides/tools-web-search) for more information.

  - `id: string`

    The unique ID of the web search tool call.

  - `action: Search | OpenPage | FindInPage`

    An object describing the specific action taken in this web search call.
    Includes details on how the model used the web (search, open_page, find_in_page).

    - `Search`

      Action type "search" - Performs a web search query.

      - `type: "search"`

        The action type.

        - `"search"`

      - `queries?: Array<string>`

        The search queries.

      - `query?: string`

        The search query.

      - `sources?: Array<Source>`

        The sources used in the search.

        - `type: "url"`

          The type of source. Always `url`.

          - `"url"`

        - `url: string`

          The URL of the source.

          `format: uri`

    - `OpenPage`

      Action type "open_page" - Opens a specific URL from search results.

      - `type: "open_page"`

        The action type.

        - `"open_page"`

      - `url?: string | null`

        The URL opened by the model.

        `format: uri`

    - `FindInPage`

      Action type "find_in_page": Searches for a pattern within a loaded page.

      - `pattern: string`

        The pattern or text to search for within the page.

      - `type: "find_in_page"`

        The action type.

        - `"find_in_page"`

      - `url: string`

        The URL of the page searched for the pattern.

        `format: uri`

  - `status: "in_progress" | "searching" | "completed" | 2 more`

    The status of the web search tool call.

    - `"in_progress"`

    - `"searching"`

    - `"completed"`

    - `"failed"`

    - `"incomplete"`

  - `type: "web_search_call"`

    The type of the web search tool call. Always `web_search_call`.

    - `"web_search_call"`

  - `agent?: Agent | null`

    The agent that produced this item.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Image Gen Call Completed Event

- `BetaResponseImageGenCallCompletedEvent`

  Emitted when an image generation tool call has completed and the final image is available.

  - `item_id: string`

    The unique identifier of the image generation item being processed.

  - `output_index: number`

    The index of the output item in the response's output array.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.image_generation_call.completed"`

    The type of the event. Always 'response.image_generation_call.completed'.

    - `"response.image_generation_call.completed"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Image Gen Call Generating Event

- `BetaResponseImageGenCallGeneratingEvent`

  Emitted when an image generation tool call is actively generating an image (intermediate state).

  - `item_id: string`

    The unique identifier of the image generation item being processed.

  - `output_index: number`

    The index of the output item in the response's output array.

  - `sequence_number: number`

    The sequence number of the image generation item being processed.

  - `type: "response.image_generation_call.generating"`

    The type of the event. Always 'response.image_generation_call.generating'.

    - `"response.image_generation_call.generating"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Image Gen Call In Progress Event

- `BetaResponseImageGenCallInProgressEvent`

  Emitted when an image generation tool call is in progress.

  - `item_id: string`

    The unique identifier of the image generation item being processed.

  - `output_index: number`

    The index of the output item in the response's output array.

  - `sequence_number: number`

    The sequence number of the image generation item being processed.

  - `type: "response.image_generation_call.in_progress"`

    The type of the event. Always 'response.image_generation_call.in_progress'.

    - `"response.image_generation_call.in_progress"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Image Gen Call Partial Image Event

- `BetaResponseImageGenCallPartialImageEvent`

  Emitted when a partial image is available during image generation streaming.

  - `item_id: string`

    The unique identifier of the image generation item being processed.

  - `output_index: number`

    The index of the output item in the response's output array.

  - `partial_image_b64: string`

    Base64-encoded partial image data, suitable for rendering as an image.

  - `partial_image_index: number`

    0-based index for the partial image (backend is 1-based, but this is 0-based for the user).

  - `sequence_number: number`

    The sequence number of the image generation item being processed.

  - `type: "response.image_generation_call.partial_image"`

    The type of the event. Always 'response.image_generation_call.partial_image'.

    - `"response.image_generation_call.partial_image"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

  - `background?: string`

    The background setting that was used.

  - `output_format?: string`

    The output format that was used.

  - `quality?: string`

    The image quality that was used.

  - `size?: string`

    The image size that was used.

### Beta Response In Progress Event

- `BetaResponseInProgressEvent`

  Emitted when the response is in progress.

  - `response: BetaResponse`

    The response that is in progress.

    - `id: string`

      Unique identifier for this Response.

    - `access_programs: AccessPrograms | null`

      - `cyber: "standard" | "daybreak_blue" | "daybreak_red"`

        The effective Cyber access program used for this response.

        - `"standard"`

        - `"daybreak_blue"`

        - `"daybreak_red"`

    - `created_at: number`

      Unix timestamp (in seconds) of when this Response was created.

      `format: unixtime`

    - `error: BetaResponseError | null`

      An error object returned when the model fails to generate a Response.

      - `code: "server_error" | "rate_limit_exceeded" | "invalid_prompt" | 18 more`

        The error code for the response.

        - `"server_error"`

        - `"rate_limit_exceeded"`

        - `"invalid_prompt"`

        - `"data_residency_mismatch"`

        - `"bio_policy"`

        - `"misalignment_policy_violation"`

        - `"vector_store_timeout"`

        - `"invalid_image"`

        - `"invalid_image_format"`

        - `"invalid_base64_image"`

        - `"invalid_image_url"`

        - `"image_too_large"`

        - `"image_too_small"`

        - `"image_parse_error"`

        - `"image_content_policy_violation"`

        - `"invalid_image_mode"`

        - `"image_file_too_large"`

        - `"unsupported_image_media_type"`

        - `"empty_image_file"`

        - `"failed_to_download_image"`

        - `"image_file_not_found"`

      - `message: string`

        A human-readable description of the error.

      - `misalignment?: Misalignment`

        - `detailed_explanation?: string`

          The public explanation for this block.

        - `error_type?: (string & {}) | "potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

          An optional classification; clients must accept additional values.

          - `(string & {})`

          - `"potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

            - `"potentially_unintended_data_transfer"`

            - `"potentially_unintended_data_access"`

            - `"potentially_unintended_destructive_activity"`

            - `"other"`

        - `review_target?: string | null`

          An opaque target for explicitly continuing this review, or null when unavailable.

          `minLength: 1`, `maxLength: 96`

        - `steer?: Steer`

          An optional public continuation instruction.

          - `message: string`

            The public continuation instruction.

      - `param?: string | null`

        The request parameter associated with the error, or null if none was recorded.

      - `type?: string | null`

        The original error type, or null if it was not recorded.

    - `incomplete_details: IncompleteDetails | null`

      Details about why the response is incomplete.

      - `reason?: "max_output_tokens" | "max_messages" | "content_filter" | "steered"`

        The reason why the response is incomplete. `steered` means
        the response stopped at a safe output boundary after a
        WebSocket `response.steer` event. The server can then create
        a successor response automatically with the queued input.

        - `"max_output_tokens"`

        - `"max_messages"`

        - `"content_filter"`

        - `"steered"`

    - `instructions: string | Array<BetaResponseInputItem> | null`

      A system (or developer) message inserted into the model's context.

      When using along with `previous_response_id`, the instructions from a previous
      response will not be carried over to the next response. This makes it simple
      to swap out system (or developer) messages in new responses.

      - `string`

      - `Array<BetaResponseInputItem>`

        - `BetaEasyInputMessage`

          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.

            - `string`

            - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

              A list of one or many input items to the model, containing different content
              types.

              - `BetaResponseInputText`

                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`.

                  - `"input_text"`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImage`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

                - `detail: BetaImageDetail`

                  The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                  - `"low"`

                  - `"high"`

                  - `"auto"`

                  - `"original"`

                - `type: "input_image"`

                  The type of the input item. Always `input_image`.

                  - `"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.

                  `format: uri`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFile`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"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`.

                  - `"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.

                  `format: uri`

                - `filename?: string`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

          - `role: "user" | "assistant" | "system" | "developer"`

            The role of the message input. One of `user`, `assistant`, `system`, or
            `developer`.

            - `"user"`

            - `"assistant"`

            - `"system"`

            - `"developer"`

          - `phase?: "commentary" | "final_answer" | 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.

            - `"commentary"`

            - `"final_answer"`

          - `type?: "message"`

            The type of the message input. Always `message`.

            - `"message"`

        - `Message`

          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.

          - `content: BetaResponseInputMessageContentList`

            A list of one or many input items to the model, containing different content
            types.

          - `role: "user" | "system" | "developer"`

            The role of the message input. One of `user`, `system`, or `developer`.

            - `"user"`

            - `"system"`

            - `"developer"`

          - `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"`

            The status of item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type?: "message"`

            The type of the message input. Always set to `message`.

            - `"message"`

        - `BetaResponseOutputMessage`

          An output message from the model.

          - `id: string`

            The unique ID of the output message.

          - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

            The content of the output message.

            - `BetaResponseOutputText`

              A text output from the model.

              - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

                The annotations of the text output.

                - `FileCitation`

                  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 in the output text at which to insert the file citation.

                  - `type: "file_citation"`

                    The type of the file citation. Always `file_citation`.

                    - `"file_citation"`

                - `URLCitation`

                  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_citation"`

                  - `url: string`

                    The URL of the web resource.

                    `format: uri`

                - `ContainerFileCitation`

                  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`.

                    - `"container_file_citation"`

                - `FilePath`

                  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`.

                    - `"file_path"`

              - `text: string`

                The text output from the model.

              - `type: "output_text"`

                The type of the output text. Always `output_text`.

                - `"output_text"`

              - `logprobs?: Array<Logprob>`

                - `token: string`

                - `bytes: Array<number>`

                - `logprob: number`

                - `top_logprobs: Array<TopLogprob>`

                  - `token: string`

                  - `bytes: Array<number>`

                  - `logprob: number`

            - `BetaResponseOutputRefusal`

              A refusal from the model.

              - `refusal: string`

                The refusal explanation from the model.

              - `type: "refusal"`

                The type of the refusal. Always `refusal`.

                - `"refusal"`

          - `role: "assistant"`

            The role of the output message. Always `assistant`.

            - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "message"`

            The type of the output message. Always `message`.

            - `"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" | "final_answer" | 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.

            - `"commentary"`

            - `"final_answer"`

        - `BetaResponseFileSearchToolCall`

          The results of a file search tool call. See the
          [file search guide](/api/docs/guides/tools-file-search) 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`,

            - `"in_progress"`

            - `"searching"`

            - `"completed"`

            - `"incomplete"`

            - `"failed"`

          - `type: "file_search_call"`

            The type of the file search tool call. Always `file_search_call`.

            - `"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.

              - `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.

              `format: float`

            - `text?: string`

              The text that was retrieved from the file.

        - `BetaResponseComputerToolCall`

          A tool call to a computer use tool. See the
          [computer use guide](/api/docs/guides/tools-computer-use) 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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "computer_call"`

            The type of the computer call. Always `computer_call`.

            - `"computer_call"`

          - `action?: BetaComputerAction`

            A click action.

            - `Click`

              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`.

                - `"left"`

                - `"right"`

                - `"wheel"`

                - `"back"`

                - `"forward"`

              - `type: "click"`

                Specifies the event type. For a click action, this property is always `click`.

                - `"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`

              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`.

                - `"double_click"`

              - `x: number`

                The x-coordinate where the double click occurred.

              - `y: number`

                The y-coordinate where the double click occurred.

            - `Drag`

              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`.

                - `"drag"`

              - `keys?: Array<string> | null`

                The keys being held while dragging the mouse.

            - `Keypress`

              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`.

                - `"keypress"`

            - `Move`

              A mouse move action.

              - `type: "move"`

                Specifies the event type. For a move action, this property is always set to `move`.

                - `"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`

              A screenshot action.

              - `type: "screenshot"`

                Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

                - `"screenshot"`

            - `Scroll`

              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`.

                - `"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`

              An action to type in text.

              - `text: string`

                The text to type.

              - `type: "type"`

                Specifies the event type. For a type action, this property is always set to `type`.

                - `"type"`

            - `Wait`

              A wait action.

              - `type: "wait"`

                Specifies the event type. For a wait action, this property is always set to `wait`.

                - `"wait"`

          - `actions?: BetaComputerActionList`

            Flattened batched actions for `computer_use`. Each action includes an
            `type` discriminator and action-specific fields.

            - `Click`

              A click action.

            - `DoubleClick`

              A double click action.

            - `Drag`

              A drag action.

            - `Keypress`

              A collection of keypresses the model would like to perform.

            - `Move`

              A mouse move action.

            - `Screenshot`

              A screenshot action.

            - `Scroll`

              A scroll action.

            - `Type`

              An action to type in text.

            - `Wait`

              A wait action.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCallOutput`

          The output of a computer tool call.

          - `call_id: string`

            The ID of the computer tool call that produced the output.

            `minLength: 1`, `maxLength: 64`

          - `output: BetaResponseComputerToolCallOutputScreenshot`

            A computer screenshot image used with the computer use tool.

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is
              always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `file_id?: string`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url?: string`

              The URL of the screenshot image.

              `format: uri`

          - `type: "computer_call_output"`

            The type of the computer tool call output. Always `computer_call_output`.

            - `"computer_call_output"`

          - `id?: string | null`

            The ID of the computer tool call output.

          - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

            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.

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseFunctionWebSearch`

          The results of a web search tool call. See the
          [web search guide](/api/docs/guides/tools-web-search) for more information.

          - `id: string`

            The unique ID of the web search tool call.

          - `action: Search | OpenPage | FindInPage`

            An object describing the specific action taken in this web search call.
            Includes details on how the model used the web (search, open_page, find_in_page).

            - `Search`

              Action type "search" - Performs a web search query.

              - `type: "search"`

                The action type.

                - `"search"`

              - `queries?: Array<string>`

                The search queries.

              - `query?: string`

                The search query.

              - `sources?: Array<Source>`

                The sources used in the search.

                - `type: "url"`

                  The type of source. Always `url`.

                  - `"url"`

                - `url: string`

                  The URL of the source.

                  `format: uri`

            - `OpenPage`

              Action type "open_page" - Opens a specific URL from search results.

              - `type: "open_page"`

                The action type.

                - `"open_page"`

              - `url?: string | null`

                The URL opened by the model.

                `format: uri`

            - `FindInPage`

              Action type "find_in_page": Searches for a pattern within a loaded page.

              - `pattern: string`

                The pattern or text to search for within the page.

              - `type: "find_in_page"`

                The action type.

                - `"find_in_page"`

              - `url: string`

                The URL of the page searched for the pattern.

                `format: uri`

          - `status: "in_progress" | "searching" | "completed" | 2 more`

            The status of the web search tool call.

            - `"in_progress"`

            - `"searching"`

            - `"completed"`

            - `"failed"`

            - `"incomplete"`

          - `type: "web_search_call"`

            The type of the web search tool call. Always `web_search_call`.

            - `"web_search_call"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `BetaResponseFunctionToolCall`

          A tool call to run a function. See the
          [function calling guide](/api/docs/guides/function-calling) 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`.

            - `"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.

          - `async?: boolean`

            Whether the function tool call runs asynchronously.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `FunctionCallOutput`

          The output of a function tool call.

          - `output: string | BetaResponseFunctionCallOutputItemList`

            Text, image, or file output of the function tool call.

            - `string`

            - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                  `maxLength: 10485760`

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImageContent`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

                - `type: "input_image"`

                  The type of the input item. Always `input_image`.

                  - `"input_image"`

                - `detail?: BetaImageDetail | null`

                  The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                - `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.

                  `maxLength: 20971520`, `format: uri`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFileContent`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"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`.

                  - `"auto"`

                  - `"low"`

                  - `"high"`

                - `file_data?: string | null`

                  The base64-encoded data of the file to be sent to the model.

                  `maxLength: 73400320`

                - `file_id?: string | null`

                  The ID of the file to be sent to the model.

                - `file_url?: string | null`

                  The URL of the file to be sent to the model.

                  `format: uri`

                - `filename?: string | null`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

          - `type: "function_call_output"`

            The type of the function tool call output. Always `function_call_output`.

            - `"function_call_output"`

          - `id?: string | null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the function tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name?: string | null`

            The name of the tool that produced the output.

            `minLength: 1`, `maxLength: 128`

          - `namespace?: string | null`

            The namespace of the tool that produced the output.

            `minLength: 1`, `maxLength: 128`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AgentMessage`

          A message routed between agents.

          - `author: string`

            The sending agent identity.

          - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

            Plaintext, image, or encrypted content sent between agents.

            - `BetaResponseInputTextContent`

              A text input to the model.

            - `BetaResponseInputImageContent`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `EncryptedContent`

              Opaque encrypted content that Responses API decrypts inside trusted model execution.

              - `encrypted_content: string`

                Opaque encrypted content.

                `maxLength: 10485760`

              - `type: "encrypted_content"`

                The type of the input item. Always `encrypted_content`.

                - `"encrypted_content"`

          - `recipient: string`

            The destination agent identity.

          - `type: "agent_message"`

            The item type. Always `agent_message`.

            - `"agent_message"`

          - `id?: string | null`

            The unique ID of this agent message item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCall`

          - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

            The multi-agent action that was executed.

            - `"spawn_agent"`

            - `"interrupt_agent"`

            - `"list_agents"`

            - `"send_message"`

            - `"followup_task"`

            - `"wait_agent"`

          - `arguments: string`

            The action arguments as a JSON string.

          - `call_id: string`

            The unique ID linking this call to its output.

            `minLength: 1`, `maxLength: 64`

          - `type: "multi_agent_call"`

            The item type. Always `multi_agent_call`.

            - `"multi_agent_call"`

          - `id?: string | null`

            The unique ID of this multi-agent call.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCallOutput`

          - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

            The multi-agent action that produced this result.

            - `"spawn_agent"`

            - `"interrupt_agent"`

            - `"list_agents"`

            - `"send_message"`

            - `"followup_task"`

            - `"wait_agent"`

          - `call_id: string`

            The unique ID of the multi-agent call.

            `minLength: 1`, `maxLength: 64`

          - `output: Array<Output>`

            Text output returned by the multi-agent action.

            - `text: string`

              The text content.

              `maxLength: 10485760`

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

            - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

              Citations associated with the text content.

              - `FileCitation`

                - `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.

                  `minimum: 0`

                - `type: "file_citation"`

                  The citation type. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation`

                - `end_index: number`

                  The index of the last character of the citation in the message.

                  `minimum: 0`

                - `start_index: number`

                  The index of the first character of the citation in the message.

                  `minimum: 0`

                - `title: string`

                  The title of the cited resource.

                - `type: "url_citation"`

                  The citation type. Always `url_citation`.

                  - `"url_citation"`

                - `url: string`

                  The URL of the cited resource.

                  `format: uri`

              - `ContainerFileCitation`

                - `container_id: string`

                  The ID of the container.

                - `end_index: number`

                  The index of the last character of the citation in the message.

                  `minimum: 0`

                - `file_id: string`

                  The ID of the container file.

                - `filename: string`

                  The filename of the container file cited.

                - `start_index: number`

                  The index of the first character of the citation in the message.

                  `minimum: 0`

                - `type: "container_file_citation"`

                  The citation type. Always `container_file_citation`.

                  - `"container_file_citation"`

          - `type: "multi_agent_call_output"`

            The item type. Always `multi_agent_call_output`.

            - `"multi_agent_call_output"`

          - `id?: string | null`

            The unique ID of this multi-agent call output.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ToolSearchCall`

          - `arguments: unknown`

            The arguments supplied to the tool search call.

          - `type: "tool_search_call"`

            The item type. Always `tool_search_call`.

            - `"tool_search_call"`

          - `id?: string | null`

            The unique ID of this tool search call.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the tool search call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `execution?: "server" | "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the tool search call.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseToolSearchOutputItemParam`

          - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

            The loaded tool definitions returned by the tool search output.

            - `BetaFunctionTool`

              Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

                - `"function"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

              - `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`

              A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

              - `type: "file_search"`

                The type of the file search tool. Always `file_search`.

                - `"file_search"`

              - `vector_store_ids: Array<string>`

                The IDs of the vector stores to search.

              - `filters?: ComparisonFilter | CompoundFilter | null`

                A filter to apply.

                - `ComparisonFilter`

                  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

                    - `"eq"`

                    - `"ne"`

                    - `"gt"`

                    - `"gte"`

                    - `"lt"`

                    - `"lte"`

                    - `"in"`

                    - `"nin"`

                  - `value: string | number | boolean | Array<string | number>`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `Array<string | number>`

                      - `string`

                      - `number`

                - `CompoundFilter`

                  Combine multiple filters using `and` or `or`.

                  - `filters: Array<ComparisonFilter | unknown>`

                    Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

                    - `ComparisonFilter`

                      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

                        - `"eq"`

                        - `"ne"`

                        - `"gt"`

                        - `"gte"`

                        - `"lt"`

                        - `"lte"`

                        - `"in"`

                        - `"nin"`

                      - `value: string | number | boolean | Array<string | number>`

                        The value to compare against the attribute key; supports string, number, or boolean types.

                        - `string`

                        - `number`

                        - `boolean`

                        - `Array<string | number>`

                          - `string`

                          - `number`

                    - `unknown`

                  - `type: "and" | "or"`

                    Type of operation: `and` or `or`.

                    - `"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`

                Ranking options for search.

                - `hybrid_search?: HybridSearch`

                  Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

                  - `embedding_weight: number`

                    The weight of the embedding in the reciprocal ranking fusion.

                  - `text_weight: number`

                    The weight of the text in the reciprocal ranking fusion.

                - `ranker?: "auto" | "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"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`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

              - `type: "computer"`

                The type of the computer tool. Always `computer`.

                - `"computer"`

            - `BetaComputerUsePreviewTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

              - `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.

                - `"windows"`

                - `"mac"`

                - `"linux"`

                - `"ubuntu"`

                - `"browser"`

              - `type: "computer_use_preview"`

                The type of the computer use tool. Always `computer_use_preview`.

                - `"computer_use_preview"`

            - `BetaWebSearchTool`

              Search the Internet for sources related to the prompt. Learn more about the
              [web search tool](/api/docs/guides/tools-web-search).

              - `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`.

                - `"web_search"`

                - `"web_search_2025_08_26"`

              - `external_web_access?: boolean`

                Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

              - `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.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `user_location?: UserLocation | null`

                The approximate location of the user. If omitted or null, defaults to the
                United States. To avoid this fallback, pass `{"type": "approximate"}` without
                location fields. To localize results, provide the relevant location fields.

                - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type?: "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

                - `"mcp"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools?: Array<string> | McpToolFilter | null`

                List of allowed tool names or a filter object.

                - `Array<string>`

                - `McpToolFilter`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

                This field is deprecated for models released after September 1, 2026.
                Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
                connect through a Secure MCP Tunnel.

                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`

                - `"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" | null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter`

                  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`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                      it will match this filter.

                    - `tool_names?: Array<string>`

                      List of allowed tool names.

                  - `never?: Never`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

                `format: uri`

              - `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`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string | CodeInterpreterToolAuto`

                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.

                - `string`

                - `CodeInterpreterToolAuto`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                      - `type: "disabled"`

                        Disable outbound network access. Always `disabled`.

                        - `"disabled"`

                    - `BetaContainerNetworkPolicyAllowlist`

                      - `allowed_domains: Array<string>`

                        A list of allowed domains when type is `allowlist`.

                        `minItems: 1`

                      - `type: "allowlist"`

                        Allow outbound network access only to specified domains. Always `allowlist`.

                        - `"allowlist"`

                      - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                        Optional domain-scoped secrets for allowlisted domains.

                        `minItems: 1`

                        - `domain: string`

                          The domain associated with the secret.

                          `minLength: 1`

                        - `name: string`

                          The name of the secret to inject for the domain.

                          `minLength: 1`

                        - `value: string`

                          The secret value to inject for the domain.

                          `minLength: 1`, `maxLength: 10485760`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action?: "generate" | "edit" | "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background?: "transparent" | "opaque" | "auto"`

                Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
                `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
                Transparent backgrounds are available for supported GPT Image models. For
                `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
                using `transparent`, set the output format to `png` or `webp`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `complexity?: "low" | "medium" | "high"`

                Computation spent planning the image, independently of rendering quality.
                Overrides the outer response's `reasoning.effort` for image generation.
                When omitted, inherits a supported outer reasoning effort or uses the
                image model's configured default.
                For SVG output, controls the reference image, not the SVG author's
                reasoning.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `frame_count?: number`

                Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

                `minimum: 2`, `maximum: 16`

              - `frame_duration_ms?: number`

                Duration of each GIF frame in milliseconds, rounded to 10 ms.
                Requires `output_format` to be `gif`. Default: 200.

                `minimum: 20`, `maximum: 2000`

              - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

                - `"high"`

                - `"low"`

              - `input_image_mask?: InputImageMask`

                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" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                Deprecated values:

                - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

                - `(string & {})`

                - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                  The image generation model to use. One of `gpt-image-1-mini`,
                  `gpt-image-1.5`, `gpt-image-2`,
                  `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                  `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                  `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                  `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                  `gpt-image-2`.

                  `gpt-image-1` was shut down on October 23, 2026. Use
                  `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                  - `"gpt-image-1"`

                  - `"gpt-image-1-mini"`

                  - `"gpt-image-2"`

                  - `"gpt-image-2-2026-04-21"`

                  - `"gpt-image-2.5-sunburst"`

                  - `"gpt-image-2.5-sunburst-2026-09-08"`

                  - `"gpt-image-2.5-flare"`

                  - `"gpt-image-2.5-flare-2026-09-08"`

                  - `"gpt-image-2.6-sunburst"`

                  - `"gpt-image-2.6-flare"`

                  - `"gpt-image-1.5"`

                  - `"chatgpt-image-latest"`

              - `moderation?: "auto" | "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression?: number`

                Compression level for the output image. Default: 100.

                `minimum: 0`, `maximum: 100`

              - `output_format?: "png" | "webp" | "jpeg" | 2 more`

                The output format of the generated image. One of `png`, `webp`, `jpeg`,
                `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
                that supports the selected format. GIF output does not support
                partial image streaming (`partial_images` greater than `0`),
                `input_image_mask`, or custom `output_compression`.
                Responses lifecycle events can still be streamed for GIF output.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

                - `"gif"`

                - `"svg"`

              - `partial_images?: number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

                `minimum: 0`, `maximum: 3`

              - `quality?: "low" | "medium" | "high" | 3 more`

                The quality of the generated image. The GPT image models support `low`,
                `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
                including their `2026-09-08` snapshots, also support `xhigh` and `max`.
                Default: `auto`.

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

                - `"auto"`

              - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

                - `(string & {})`

                - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

              - `svg?: Svg`

                SVG author model settings. Requires `output_format` to be `svg`.
                When SVG model selection is enabled, omitting this object uses the
                outer response model. Otherwise, the default SVG author is used and
                explicit model overrides are unavailable.

                - `model?: string`

                  `minLength: 1`

                - `reasoning?: Reasoning | null`

                  Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                  - `effort?: "none" | "minimal" | "low" | 4 more`

                    Controls how much effort the model should spend on reasoning for this request.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

            - `LocalShell`

              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`.

                - `"local_shell"`

            - `BetaFunctionShellTool`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

                - `BetaContainerAuto`

                  - `type: "container_auto"`

                    Automatically creates a container for this request

                    - `"container_auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                    - `BetaContainerNetworkPolicyAllowlist`

                  - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

                    An optional list of skills referenced by id or inline data.

                    `maxItems: 200`

                    - `BetaSkillReference`

                      - `skill_id: string`

                        The ID of the referenced skill.

                        `minLength: 1`, `maxLength: 64`

                      - `type: "skill_reference"`

                        References a skill created with the /v1/skills endpoint.

                        - `"skill_reference"`

                      - `version?: string`

                        Optional skill version. Use a positive integer or 'latest'. Omit for default.

                    - `BetaInlineSkill`

                      - `description: string`

                        The description of the skill.

                      - `name: string`

                        The name of the skill.

                      - `source: BetaInlineSkillSource`

                        Inline skill payload

                        - `data: string`

                          Base64-encoded skill zip bundle.

                          `minLength: 1`, `maxLength: 70254592`

                        - `media_type: "application/zip"`

                          The media type of the inline skill payload. Must be `application/zip`.

                          - `"application/zip"`

                        - `type: "base64"`

                          The type of the inline skill source. Must be `base64`.

                          - `"base64"`

                      - `type: "inline"`

                        Defines an inline skill for this request.

                        - `"inline"`

                - `BetaLocalEnvironment`

                  - `type: "local"`

                    Use a local computer environment.

                    - `"local"`

                  - `skills?: Array<BetaLocalSkill>`

                    An optional list of skills.

                    `maxItems: 200`

                    - `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: string`

                    The ID of the referenced container.

                  - `type: "container_reference"`

                    References a container created with the /v1/containers endpoint

                    - `"container_reference"`

            - `BetaCustomTool`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

                - `"custom"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `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 | Grammar`

                The input format for the custom tool. Default is unconstrained text.

                - `Text`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar`

                  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`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `BetaToolSearchOutputNamespaceTool`

              Groups function/custom tools under a shared namespace.

              - `description: string`

                A description of the namespace shown to the model.

              - `name: string`

                The namespace name used in tool calls (for example, `crm`).

                `minLength: 1`

              - `tools: Array<Function | BetaCustomTool>`

                The function/custom tools loaded inside this namespace.

                `minItems: 1`

                - `Function`

                  - `name: string`

                    The name of the loaded function tool.

                    `minLength: 1`, `maxLength: 128`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                    The tool invocation context(s).

                    `minItems: 1`

                    - `"direct"`

                    - `"programmatic"`

                  - `async?: boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `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`

                  A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

              - `type: "namespace"`

                The type of the tool. Always `namespace`.

                - `"namespace"`

            - `BetaToolSearchTool`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"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.

                - `"server"`

                - `"client"`

              - `parameters?: unknown`

                Parameter schema for a client-executed tool search tool.

            - `BetaWebSearchPreviewTool`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `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`.

                - `"web_search_preview"`

                - `"web_search_preview_2025_03_11"`

              - `search_content_types?: Array<"text" | "image">`

                - `"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.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `user_location?: UserLocation | null`

                The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

                - `type: "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `BetaApplyPatchTool`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

          - `type: "tool_search_output"`

            The item type. Always `tool_search_output`.

            - `"tool_search_output"`

          - `id?: string | null`

            The unique ID of this tool search output.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the tool search call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `execution?: "server" | "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the tool search output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AdditionalTools`

          - `role: "developer"`

            The role that provided the additional tools. Only `developer` is supported.

            - `"developer"`

          - `tools: Array<BetaTool>`

            A list of additional tools made available at this item.

            - `BetaFunctionTool`

              Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

            - `BetaFileSearchTool`

              A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

            - `BetaComputerTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `BetaComputerUsePreviewTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `BetaWebSearchTool`

              Search the Internet for sources related to the prompt. Learn more about the
              [web search tool](/api/docs/guides/tools-web-search).

            - `Mcp`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

                - `"mcp"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools?: Array<string> | McpToolFilter | null`

                List of allowed tool names or a filter object.

                - `Array<string>`

                - `McpToolFilter`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

                This field is deprecated for models released after September 1, 2026.
                Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
                connect through a Secure MCP Tunnel.

                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`

                - `"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" | null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter`

                  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`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                      it will match this filter.

                    - `tool_names?: Array<string>`

                      List of allowed tool names.

                  - `never?: Never`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

                `format: uri`

              - `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`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string | CodeInterpreterToolAuto`

                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.

                - `string`

                - `CodeInterpreterToolAuto`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                    - `BetaContainerNetworkPolicyAllowlist`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action?: "generate" | "edit" | "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background?: "transparent" | "opaque" | "auto"`

                Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
                `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
                Transparent backgrounds are available for supported GPT Image models. For
                `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
                using `transparent`, set the output format to `png` or `webp`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `complexity?: "low" | "medium" | "high"`

                Computation spent planning the image, independently of rendering quality.
                Overrides the outer response's `reasoning.effort` for image generation.
                When omitted, inherits a supported outer reasoning effort or uses the
                image model's configured default.
                For SVG output, controls the reference image, not the SVG author's
                reasoning.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `frame_count?: number`

                Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

                `minimum: 2`, `maximum: 16`

              - `frame_duration_ms?: number`

                Duration of each GIF frame in milliseconds, rounded to 10 ms.
                Requires `output_format` to be `gif`. Default: 200.

                `minimum: 20`, `maximum: 2000`

              - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

                - `"high"`

                - `"low"`

              - `input_image_mask?: InputImageMask`

                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" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                Deprecated values:

                - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

                - `(string & {})`

                - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                  The image generation model to use. One of `gpt-image-1-mini`,
                  `gpt-image-1.5`, `gpt-image-2`,
                  `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                  `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                  `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                  `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                  `gpt-image-2`.

                  `gpt-image-1` was shut down on October 23, 2026. Use
                  `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                  - `"gpt-image-1"`

                  - `"gpt-image-1-mini"`

                  - `"gpt-image-2"`

                  - `"gpt-image-2-2026-04-21"`

                  - `"gpt-image-2.5-sunburst"`

                  - `"gpt-image-2.5-sunburst-2026-09-08"`

                  - `"gpt-image-2.5-flare"`

                  - `"gpt-image-2.5-flare-2026-09-08"`

                  - `"gpt-image-2.6-sunburst"`

                  - `"gpt-image-2.6-flare"`

                  - `"gpt-image-1.5"`

                  - `"chatgpt-image-latest"`

              - `moderation?: "auto" | "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression?: number`

                Compression level for the output image. Default: 100.

                `minimum: 0`, `maximum: 100`

              - `output_format?: "png" | "webp" | "jpeg" | 2 more`

                The output format of the generated image. One of `png`, `webp`, `jpeg`,
                `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
                that supports the selected format. GIF output does not support
                partial image streaming (`partial_images` greater than `0`),
                `input_image_mask`, or custom `output_compression`.
                Responses lifecycle events can still be streamed for GIF output.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

                - `"gif"`

                - `"svg"`

              - `partial_images?: number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

                `minimum: 0`, `maximum: 3`

              - `quality?: "low" | "medium" | "high" | 3 more`

                The quality of the generated image. The GPT image models support `low`,
                `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
                including their `2026-09-08` snapshots, also support `xhigh` and `max`.
                Default: `auto`.

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

                - `"auto"`

              - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

                - `(string & {})`

                - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

              - `svg?: Svg`

                SVG author model settings. Requires `output_format` to be `svg`.
                When SVG model selection is enabled, omitting this object uses the
                outer response model. Otherwise, the default SVG author is used and
                explicit model overrides are unavailable.

                - `model?: string`

                  `minLength: 1`

                - `reasoning?: Reasoning | null`

                  Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                  - `effort?: "none" | "minimal" | "low" | 4 more`

                    Controls how much effort the model should spend on reasoning for this request.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

            - `LocalShell`

              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`.

                - `"local_shell"`

            - `BetaFunctionShellTool`

              A tool that allows the model to execute shell commands.

            - `BetaCustomTool`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `BetaNamespaceTool`

              Groups function/custom tools under a shared namespace.

              - `description: string`

                A description of the namespace shown to the model.

              - `name: string`

                The namespace name used in tool calls (for example, `crm`).

                `minLength: 1`

              - `tools: Array<Function | BetaCustomTool>`

                The function/custom tools available inside this namespace.

                `minItems: 1`

                - `Function`

                  - `name: string`

                    `minLength: 1`, `maxLength: 128`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                    The tool invocation context(s).

                    `minItems: 1`

                    - `"direct"`

                    - `"programmatic"`

                  - `async?: boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `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`

                  A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

              - `type: "namespace"`

                The type of the tool. Always `namespace`.

                - `"namespace"`

            - `BetaToolSearchTool`

              Hosted or BYOT tool search configuration for deferred tools.

            - `BetaWebSearchPreviewTool`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `BetaApplyPatchTool`

              Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "additional_tools"`

            The item type. Always `additional_tools`.

            - `"additional_tools"`

          - `id?: string | null`

            The unique ID of this additional tools item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `BetaResponseConfigurationUpdateItemParam`

          An update to the conversation's response configuration. Supply reasoning,
          text, or both. Each setting stays in effect until a later update replaces it.

          - `type: "configuration_update"`

            The item type. Always `configuration_update`.

            - `"configuration_update"`

          - `id?: string | null`

            The unique ID of the configuration update item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reasoning?: Reasoning`

            Updates to reasoning configuration. Only effort is supported.

            - `effort?: "none" | "minimal" | "low" | 4 more | null`

              The reasoning effort to use for subsequent responses until another
              configuration update replaces it.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

          - `text?: Text`

            The text output configuration for subsequent responses.

            - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

              Use a JSON schema for structured output or text to return to plain text.

              - `Text`

                Default response format. Used to generate text responses.

                - `type: "text"`

                  The type of response format being defined. Always `text`.

                  - `"text"`

              - `BetaResponseFormatTextJSONSchemaConfig`

                JSON Schema response format. Used to generate structured JSON responses.
                Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

                - `name: string`

                  The name of the response format. Must be a-z, A-Z, 0-9, or contain
                  underscores and dashes, with a maximum length of 64.

                - `schema: Record<string, unknown>`

                  The schema for the response format, described as a JSON Schema object.
                  Learn how to build JSON schemas [here](https://json-schema.org/).

                - `type: "json_schema"`

                  The type of response format being defined. Always `json_schema`.

                  - `"json_schema"`

                - `description?: string`

                  A description of what the response format is for, used by the model to
                  determine how to respond in the format.

                - `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](/api/docs/guides/structured-outputs).

        - `BetaResponseReasoningItem`

          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](/api/docs/guides/conversation-state).

          - `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`.

              - `"summary_text"`

          - `type: "reasoning"`

            The type of the object. Always `reasoning`.

            - `"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`.

              - `"reasoning_text"`

          - `encrypted_content?: string | null`

            The encrypted content of the reasoning item. This is populated by default
            for reasoning items returned by `POST /v1/responses` and WebSocket
            `response.create` requests.

            When streaming, use the completed reasoning item and its
            `encrypted_content` from the `response.output_item.done` event in
            subsequent requests. The `encrypted_content` in
            `response.output_item.added` may be incomplete. This is especially
            important when `store` is `false` or when using Zero Data Retention.

          - `status?: "in_progress" | "completed" | "incomplete"`

            The status of the item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseCompactionItemParam`

          A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

          - `encrypted_content: string`

            The encrypted content of the compaction summary.

            `maxLength: 104857600`

          - `type: "compaction"`

            The type of the item. Always `compaction`.

            - `"compaction"`

          - `id?: string | null`

            The ID of the compaction item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ImageGenerationCall`

          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.

            - `"in_progress"`

            - `"completed"`

            - `"generating"`

            - `"failed"`

          - `type: "image_generation_call"`

            The type of the image generation call. Always `image_generation_call`.

            - `"image_generation_call"`

          - `action?: "generate" | "edit" | "auto" | null`

            The action used for image generation.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `background?: "transparent" | "opaque" | "auto" | null`

            The background setting used for generation.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `error?: Error`

            Details of a moderation failure, when available.

            - `code: string | null`

              The error code.

            - `message: string`

              A description of the error.

            - `param: string | null`

              The related request parameter.

            - `type: string`

              The error type.

            - `moderation_details?: ModerationDetails`

              Public details for a `moderation_blocked` error, when available.

              - `categories: Array<string>`

                Public moderation categories. New category values may be added over time.

              - `moderation_stage: "input" | "output" | "unknown"`

                The stage where moderation blocked the image generation call.

                - `"input"`

                - `"output"`

                - `"unknown"`

          - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

            The output format used for generation.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

            - `"gif"`

            - `"svg"`

          - `quality?: "low" | "medium" | "high" | 3 more | null`

            The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

            - `"auto"`

          - `revised_prompt?: string | null`

            The prompt that was used after any model prompt rewriting.

          - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `(string & {})`

            - `"1024x1024" | "1024x1536" | "1536x1024"`

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

          - `svg_usage?: SvgUsage`

            - `input_tokens: number`

            - `model: string`

            - `output_tokens: number`

            - `reasoning_tokens: number`

            - `total_tokens: number`

        - `BetaResponseCodeInterpreterToolCall`

          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 | Image> | null`

            The outputs generated by the code interpreter, such as logs or images.
            Can be null if no outputs are available.

            - `Logs`

              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`.

                - `"logs"`

            - `Image`

              The image output from the code interpreter.

              - `type: "image"`

                The type of the output. Always `image`.

                - `"image"`

              - `url: string`

                The URL of the image output from the code interpreter.

                `format: uri`

          - `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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"interpreting"`

            - `"failed"`

          - `type: "code_interpreter_call"`

            The type of the code interpreter tool call. Always `code_interpreter_call`.

            - `"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`

          A tool call to run a command on the local shell.

          - `id: string`

            The unique ID of the local shell call.

          - `action: Action`

            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`.

              - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "local_shell_call"`

            The type of the local shell call. Always `local_shell_call`.

            - `"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`

          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`.

            - `"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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCall`

          A tool representing a request to execute one or more shell commands.

          - `action: Action`

            The shell commands and limits that describe how to run the tool call.

            - `commands: Array<string>`

              Ordered shell commands for the execution environment to run.

            - `max_output_length?: number | null`

              Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

            - `timeout_ms?: number | null`

              Maximum wall-clock time in milliseconds to allow the shell commands to run.

          - `call_id: string`

            The unique ID of the shell tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `type: "shell_call"`

            The type of the item. Always `shell_call`.

            - `"shell_call"`

          - `id?: string | null`

            The unique ID of the shell tool call. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

            The environment to execute the shell commands in.

            - `BetaLocalEnvironment`

            - `BetaContainerReference`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCallOutput`

          The streamed output items emitted by a shell tool call.

          - `call_id: string`

            The unique ID of the shell tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `output: Array<BetaResponseFunctionShellCallOutputContent>`

            Captured chunks of stdout and stderr output, along with their associated outcomes.

            - `outcome: Timeout | Exit`

              The exit or timeout outcome associated with this shell call.

              - `Timeout`

                Indicates that the shell call exceeded its configured time limit.

                - `type: "timeout"`

                  The outcome type. Always `timeout`.

                  - `"timeout"`

              - `Exit`

                Indicates that the shell commands finished and returned an exit code.

                - `exit_code: number`

                  The exit code returned by the shell process.

                - `type: "exit"`

                  The outcome type. Always `exit`.

                  - `"exit"`

            - `stderr: string`

              Captured stderr output for the shell call.

              `maxLength: 10485760`

            - `stdout: string`

              Captured stdout output for the shell call.

              `maxLength: 10485760`

          - `type: "shell_call_output"`

            The type of the item. Always `shell_call_output`.

            - `"shell_call_output"`

          - `id?: string | null`

            The unique ID of the shell tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `max_output_length?: number | null`

            The maximum number of UTF-8 characters captured for this shell call's combined output.

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the shell call output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ApplyPatchCall`

          A tool call representing a request to create, delete, or update files using diff patches.

          - `call_id: string`

            The unique ID of the apply patch tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `operation: CreateFile | DeleteFile | UpdateFile`

            The specific create, delete, or update instruction for the apply_patch tool call.

            - `CreateFile`

              Instruction for creating a new file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply when creating the file.

                `maxLength: 10485760`

              - `path: string`

                Path of the file to create relative to the workspace root.

                `minLength: 1`

              - `type: "create_file"`

                The operation type. Always `create_file`.

                - `"create_file"`

            - `DeleteFile`

              Instruction for deleting an existing file via the apply_patch tool.

              - `path: string`

                Path of the file to delete relative to the workspace root.

                `minLength: 1`

              - `type: "delete_file"`

                The operation type. Always `delete_file`.

                - `"delete_file"`

            - `UpdateFile`

              Instruction for updating an existing file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply to the existing file.

                `maxLength: 10485760`

              - `path: string`

                Path of the file to update relative to the workspace root.

                `minLength: 1`

              - `type: "update_file"`

                The operation type. Always `update_file`.

                - `"update_file"`

          - `status: "in_progress" | "completed"`

            The status of the apply patch tool call. One of `in_progress` or `completed`.

            - `"in_progress"`

            - `"completed"`

          - `type: "apply_patch_call"`

            The type of the item. Always `apply_patch_call`.

            - `"apply_patch_call"`

          - `id?: string | null`

            The unique ID of the apply patch tool call. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `ApplyPatchCallOutput`

          The streamed output emitted by an apply patch tool call.

          - `call_id: string`

            The unique ID of the apply patch tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `status: "completed" | "failed"`

            The status of the apply patch tool call output. One of `completed` or `failed`.

            - `"completed"`

            - `"failed"`

          - `type: "apply_patch_call_output"`

            The type of the item. Always `apply_patch_call_output`.

            - `"apply_patch_call_output"`

          - `id?: string | null`

            The unique ID of the apply patch tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `output?: string | null`

            Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

            `maxLength: 10485760`

        - `McpListTools`

          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`.

            - `"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`

          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`.

            - `"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`

          A response to an MCP approval request.

          - `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`.

            - `"mcp_approval_response"`

          - `id?: string | null`

            The unique ID of the 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.

        - `McpCall`

          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`.

            - `"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?: BetaMcpToolCallError | null`

            The error from the tool call, if any.

            - `McpProtocolError`

              - `code: number`

              - `message: string`

              - `type: "mcp_protocol_error"`

                - `"mcp_protocol_error"`

            - `McpToolExecutionError`

              - `content: unknown`

              - `type: "mcp_tool_execution_error"`

                - `"mcp_tool_execution_error"`

            - `HTTPError`

              - `code: number`

              - `message: string`

              - `type: "http_error"`

                - `"http_error"`

          - `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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"calling"`

            - `"failed"`

        - `BetaResponseCustomToolCallOutput`

          The output of a custom tool call from your code, being sent back to the model.

          - `call_id: string`

            The call ID, used to map this custom tool call output to a custom tool call.

          - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            The output from the custom tool call generated by your code.
            Can be a string or an list of output content.

            - `string`

            - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

              - `BetaResponseInputText`

                A text input to the model.

              - `BetaResponseInputImage`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile`

                A file input to the model.

          - `type: "custom_tool_call_output"`

            The type of the custom tool call output. Always `custom_tool_call_output`.

            - `"custom_tool_call_output"`

          - `id?: string`

            The unique ID of the custom tool call output 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 | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `BetaResponseCustomToolCall`

          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`.

            - `"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.

          - `async?: boolean`

            Whether the custom tool call runs asynchronously.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace?: string`

            The namespace of the custom tool being called.

        - `CompactionTrigger`

          Compacts the current context. Must be the final input item.

          - `type: "compaction_trigger"`

            The type of the item. Always `compaction_trigger`.

            - `"compaction_trigger"`

          - `id?: string | null`

            The unique ID of this compaction trigger.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ItemReference`

          An internal identifier for an item to reference.

          - `id: string`

            The ID of the item to reference.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `type?: "item_reference" | null`

            The type of item to reference. Always `item_reference`.

            - `"item_reference"`

        - `Program`

          - `id: string`

            The unique ID of this program item.

          - `call_id: string`

            The stable call ID of the program item.

            `minLength: 1`, `maxLength: 64`

          - `code: string`

            The JavaScript source executed by programmatic tool calling.

            `maxLength: 10485760`

          - `fingerprint: string`

            Opaque program replay fingerprint that must be round-tripped.

            `maxLength: 10485760`

          - `type: "program"`

            The item type. Always `program`.

            - `"program"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ProgramOutput`

          - `id: string`

            The unique ID of this program output item.

          - `call_id: string`

            The call ID of the program item.

            `minLength: 1`, `maxLength: 64`

          - `result: string`

            The result produced by the program item.

            `maxLength: 10485760`

          - `status: "completed" | "incomplete"`

            The terminal status of the program output.

            - `"completed"`

            - `"incomplete"`

          - `type: "program_output"`

            The item type. Always `program_output`.

            - `"program_output"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

    - `metadata: Record<string, string> | 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: "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more | (string & {})`

      Model ID used to generate the response, like `gpt-6-astra`. OpenAI
      offers a wide range of models with different capabilities, performance
      characteristics, and price points. Refer to the [model guide](/api/docs/models)
      to browse and compare available models.

      Deprecated values:

      - "gpt-5.4-nano", "gpt-5.4-nano-2026-03-17", "gpt-5.1", "gpt-5.1-2025-11-13": Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.3-chat-latest", "gpt-5.2-chat-latest": Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.1-codex", "gpt-5.1-chat-latest", "gpt-5-chat-latest", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", "o3-deep-research", "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5-codex", "gpt-5.1-codex-max": Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.1-mini": Not a supported model ID. Retained for SDK compatibility.
      - "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "o3", "o3-2025-04-16", "o3-pro", "o3-pro-2025-06-10", "gpt-5-pro", "gpt-5-pro-2025-10-06": Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-mini", "gpt-4o-mini-2024-07-18": Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4.1-nano", "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3-mini", "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "gpt-4o-2024-05-13", "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-1106-preview", "gpt-4", "gpt-4-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-0125", "o1-pro", "o1-pro-2025-03-19": Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "o1-preview", "o1-preview-2024-09-12": Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "o1-mini", "o1-mini-2024-09-12": Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-audio-mini", "gpt-audio-mini-2025-12-15": Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-12-17", "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", "gpt-4o-mini-audio-preview-2024-12-17": Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4o-audio-preview-2024-10-01": Announced shutdown date: 2025-10-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "chatgpt-4o-latest": Announced shutdown date: 2026-02-17. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "codex-mini-latest": Announced shutdown date: 2026-02-12. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-0125-preview", "gpt-4-turbo-preview", "gpt-4-0314": Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-vision-preview": Announced shutdown date: 2024-12-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-0613": Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k-0613": Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-3.5-turbo-1106": Announced shutdown date: 2026-09-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.

      - `"gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more`

        Model ID used to generate the response, like `gpt-6-astra`. OpenAI
        offers a wide range of models with different capabilities, performance
        characteristics, and price points. Refer to the [model guide](/api/docs/models)
        to browse and compare available models.

        - `"gpt-6-astra"`

        - `"gpt-6.1-sol"`

        - `"gpt-6.1-terra"`

        - `"gpt-6-sol"`

        - `"gpt-6-luna"`

        - `"gpt-5.6-sol"`

        - `"gpt-5.6-terra"`

        - `"gpt-5.6-luna"`

        - `"gpt-5.5"`

        - `"gpt-5.5-2026-04-23"`

        - `"gpt-5.4"`

        - `"gpt-5.4-mini"`

        - `"gpt-5.4-nano"`

        - `"gpt-5.4-mini-2026-03-17"`

        - `"gpt-5.4-nano-2026-03-17"`

        - `"gpt-5.3-chat-latest"`

        - `"gpt-5.2"`

        - `"gpt-5.2-2025-12-11"`

        - `"gpt-5.2-chat-latest"`

        - `"gpt-5.2-pro"`

        - `"gpt-5.2-pro-2025-12-11"`

        - `"gpt-5.1"`

        - `"gpt-5.1-2025-11-13"`

        - `"gpt-5.1-codex"`

        - `"gpt-5.1-mini"`

        - `"gpt-5.1-chat-latest"`

        - `"gpt-5"`

        - `"gpt-5-mini"`

        - `"gpt-5-nano"`

        - `"gpt-5-2025-08-07"`

        - `"gpt-5-mini-2025-08-07"`

        - `"gpt-5-nano-2025-08-07"`

        - `"gpt-5-chat-latest"`

        - `"gpt-4.1"`

        - `"gpt-4.1-mini"`

        - `"gpt-4.1-nano"`

        - `"gpt-4.1-2025-04-14"`

        - `"gpt-4.1-mini-2025-04-14"`

        - `"gpt-4.1-nano-2025-04-14"`

        - `"o4-mini"`

        - `"o4-mini-2025-04-16"`

        - `"o3"`

        - `"o3-2025-04-16"`

        - `"o3-mini"`

        - `"o3-mini-2025-01-31"`

        - `"o1"`

        - `"o1-2024-12-17"`

        - `"o1-preview"`

        - `"o1-preview-2024-09-12"`

        - `"o1-mini"`

        - `"o1-mini-2024-09-12"`

        - `"gpt-4o"`

        - `"gpt-4o-2024-11-20"`

        - `"gpt-4o-2024-08-06"`

        - `"gpt-4o-2024-05-13"`

        - `"gpt-audio-mini"`

        - `"gpt-audio-mini-2025-12-15"`

        - `"gpt-4o-audio-preview"`

        - `"gpt-4o-audio-preview-2024-10-01"`

        - `"gpt-4o-audio-preview-2024-12-17"`

        - `"gpt-4o-audio-preview-2025-06-03"`

        - `"gpt-4o-mini-audio-preview"`

        - `"gpt-4o-mini-audio-preview-2024-12-17"`

        - `"gpt-4o-search-preview"`

        - `"gpt-4o-mini-search-preview"`

        - `"gpt-4o-search-preview-2025-03-11"`

        - `"gpt-4o-mini-search-preview-2025-03-11"`

        - `"chatgpt-4o-latest"`

        - `"codex-mini-latest"`

        - `"gpt-4o-mini"`

        - `"gpt-4o-mini-2024-07-18"`

        - `"gpt-4-turbo"`

        - `"gpt-4-turbo-2024-04-09"`

        - `"gpt-4-0125-preview"`

        - `"gpt-4-turbo-preview"`

        - `"gpt-4-1106-preview"`

        - `"gpt-4-vision-preview"`

        - `"gpt-4"`

        - `"gpt-4-0314"`

        - `"gpt-4-0613"`

        - `"gpt-4-32k"`

        - `"gpt-4-32k-0314"`

        - `"gpt-4-32k-0613"`

        - `"gpt-3.5-turbo"`

        - `"gpt-3.5-turbo-16k"`

        - `"gpt-3.5-turbo-0301"`

        - `"gpt-3.5-turbo-0613"`

        - `"gpt-3.5-turbo-1106"`

        - `"gpt-3.5-turbo-0125"`

        - `"gpt-3.5-turbo-16k-0613"`

        - `"o1-pro"`

        - `"o1-pro-2025-03-19"`

        - `"o3-pro"`

        - `"o3-pro-2025-06-10"`

        - `"o3-deep-research"`

        - `"o3-deep-research-2025-06-26"`

        - `"o4-mini-deep-research"`

        - `"o4-mini-deep-research-2025-06-26"`

        - `"computer-use-preview"`

        - `"computer-use-preview-2025-03-11"`

        - `"gpt-5.5-pro"`

        - `"gpt-5.5-pro-2026-04-23"`

        - `"gpt-5-codex"`

        - `"gpt-5-pro"`

        - `"gpt-5-pro-2025-10-06"`

        - `"gpt-5.1-codex-max"`

        - `"gpt-daybreak-blue-latest"`

        - `"gpt-daybreak-red-latest"`

        - `"gpt-5.6-cyber"`

        - `"gpt-6-cyber"`

        - `"gpt-rosalind-research"`

        - `"gpt-6-rosalind"`

      - `(string & {})`

    - `object: "response"`

      The object type of this resource - always set to `response`.

      - `"response"`

    - `output: Array<BetaResponseOutputItem>`

      An array of content items generated by the model.

      - The length and order of items in the `output` array is dependent
        on the model's response.
      - Rather than accessing the first item in the `output` array and
        assuming it's an `assistant` message with the content generated by
        the model, you might consider using the `output_text` property where
        supported in SDKs.

      - `BetaResponseOutputMessage`

        An output message from the model.

      - `BetaResponseFileSearchToolCall`

        The results of a file search tool call. See the
        [file search guide](/api/docs/guides/tools-file-search) for more information.

      - `BetaResponseFunctionToolCall`

        A tool call to run a function. See the
        [function calling guide](/api/docs/guides/function-calling) for more information.

      - `BetaResponseFunctionToolCallOutputItem`

        - `id: string`

          The unique ID of the function call tool output.

        - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          The output from the function call generated by your code.
          Can be a string or an list of output content.

          - `string`

          - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            - `BetaResponseInputText`

              A text input to the model.

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile`

              A file input to the model.

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "function_call_output"`

          The type of the function tool call output. Always `function_call_output`.

          - `"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.

        - `call_id?: string`

          The unique ID of the function tool call generated by the model.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by?: string`

          The identifier of the actor that created the item.

        - `name?: string`

          The name of the tool that produced the output.

        - `namespace?: string`

          The namespace of the tool that produced the output.

      - `AgentMessage`

        - `id: string`

          The unique ID of the agent message.

        - `author: string`

          The sending agent identity.

        - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

          Encrypted content sent between agents.

          - `BetaResponseInputText`

            A text input to the model.

          - `BetaResponseOutputText`

            A text output from the model.

          - `Text`

            A text content.

            - `text: string`

            - `type: "text"`

              - `"text"`

          - `SummaryText`

            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`.

              - `"summary_text"`

          - `ReasoningText`

            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`.

              - `"reasoning_text"`

          - `BetaResponseOutputRefusal`

            A refusal from the model.

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `ComputerScreenshot`

            A screenshot of a computer.

            - `detail: BetaImageDetail`

              The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

            - `file_id: string | null`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: string | null`

              The URL of the screenshot image.

              `format: uri`

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFile`

            A file input to the model.

          - `EncryptedContent`

            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`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The type of the item. Always `agent_message`.

          - `"agent_message"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall`

        - `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.

          - `"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`.

          - `"multi_agent_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput`

        - `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.

          - `"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>`

          Text output returned by the multi-agent action.

          - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

            The annotations of the text output.

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

          - `logprobs?: Array<Logprob>`

        - `type: "multi_agent_call_output"`

          The type of the multi-agent result. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseFunctionWebSearch`

        The results of a web search tool call. See the
        [web search guide](/api/docs/guides/tools-web-search) for more information.

      - `BetaResponseComputerToolCall`

        A tool call to a computer use tool. See the
        [computer use guide](/api/docs/guides/tools-computer-use) for more information.

      - `BetaResponseComputerToolCallOutputItem`

        - `id: string`

          The ID of the computer tool call output.

        - `call_id: string`

          The ID of the computer tool call that produced the output.

        - `output: BetaResponseComputerToolCallOutputScreenshot`

          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.

          - `"completed"`

          - `"incomplete"`

          - `"failed"`

          - `"in_progress"`

        - `type: "computer_call_output"`

          The type of the computer tool call output. Always `computer_call_output`.

          - `"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`

        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](/api/docs/guides/conversation-state).

      - `Program`

        - `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`.

          - `"program"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput`

        - `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.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The type of the item. Always `program_output`.

          - `"program_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseToolSearchCall`

        - `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.

          - `"server"`

          - `"client"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the tool search call item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "tool_search_call"`

          The type of the item. Always `tool_search_call`.

          - `"tool_search_call"`

        - `agent?: Agent`

          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: 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.

          - `"server"`

          - `"client"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the tool search output item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `tools: Array<BetaTool>`

          The loaded tool definitions returned by tool search.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

          - `CodeInterpreter`

            A tool that runs Python code to help generate a response to a prompt.

          - `ProgrammaticToolCalling`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

          - `LocalShell`

            A tool that allows the model to execute shell commands in a local environment.

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "tool_search_output"`

          The type of the item. Always `tool_search_output`.

          - `"tool_search_output"`

        - `agent?: Agent`

          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: string`

          The unique ID of the additional tools item.

        - `role: "unknown" | "user" | "assistant" | 5 more`

          The role that provided the additional tools.

          - `"unknown"`

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"critic"`

          - `"discriminator"`

          - `"developer"`

          - `"tool"`

        - `tools: Array<BetaTool>`

          The additional tool definitions made available at this item.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

          - `CodeInterpreter`

            A tool that runs Python code to help generate a response to a prompt.

          - `ProgrammaticToolCalling`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

          - `LocalShell`

            A tool that allows the model to execute shell commands in a local environment.

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "additional_tools"`

          The type of the item. Always `additional_tools`.

          - `"additional_tools"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseCompactionItem`

        A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

        - `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`.

          - `"compaction"`

        - `agent?: Agent`

          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`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"generating"`

          - `"failed"`

        - `type: "image_generation_call"`

          The type of the image generation call. Always `image_generation_call`.

          - `"image_generation_call"`

        - `action?: "generate" | "edit" | "auto" | null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background?: "transparent" | "opaque" | "auto" | null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error?: Error`

          Details of a moderation failure, when available.

          - `code: string | null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string | null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details?: ModerationDetails`

            Public details for a `moderation_blocked` error, when available.

            - `categories: Array<string>`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" | "output" | "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `quality?: "low" | "medium" | "high" | 3 more | null`

          The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `revised_prompt?: string | null`

          The prompt that was used after any model prompt rewriting.

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

        - `svg_usage?: SvgUsage`

          - `input_tokens: number`

          - `model: string`

          - `output_tokens: number`

          - `reasoning_tokens: number`

          - `total_tokens: number`

      - `BetaResponseCodeInterpreterToolCall`

        A tool call to run code.

      - `LocalShellCall`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: Action`

          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`.

            - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "local_shell_call"`

          The type of the local shell call. Always `local_shell_call`.

          - `"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`

        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`.

          - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseFunctionShellToolCall`

        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`

          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 | BetaResponseContainerReference | null`

          Represents the use of a local environment to perform shell actions.

          - `BetaResponseLocalEnvironment`

            Represents the use of a local environment to perform shell actions.

            - `type: "local"`

              The environment type. Always `local`.

              - `"local"`

          - `BetaResponseContainerReference`

            Represents a container created with /v1/containers.

            - `container_id: string`

            - `type: "container_reference"`

              The environment type. Always `container_reference`.

              - `"container_reference"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The ID of the entity that created this tool call.

      - `BetaResponseFunctionShellToolCallOutput`

        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 | Exit`

            Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

            - `Timeout`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit`

              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`.

                - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "shell_call_output"`

          The type of the shell call output. Always `shell_call_output`.

          - `"shell_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The identifier of the actor that created the item.

      - `BetaResponseApplyPatchToolCall`

        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 | DeleteFile | UpdateFile`

          One of the create_file, delete_file, or update_file operations applied via apply_patch.

          - `CreateFile`

            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.

              - `"create_file"`

          - `DeleteFile`

            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.

              - `"delete_file"`

          - `UpdateFile`

            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.

              - `"update_file"`

        - `status: "in_progress" | "completed"`

          The status of the apply patch tool call. One of `in_progress` or `completed`.

          - `"in_progress"`

          - `"completed"`

        - `type: "apply_patch_call"`

          The type of the item. Always `apply_patch_call`.

          - `"apply_patch_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The ID of the entity that created this tool call.

      - `BetaResponseApplyPatchToolCallOutput`

        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`.

          - `"completed"`

          - `"failed"`

        - `type: "apply_patch_call_output"`

          The type of the item. Always `apply_patch_call_output`.

          - `"apply_patch_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"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`

        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`.

          - `"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?: BetaMcpToolCallError | 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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `McpListTools`

        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`.

          - `"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`

        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`.

          - `"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`

        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`.

          - `"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`

        A call to a custom tool created by the model.

      - `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `created_by?: string`

          The identifier of the actor that created the item.

    - `parallel_tool_calls: boolean`

      Whether to allow the model to run tool calls in parallel.

    - `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.
      We generally recommend altering this or `top_p` but not both.

      `minimum: 0`, `maximum: 2`

    - `tool_choice: BetaToolChoiceOptions | BetaToolChoiceAllowed | BetaToolChoiceTypes | 6 more`

      How the model should select which tool (or tools) to use when generating
      a response. See the `tools` parameter to see how to specify which tools
      the model can call.

      - `BetaToolChoiceOptions = "none" | "auto" | "required"`

        Controls which (if any) tool is called by the model.

        `none` means the model will not call any tool and instead generates a message.

        `auto` means the model can pick between generating a message or calling one or
        more tools.

        `required` means the model must call one or more tools.

        - `"none"`

        - `"auto"`

        - `"required"`

      - `BetaToolChoiceAllowed`

        Constrains the tools available to the model to a pre-defined set.

        - `mode: "auto" | "required"`

          Constrains the tools available to the model to a pre-defined set.

          `auto` allows the model to pick from among the allowed tools and generate a
          message.

          `required` requires the model to call one or more of the allowed tools.

          - `"auto"`

          - `"required"`

        - `tools: Array<Record<string, unknown>>`

          A list of tool definitions that the model should be allowed to call.

          For the Responses API, the list of tool definitions might look like:

          ```json
          [
            { "type": "function", "name": "get_weather" },
            { "type": "mcp", "server_label": "deepwiki" },
            { "type": "image_generation" }
          ]
          ```

        - `type: "allowed_tools"`

          Allowed tool configuration type. Always `allowed_tools`.

          - `"allowed_tools"`

      - `BetaToolChoiceTypes`

        Indicates that the model should use a built-in tool to generate a response.
        [Learn more about built-in tools](/api/docs/guides/tools).

        - `type: "file_search" | "web_search_preview" | "computer" | 5 more`

          The type of hosted tool the model should to use. Learn more about
          [built-in tools](/api/docs/guides/tools).

          Allowed values are:

          - `file_search`
          - `web_search_preview`
          - `computer`
          - `computer_use_preview`
          - `computer_use`
          - `code_interpreter`
          - `image_generation`

          - `"file_search"`

          - `"web_search_preview"`

          - `"computer"`

          - `"computer_use_preview"`

          - `"computer_use"`

          - `"web_search_preview_2025_03_11"`

          - `"image_generation"`

          - `"code_interpreter"`

      - `BetaToolChoiceFunction`

        Use this option to force the model to call a specific function.

        - `name: string`

          The name of the function to call.

        - `type: "function"`

          For function calling, the type is always `function`.

          - `"function"`

      - `BetaToolChoiceMcp`

        Use this option to force the model to call a specific tool on a remote MCP server.

        - `server_label: string`

          The label of the MCP server to use.

        - `type: "mcp"`

          For MCP tools, the type is always `mcp`.

          - `"mcp"`

        - `name?: string | null`

          The name of the tool to call on the server.

      - `BetaToolChoiceCustom`

        Use this option to force the model to call a specific custom tool.

        - `name: string`

          The name of the custom tool to call.

        - `type: "custom"`

          For custom tool calling, the type is always `custom`.

          - `"custom"`

      - `BetaSpecificProgrammaticToolCallingParam`

        - `type: "programmatic_tool_calling"`

          The tool to call. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `BetaToolChoiceApplyPatch`

        Forces the model to call the apply_patch tool when executing a tool call.

        - `type: "apply_patch"`

          The tool to call. Always `apply_patch`.

          - `"apply_patch"`

      - `BetaToolChoiceShell`

        Forces the model to call the shell tool when a tool call is required.

        - `type: "shell"`

          The tool to call. Always `shell`.

          - `"shell"`

    - `tools: Array<BetaTool>`

      An array of tools the model may call while generating a response. You
      can specify which tool to use by setting the `tool_choice` parameter.

      We support the following categories of tools:

      - **Built-in tools**: Tools that are provided by OpenAI that extend the
        model's capabilities, like [web search](/api/docs/guides/tools-web-search)
        or [file search](/api/docs/guides/tools-file-search). Learn more about
        [built-in tools](/api/docs/guides/tools).
      - **MCP Tools**: Integrations with third-party systems via custom MCP servers
        or predefined connectors such as Google Drive and SharePoint. Learn more about
        [MCP Tools](/api/docs/guides/tools-connectors-mcp).
      - **Function calls (custom tools)**: Functions that are defined by you,
        enabling the model to call your own code with strongly typed arguments
        and outputs. Learn more about
        [function calling](/api/docs/guides/function-calling). You can also use
        custom tools to call your own code.

      - `BetaFunctionTool`

        Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

      - `BetaFileSearchTool`

        A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

      - `BetaComputerTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaComputerUsePreviewTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaWebSearchTool`

        Search the Internet for sources related to the prompt. Learn more about the
        [web search tool](/api/docs/guides/tools-web-search).

      - `Mcp`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

      - `CodeInterpreter`

        A tool that runs Python code to help generate a response to a prompt.

      - `ProgrammaticToolCalling`

      - `ImageGeneration`

        A tool that generates images using the GPT image models.

      - `LocalShell`

        A tool that allows the model to execute shell commands in a local environment.

      - `BetaFunctionShellTool`

        A tool that allows the model to execute shell commands.

      - `BetaCustomTool`

        A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

      - `BetaNamespaceTool`

        Groups function/custom tools under a shared namespace.

      - `BetaToolSearchTool`

        Hosted or BYOT tool search configuration for deferred tools.

      - `BetaWebSearchPreviewTool`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

      - `BetaApplyPatchTool`

        Allows the assistant to create, delete, or update files using unified diffs.

    - `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.

      `minimum: 0`, `maximum: 1`

    - `background?: boolean | null`

      Whether to run the model response in the background.
      [Learn more](/api/docs/guides/background).

    - `completed_at?: number | null`

      Unix timestamp (in seconds) of when this Response was completed.
      Only present when the status is `completed`.

      `format: unixtime`

    - `conversation?: Conversation | null`

      The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation.

      - `id: string`

        The unique ID of the conversation that this response was associated with.

    - `image?: Image`

      - `context_compression: "enabled" | "disabled"`

        Effective image context optimization policy.

        - `"enabled"`

        - `"disabled"`

    - `max_output_tokens?: number | null`

      An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/api/docs/guides/reasoning).

    - `max_tool_calls?: number | null`

      The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

    - `moderation?: Moderation | null`

      Moderation results for the response input and output, if moderated completions were requested.

      - `input: ModerationResult | Error`

        Moderation for the response input.

        - `ModerationResult`

          A moderation result produced for the response input or output.

          - `categories: Record<string, boolean>`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: Record<string, Array<"text" | "image">>`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: Record<string, number>`

            A dictionary of moderation categories to scores.

          - `flagged: boolean`

            A boolean indicating whether the content was flagged by any category.

          - `model: string`

            The moderation model that produced this result.

          - `type: "moderation_result"`

            The object type, which was always `moderation_result` for successful moderation results.

            - `"moderation_result"`

        - `Error`

          An error produced while attempting moderation for the response input or output.

          - `code: string`

            The error code.

          - `message: string`

            The error message.

          - `type: "error"`

            The object type, which was always `error` for moderation failures.

            - `"error"`

      - `output: ModerationResult | Error`

        Moderation for the response output.

        - `ModerationResult`

          A moderation result produced for the response input or output.

          - `categories: Record<string, boolean>`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: Record<string, Array<"text" | "image">>`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: Record<string, number>`

            A dictionary of moderation categories to scores.

          - `flagged: boolean`

            A boolean indicating whether the content was flagged by any category.

          - `model: string`

            The moderation model that produced this result.

          - `type: "moderation_result"`

            The object type, which was always `moderation_result` for successful moderation results.

            - `"moderation_result"`

        - `Error`

          An error produced while attempting moderation for the response input or output.

          - `code: string`

            The error code.

          - `message: string`

            The error message.

          - `type: "error"`

            The object type, which was always `error` for moderation failures.

            - `"error"`

    - `previous_response_id?: string | null`

      The unique ID of the previous response to the model. Use this to
      create multi-turn conversations. Learn more about
      [conversation state](/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.

    - `prompt?: BetaResponsePrompt | null`

      Reference to a prompt template and its variables.
      [Learn more](/api/docs/guides/text?api-mode=responses#version-prompts-in-code).

      - `id: string`

        The unique identifier of the prompt template to use.

      - `variables?: Record<string, string | BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile> | null`

        Optional map of values to substitute in for variables in your
        prompt. The substitution values can either be strings, or other
        Response input types like images or files.

        - `string`

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile`

          A file input to the model.

      - `version?: string | null`

        Optional version of the prompt template.

    - `prompt_cache_diagnostics?: CacheMiss | CacheHit | ComparisonResponseNotFound | Unavailable`

      Prompt cache diagnostics requested for this response.

      - `CacheMiss`

        - `cache_missed_tokens: number`

          The estimated number of input tokens affected after the first detected divergence.

        - `reason: "model_changed" | "prompt_cache_key_changed" | "tools_changed" | 6 more`

          The reason prompt cache reuse did not occur.

          - `"model_changed"`

          - `"prompt_cache_key_changed"`

          - `"tools_changed"`

          - `"text_format_changed"`

          - `"reasoning_effort_changed"`

          - `"verbosity_changed"`

          - `"context_compacted"`

          - `"input_changed"`

          - `"service_tier_changed"`

        - `type: "cache_miss"`

          - `"cache_miss"`

        - `comparison_reusable_tokens?: number`

          The raw token count of the reusable prefix in the compared response.

      - `CacheHit`

        - `type: "cache_hit"`

          - `"cache_hit"`

      - `ComparisonResponseNotFound`

        - `type: "comparison_response_not_found"`

          - `"comparison_response_not_found"`

      - `Unavailable`

        - `type: "unavailable"`

          - `"unavailable"`

    - `prompt_cache_key?: string | null`

      Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/api/docs/guides/prompt-caching).

    - `prompt_cache_options?: PromptCacheOptions`

      The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

      - `mode: "implicit" | "explicit"`

        Whether implicit prompt-cache breakpoints were enabled.

        - `"implicit"`

        - `"explicit"`

      - `ttl: "30m" | "12h"`

        The minimum lifetime applied to each cache breakpoint.

        - `"30m"`

        - `"12h"`

      - `comparison_response_id?: string | null`

        The response ID supplied as the prompt cache diagnostics comparison.

    - `prompt_cache_retention?: "in_memory" | "24h" | null`

      Deprecated. Use `prompt_cache_options.ttl` instead.

      The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/api/docs/guides/prompt-caching#prompt-cache-retention).
      This field expresses a maximum retention policy, while
      `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two
      fields are independent and do not interact.
      For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported.

      For older models that support both `in_memory` and `24h`, the default depends on your organization's data retention policy:

      - Organizations without ZDR enabled default to `24h`.
      - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified.

      - `"in_memory"`

      - `"24h"`

    - `reasoning?: Reasoning | null`

      Configuration options for
      [reasoning models](/api/docs/guides/reasoning).

      - `context?: "auto" | "current_turn" | "all_turns" | null`

        Controls which reasoning items are rendered back to the model on later turns.
        If omitted or set to `auto`, the model determines the context mode. The
        `gpt-5.6` model family defaults to `all_turns`; earlier models default to
        `current_turn`.

        When returned on a response, this is the effective reasoning context mode
        used for the response.

        - `"auto"`

        - `"current_turn"`

        - `"all_turns"`

      - `effort?: "none" | "minimal" | "low" | 4 more | null`

        Constrains effort on reasoning for reasoning models. Currently supported
        values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
        Reducing reasoning effort can result in faster responses and fewer tokens
        used on reasoning in a response. Not all reasoning models support every
        value. See the
        [reasoning guide](/api/docs/guides/reasoning)
        for model-specific support.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `generate_summary?: "auto" | "concise" | "detailed" | null`

        **Deprecated:** use `summary` instead.

        A summary of the reasoning performed by the model. This can be
        useful for debugging and understanding the model's reasoning process.
        One of `auto`, `concise`, or `detailed`.

        - `"auto"`

        - `"concise"`

        - `"detailed"`

      - `mode?: (string & {}) | "standard" | "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `(string & {})`

        - `"standard" | "pro"`

          - `"standard"`

          - `"pro"`

      - `summary?: "auto" | "concise" | "detailed" | null`

        A summary of the reasoning performed by the model. This can be
        useful for debugging and understanding the model's reasoning process.
        One of `auto`, `concise`, or `detailed`.

        `concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.

        - `"auto"`

        - `"concise"`

        - `"detailed"`

    - `safety_identifier?: string | null`

      A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.
      The IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

      `maxLength: 128`

    - `service_tier?: BetaServiceTier | null`

      Specifies the processing type used for serving the request.

      - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
      - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
      - If set to '[flex](/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.
      - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.
      - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for `gpt-5.6-sol`; a response served through it will show `service_tier=ultrafast`.
      - When not set, the default behavior is 'auto'.

      When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

      - `"auto"`

      - `"default"`

      - `"flex"`

      - `"scale"`

      - `"priority"`

      - `"fast"`

      - `"ultrafast"`

    - `status?: BetaResponseStatus`

      The status of the response generation. One of `completed`, `failed`,
      `in_progress`, `cancelled`, `queued`, or `incomplete`.

      - `"completed"`

      - `"failed"`

      - `"in_progress"`

      - `"cancelled"`

      - `"queued"`

      - `"incomplete"`

    - `text?: BetaResponseTextConfig`

      Configuration options for a text response from the model. Can be plain
      text or structured JSON data. Learn more:

      - [Text inputs and outputs](/api/docs/guides/text)
      - [Structured Outputs](/api/docs/guides/structured-outputs)

      - `format?: BetaResponseFormatTextConfig`

        An object specifying the format that the model must output.

        Configuring `{ "type": "json_schema" }` enables Structured Outputs,
        which ensures the model will match your supplied JSON schema. Learn more in the
        [Structured Outputs guide](/api/docs/guides/structured-outputs).

        The default format is `{ "type": "text" }` with no additional options.

        **Not recommended for gpt-4o and newer models:**

        Setting to `{ "type": "json_object" }` enables the older JSON mode, which
        ensures the message the model generates is valid JSON. Using `json_schema`
        is preferred for models that support it.

        - `Text`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig`

          JSON Schema response format. Used to generate structured JSON responses.
          Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

        - `JSONObject`

          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`.

            - `"json_object"`

      - `verbosity?: "low" | "medium" | "high" | null`

        Constrains the verbosity of the model's response. Lower values will result in
        more concise responses, while higher values will result in more verbose responses.
        Currently supported values are `low`, `medium`, and `high`. The default is
        `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tool_usage?: ToolUsage`

      Usage reported by hosted tools, separate from base model `usage`. The field
      can be omitted when tool usage is unavailable. When present, tool families
      with no recorded usage have zero counts.

      `image_gen` sums available token counts across image generation calls.
      Calls with missing or incomplete usage records may be skipped. Output
      token details and cached input counts can be omitted. An omitted cache
      count means cache usage is unknown.

      `web_search.num_requests` counts billable searches. Discounted searches
      and actions such as opening a page are excluded. Use billing records to
      reconcile final charges.

      - `image_gen: ImageGen`

        Aggregated usage statistics for image generation tool calls.

        - `input_tokens: number`

          The number of tokens (images and text) in the input prompt.

        - `input_tokens_details: InputTokensDetails`

          The input tokens detailed information for the image generation.

          - `image_tokens: number`

            The number of image tokens in the input prompt.

          - `text_tokens: number`

            The number of text tokens in the input prompt.

        - `output_tokens: number`

          The number of output tokens generated by the model.

        - `total_tokens: number`

          The total number of tokens (images and text) used for the image generation.

        - `cached_tokens?: number`

        - `cached_tokens_details?: CachedTokensDetails`

          - `cached_image_tokens: number`

          - `cached_text_tokens: number`

        - `output_tokens_details?: OutputTokensDetails`

          The output token details for the image generation.

          - `image_tokens: number`

            The number of image output tokens generated by the model.

          - `text_tokens: number`

            The number of text output tokens generated by the model.

      - `web_search: WebSearch`

        Aggregated billable usage statistics for web search tool calls.

        - `num_requests: number`

          The number of billable web search requests issued.

    - `top_logprobs?: number | null`

      An integer between 0 and 20 specifying the maximum number of most likely
      tokens to return at each token position, each with an associated log
      probability. In some cases, the number of returned tokens may be fewer than
      requested.

      `minimum: 0`, `maximum: 20`

    - `truncation?: "auto" | "disabled" | null`

      The truncation strategy to use for the model response.

      - `auto`: If the input to this Response exceeds
        the model's context window size, the model will truncate the
        response to fit the context window by dropping items from the beginning of the conversation.
        On some models, trimming can begin earlier because the API subtracts the model's
        maximum output allowance from its input limit, even if you set a lower `max_output_tokens`.
      - `disabled` (default): If the input size will exceed the context window
        size for a model, the request will fail with a 400 error.

      - `"auto"`

      - `"disabled"`

    - `usage?: BetaResponseUsage`

      Represents token usage details including input tokens, output tokens,
      a breakdown of output tokens, and the total tokens used.

      - `input_tokens: number`

        The number of input tokens.

      - `input_tokens_details: InputTokensDetails`

        A detailed breakdown of the input tokens.

        - `cache_write_tokens: number`

          The number of input tokens that were written to the cache.

        - `cached_tokens: number`

          The number of tokens that were retrieved from the cache.
          [More on prompt caching](/api/docs/guides/prompt-caching).

        - `cache_write_tokens_details?: CacheWriteTokensDetails`

          - `ttl_12h_tokens: number`

            The number of input tokens written with 12-hour retention.

          - `ttl_30m_tokens: number`

            The number of input tokens written with 30-minute retention.

      - `output_tokens: number`

        The number of output tokens.

      - `output_tokens_details: OutputTokensDetails`

        A detailed breakdown of the output tokens.

        - `reasoning_tokens: number`

          The number of reasoning tokens.

      - `total_tokens: number`

        The total number of tokens used.

    - `user?: string`

      This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.
      A stable identifier for your end-users.
      Used to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.in_progress"`

    The type of the event. Always `response.in_progress`.

    - `"response.in_progress"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Includable

- `BetaResponseIncludable = "file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | 5 more`

  Specify additional output data to include in the model response. Currently supported values are:

  - `web_search_call.results`: Include the search results of the web search tool call.
  - `web_search_call.action.sources`: Include the sources of the web search tool call.
  - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items.
  - `computer_call_output.output.image_url`: Include image urls from the computer call output.
  - `file_search_call.results`: Include the search results of the file search tool call.
  - `message.input_image.image_url`: Include image urls from the input message.
  - `message.output_text.logprobs`: Include logprobs with assistant messages.
  - `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program).

  - `"file_search_call.results"`

  - `"web_search_call.results"`

  - `"web_search_call.action.sources"`

  - `"message.input_image.image_url"`

  - `"computer_call_output.output.image_url"`

  - `"code_interpreter_call.outputs"`

  - `"reasoning.encrypted_content"`

  - `"message.output_text.logprobs"`

### Beta Response Incomplete Event

- `BetaResponseIncompleteEvent`

  An event that is emitted when a response finishes as incomplete.

  Over WebSocket, steering can finish a response with
  `response.incomplete_details.reason` set to `steered`, followed automatically
  by a successor `response.created` that commits the queued steering input.

  - `response: BetaResponse`

    The response that was incomplete.

    - `id: string`

      Unique identifier for this Response.

    - `access_programs: AccessPrograms | null`

      - `cyber: "standard" | "daybreak_blue" | "daybreak_red"`

        The effective Cyber access program used for this response.

        - `"standard"`

        - `"daybreak_blue"`

        - `"daybreak_red"`

    - `created_at: number`

      Unix timestamp (in seconds) of when this Response was created.

      `format: unixtime`

    - `error: BetaResponseError | null`

      An error object returned when the model fails to generate a Response.

      - `code: "server_error" | "rate_limit_exceeded" | "invalid_prompt" | 18 more`

        The error code for the response.

        - `"server_error"`

        - `"rate_limit_exceeded"`

        - `"invalid_prompt"`

        - `"data_residency_mismatch"`

        - `"bio_policy"`

        - `"misalignment_policy_violation"`

        - `"vector_store_timeout"`

        - `"invalid_image"`

        - `"invalid_image_format"`

        - `"invalid_base64_image"`

        - `"invalid_image_url"`

        - `"image_too_large"`

        - `"image_too_small"`

        - `"image_parse_error"`

        - `"image_content_policy_violation"`

        - `"invalid_image_mode"`

        - `"image_file_too_large"`

        - `"unsupported_image_media_type"`

        - `"empty_image_file"`

        - `"failed_to_download_image"`

        - `"image_file_not_found"`

      - `message: string`

        A human-readable description of the error.

      - `misalignment?: Misalignment`

        - `detailed_explanation?: string`

          The public explanation for this block.

        - `error_type?: (string & {}) | "potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

          An optional classification; clients must accept additional values.

          - `(string & {})`

          - `"potentially_unintended_data_transfer" | "potentially_unintended_data_access" | "potentially_unintended_destructive_activity" | "other"`

            - `"potentially_unintended_data_transfer"`

            - `"potentially_unintended_data_access"`

            - `"potentially_unintended_destructive_activity"`

            - `"other"`

        - `review_target?: string | null`

          An opaque target for explicitly continuing this review, or null when unavailable.

          `minLength: 1`, `maxLength: 96`

        - `steer?: Steer`

          An optional public continuation instruction.

          - `message: string`

            The public continuation instruction.

      - `param?: string | null`

        The request parameter associated with the error, or null if none was recorded.

      - `type?: string | null`

        The original error type, or null if it was not recorded.

    - `incomplete_details: IncompleteDetails | null`

      Details about why the response is incomplete.

      - `reason?: "max_output_tokens" | "max_messages" | "content_filter" | "steered"`

        The reason why the response is incomplete. `steered` means
        the response stopped at a safe output boundary after a
        WebSocket `response.steer` event. The server can then create
        a successor response automatically with the queued input.

        - `"max_output_tokens"`

        - `"max_messages"`

        - `"content_filter"`

        - `"steered"`

    - `instructions: string | Array<BetaResponseInputItem> | null`

      A system (or developer) message inserted into the model's context.

      When using along with `previous_response_id`, the instructions from a previous
      response will not be carried over to the next response. This makes it simple
      to swap out system (or developer) messages in new responses.

      - `string`

      - `Array<BetaResponseInputItem>`

        - `BetaEasyInputMessage`

          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.

            - `string`

            - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

              A list of one or many input items to the model, containing different content
              types.

              - `BetaResponseInputText`

                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`.

                  - `"input_text"`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImage`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

                - `detail: BetaImageDetail`

                  The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                  - `"low"`

                  - `"high"`

                  - `"auto"`

                  - `"original"`

                - `type: "input_image"`

                  The type of the input item. Always `input_image`.

                  - `"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.

                  `format: uri`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFile`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"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`.

                  - `"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.

                  `format: uri`

                - `filename?: string`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

          - `role: "user" | "assistant" | "system" | "developer"`

            The role of the message input. One of `user`, `assistant`, `system`, or
            `developer`.

            - `"user"`

            - `"assistant"`

            - `"system"`

            - `"developer"`

          - `phase?: "commentary" | "final_answer" | 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.

            - `"commentary"`

            - `"final_answer"`

          - `type?: "message"`

            The type of the message input. Always `message`.

            - `"message"`

        - `Message`

          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.

          - `content: BetaResponseInputMessageContentList`

            A list of one or many input items to the model, containing different content
            types.

          - `role: "user" | "system" | "developer"`

            The role of the message input. One of `user`, `system`, or `developer`.

            - `"user"`

            - `"system"`

            - `"developer"`

          - `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"`

            The status of item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type?: "message"`

            The type of the message input. Always set to `message`.

            - `"message"`

        - `BetaResponseOutputMessage`

          An output message from the model.

          - `id: string`

            The unique ID of the output message.

          - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

            The content of the output message.

            - `BetaResponseOutputText`

              A text output from the model.

              - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

                The annotations of the text output.

                - `FileCitation`

                  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 in the output text at which to insert the file citation.

                  - `type: "file_citation"`

                    The type of the file citation. Always `file_citation`.

                    - `"file_citation"`

                - `URLCitation`

                  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_citation"`

                  - `url: string`

                    The URL of the web resource.

                    `format: uri`

                - `ContainerFileCitation`

                  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`.

                    - `"container_file_citation"`

                - `FilePath`

                  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`.

                    - `"file_path"`

              - `text: string`

                The text output from the model.

              - `type: "output_text"`

                The type of the output text. Always `output_text`.

                - `"output_text"`

              - `logprobs?: Array<Logprob>`

                - `token: string`

                - `bytes: Array<number>`

                - `logprob: number`

                - `top_logprobs: Array<TopLogprob>`

                  - `token: string`

                  - `bytes: Array<number>`

                  - `logprob: number`

            - `BetaResponseOutputRefusal`

              A refusal from the model.

              - `refusal: string`

                The refusal explanation from the model.

              - `type: "refusal"`

                The type of the refusal. Always `refusal`.

                - `"refusal"`

          - `role: "assistant"`

            The role of the output message. Always `assistant`.

            - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "message"`

            The type of the output message. Always `message`.

            - `"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" | "final_answer" | 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.

            - `"commentary"`

            - `"final_answer"`

        - `BetaResponseFileSearchToolCall`

          The results of a file search tool call. See the
          [file search guide](/api/docs/guides/tools-file-search) 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`,

            - `"in_progress"`

            - `"searching"`

            - `"completed"`

            - `"incomplete"`

            - `"failed"`

          - `type: "file_search_call"`

            The type of the file search tool call. Always `file_search_call`.

            - `"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.

              - `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.

              `format: float`

            - `text?: string`

              The text that was retrieved from the file.

        - `BetaResponseComputerToolCall`

          A tool call to a computer use tool. See the
          [computer use guide](/api/docs/guides/tools-computer-use) 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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "computer_call"`

            The type of the computer call. Always `computer_call`.

            - `"computer_call"`

          - `action?: BetaComputerAction`

            A click action.

            - `Click`

              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`.

                - `"left"`

                - `"right"`

                - `"wheel"`

                - `"back"`

                - `"forward"`

              - `type: "click"`

                Specifies the event type. For a click action, this property is always `click`.

                - `"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`

              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`.

                - `"double_click"`

              - `x: number`

                The x-coordinate where the double click occurred.

              - `y: number`

                The y-coordinate where the double click occurred.

            - `Drag`

              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`.

                - `"drag"`

              - `keys?: Array<string> | null`

                The keys being held while dragging the mouse.

            - `Keypress`

              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`.

                - `"keypress"`

            - `Move`

              A mouse move action.

              - `type: "move"`

                Specifies the event type. For a move action, this property is always set to `move`.

                - `"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`

              A screenshot action.

              - `type: "screenshot"`

                Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

                - `"screenshot"`

            - `Scroll`

              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`.

                - `"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`

              An action to type in text.

              - `text: string`

                The text to type.

              - `type: "type"`

                Specifies the event type. For a type action, this property is always set to `type`.

                - `"type"`

            - `Wait`

              A wait action.

              - `type: "wait"`

                Specifies the event type. For a wait action, this property is always set to `wait`.

                - `"wait"`

          - `actions?: BetaComputerActionList`

            Flattened batched actions for `computer_use`. Each action includes an
            `type` discriminator and action-specific fields.

            - `Click`

              A click action.

            - `DoubleClick`

              A double click action.

            - `Drag`

              A drag action.

            - `Keypress`

              A collection of keypresses the model would like to perform.

            - `Move`

              A mouse move action.

            - `Screenshot`

              A screenshot action.

            - `Scroll`

              A scroll action.

            - `Type`

              An action to type in text.

            - `Wait`

              A wait action.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCallOutput`

          The output of a computer tool call.

          - `call_id: string`

            The ID of the computer tool call that produced the output.

            `minLength: 1`, `maxLength: 64`

          - `output: BetaResponseComputerToolCallOutputScreenshot`

            A computer screenshot image used with the computer use tool.

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is
              always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `file_id?: string`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url?: string`

              The URL of the screenshot image.

              `format: uri`

          - `type: "computer_call_output"`

            The type of the computer tool call output. Always `computer_call_output`.

            - `"computer_call_output"`

          - `id?: string | null`

            The ID of the computer tool call output.

          - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

            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.

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseFunctionWebSearch`

          The results of a web search tool call. See the
          [web search guide](/api/docs/guides/tools-web-search) for more information.

          - `id: string`

            The unique ID of the web search tool call.

          - `action: Search | OpenPage | FindInPage`

            An object describing the specific action taken in this web search call.
            Includes details on how the model used the web (search, open_page, find_in_page).

            - `Search`

              Action type "search" - Performs a web search query.

              - `type: "search"`

                The action type.

                - `"search"`

              - `queries?: Array<string>`

                The search queries.

              - `query?: string`

                The search query.

              - `sources?: Array<Source>`

                The sources used in the search.

                - `type: "url"`

                  The type of source. Always `url`.

                  - `"url"`

                - `url: string`

                  The URL of the source.

                  `format: uri`

            - `OpenPage`

              Action type "open_page" - Opens a specific URL from search results.

              - `type: "open_page"`

                The action type.

                - `"open_page"`

              - `url?: string | null`

                The URL opened by the model.

                `format: uri`

            - `FindInPage`

              Action type "find_in_page": Searches for a pattern within a loaded page.

              - `pattern: string`

                The pattern or text to search for within the page.

              - `type: "find_in_page"`

                The action type.

                - `"find_in_page"`

              - `url: string`

                The URL of the page searched for the pattern.

                `format: uri`

          - `status: "in_progress" | "searching" | "completed" | 2 more`

            The status of the web search tool call.

            - `"in_progress"`

            - `"searching"`

            - `"completed"`

            - `"failed"`

            - `"incomplete"`

          - `type: "web_search_call"`

            The type of the web search tool call. Always `web_search_call`.

            - `"web_search_call"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `BetaResponseFunctionToolCall`

          A tool call to run a function. See the
          [function calling guide](/api/docs/guides/function-calling) 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`.

            - `"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.

          - `async?: boolean`

            Whether the function tool call runs asynchronously.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `FunctionCallOutput`

          The output of a function tool call.

          - `output: string | BetaResponseFunctionCallOutputItemList`

            Text, image, or file output of the function tool call.

            - `string`

            - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                  `maxLength: 10485760`

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImageContent`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

                - `type: "input_image"`

                  The type of the input item. Always `input_image`.

                  - `"input_image"`

                - `detail?: BetaImageDetail | null`

                  The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

                - `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.

                  `maxLength: 20971520`, `format: uri`

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFileContent`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"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`.

                  - `"auto"`

                  - `"low"`

                  - `"high"`

                - `file_data?: string | null`

                  The base64-encoded data of the file to be sent to the model.

                  `maxLength: 73400320`

                - `file_id?: string | null`

                  The ID of the file to be sent to the model.

                - `file_url?: string | null`

                  The URL of the file to be sent to the model.

                  `format: uri`

                - `filename?: string | null`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

                  Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl?: "30m" | "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

          - `type: "function_call_output"`

            The type of the function tool call output. Always `function_call_output`.

            - `"function_call_output"`

          - `id?: string | null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the function tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name?: string | null`

            The name of the tool that produced the output.

            `minLength: 1`, `maxLength: 128`

          - `namespace?: string | null`

            The namespace of the tool that produced the output.

            `minLength: 1`, `maxLength: 128`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AgentMessage`

          A message routed between agents.

          - `author: string`

            The sending agent identity.

          - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

            Plaintext, image, or encrypted content sent between agents.

            - `BetaResponseInputTextContent`

              A text input to the model.

            - `BetaResponseInputImageContent`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `EncryptedContent`

              Opaque encrypted content that Responses API decrypts inside trusted model execution.

              - `encrypted_content: string`

                Opaque encrypted content.

                `maxLength: 10485760`

              - `type: "encrypted_content"`

                The type of the input item. Always `encrypted_content`.

                - `"encrypted_content"`

          - `recipient: string`

            The destination agent identity.

          - `type: "agent_message"`

            The item type. Always `agent_message`.

            - `"agent_message"`

          - `id?: string | null`

            The unique ID of this agent message item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCall`

          - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

            The multi-agent action that was executed.

            - `"spawn_agent"`

            - `"interrupt_agent"`

            - `"list_agents"`

            - `"send_message"`

            - `"followup_task"`

            - `"wait_agent"`

          - `arguments: string`

            The action arguments as a JSON string.

          - `call_id: string`

            The unique ID linking this call to its output.

            `minLength: 1`, `maxLength: 64`

          - `type: "multi_agent_call"`

            The item type. Always `multi_agent_call`.

            - `"multi_agent_call"`

          - `id?: string | null`

            The unique ID of this multi-agent call.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCallOutput`

          - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

            The multi-agent action that produced this result.

            - `"spawn_agent"`

            - `"interrupt_agent"`

            - `"list_agents"`

            - `"send_message"`

            - `"followup_task"`

            - `"wait_agent"`

          - `call_id: string`

            The unique ID of the multi-agent call.

            `minLength: 1`, `maxLength: 64`

          - `output: Array<Output>`

            Text output returned by the multi-agent action.

            - `text: string`

              The text content.

              `maxLength: 10485760`

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

            - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

              Citations associated with the text content.

              - `FileCitation`

                - `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.

                  `minimum: 0`

                - `type: "file_citation"`

                  The citation type. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation`

                - `end_index: number`

                  The index of the last character of the citation in the message.

                  `minimum: 0`

                - `start_index: number`

                  The index of the first character of the citation in the message.

                  `minimum: 0`

                - `title: string`

                  The title of the cited resource.

                - `type: "url_citation"`

                  The citation type. Always `url_citation`.

                  - `"url_citation"`

                - `url: string`

                  The URL of the cited resource.

                  `format: uri`

              - `ContainerFileCitation`

                - `container_id: string`

                  The ID of the container.

                - `end_index: number`

                  The index of the last character of the citation in the message.

                  `minimum: 0`

                - `file_id: string`

                  The ID of the container file.

                - `filename: string`

                  The filename of the container file cited.

                - `start_index: number`

                  The index of the first character of the citation in the message.

                  `minimum: 0`

                - `type: "container_file_citation"`

                  The citation type. Always `container_file_citation`.

                  - `"container_file_citation"`

          - `type: "multi_agent_call_output"`

            The item type. Always `multi_agent_call_output`.

            - `"multi_agent_call_output"`

          - `id?: string | null`

            The unique ID of this multi-agent call output.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ToolSearchCall`

          - `arguments: unknown`

            The arguments supplied to the tool search call.

          - `type: "tool_search_call"`

            The item type. Always `tool_search_call`.

            - `"tool_search_call"`

          - `id?: string | null`

            The unique ID of this tool search call.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the tool search call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `execution?: "server" | "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the tool search call.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseToolSearchOutputItemParam`

          - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

            The loaded tool definitions returned by the tool search output.

            - `BetaFunctionTool`

              Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

                - `"function"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

              - `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`

              A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

              - `type: "file_search"`

                The type of the file search tool. Always `file_search`.

                - `"file_search"`

              - `vector_store_ids: Array<string>`

                The IDs of the vector stores to search.

              - `filters?: ComparisonFilter | CompoundFilter | null`

                A filter to apply.

                - `ComparisonFilter`

                  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

                    - `"eq"`

                    - `"ne"`

                    - `"gt"`

                    - `"gte"`

                    - `"lt"`

                    - `"lte"`

                    - `"in"`

                    - `"nin"`

                  - `value: string | number | boolean | Array<string | number>`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `Array<string | number>`

                      - `string`

                      - `number`

                - `CompoundFilter`

                  Combine multiple filters using `and` or `or`.

                  - `filters: Array<ComparisonFilter | unknown>`

                    Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

                    - `ComparisonFilter`

                      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

                        - `"eq"`

                        - `"ne"`

                        - `"gt"`

                        - `"gte"`

                        - `"lt"`

                        - `"lte"`

                        - `"in"`

                        - `"nin"`

                      - `value: string | number | boolean | Array<string | number>`

                        The value to compare against the attribute key; supports string, number, or boolean types.

                        - `string`

                        - `number`

                        - `boolean`

                        - `Array<string | number>`

                          - `string`

                          - `number`

                    - `unknown`

                  - `type: "and" | "or"`

                    Type of operation: `and` or `or`.

                    - `"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`

                Ranking options for search.

                - `hybrid_search?: HybridSearch`

                  Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

                  - `embedding_weight: number`

                    The weight of the embedding in the reciprocal ranking fusion.

                  - `text_weight: number`

                    The weight of the text in the reciprocal ranking fusion.

                - `ranker?: "auto" | "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"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`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

              - `type: "computer"`

                The type of the computer tool. Always `computer`.

                - `"computer"`

            - `BetaComputerUsePreviewTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

              - `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.

                - `"windows"`

                - `"mac"`

                - `"linux"`

                - `"ubuntu"`

                - `"browser"`

              - `type: "computer_use_preview"`

                The type of the computer use tool. Always `computer_use_preview`.

                - `"computer_use_preview"`

            - `BetaWebSearchTool`

              Search the Internet for sources related to the prompt. Learn more about the
              [web search tool](/api/docs/guides/tools-web-search).

              - `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`.

                - `"web_search"`

                - `"web_search_2025_08_26"`

              - `external_web_access?: boolean`

                Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

              - `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.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `user_location?: UserLocation | null`

                The approximate location of the user. If omitted or null, defaults to the
                United States. To avoid this fallback, pass `{"type": "approximate"}` without
                location fields. To localize results, provide the relevant location fields.

                - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type?: "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

                - `"mcp"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools?: Array<string> | McpToolFilter | null`

                List of allowed tool names or a filter object.

                - `Array<string>`

                - `McpToolFilter`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

                This field is deprecated for models released after September 1, 2026.
                Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
                connect through a Secure MCP Tunnel.

                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`

                - `"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" | null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter`

                  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`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                      it will match this filter.

                    - `tool_names?: Array<string>`

                      List of allowed tool names.

                  - `never?: Never`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

                `format: uri`

              - `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`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string | CodeInterpreterToolAuto`

                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.

                - `string`

                - `CodeInterpreterToolAuto`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                      - `type: "disabled"`

                        Disable outbound network access. Always `disabled`.

                        - `"disabled"`

                    - `BetaContainerNetworkPolicyAllowlist`

                      - `allowed_domains: Array<string>`

                        A list of allowed domains when type is `allowlist`.

                        `minItems: 1`

                      - `type: "allowlist"`

                        Allow outbound network access only to specified domains. Always `allowlist`.

                        - `"allowlist"`

                      - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                        Optional domain-scoped secrets for allowlisted domains.

                        `minItems: 1`

                        - `domain: string`

                          The domain associated with the secret.

                          `minLength: 1`

                        - `name: string`

                          The name of the secret to inject for the domain.

                          `minLength: 1`

                        - `value: string`

                          The secret value to inject for the domain.

                          `minLength: 1`, `maxLength: 10485760`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action?: "generate" | "edit" | "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background?: "transparent" | "opaque" | "auto"`

                Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
                `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
                Transparent backgrounds are available for supported GPT Image models. For
                `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
                using `transparent`, set the output format to `png` or `webp`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `complexity?: "low" | "medium" | "high"`

                Computation spent planning the image, independently of rendering quality.
                Overrides the outer response's `reasoning.effort` for image generation.
                When omitted, inherits a supported outer reasoning effort or uses the
                image model's configured default.
                For SVG output, controls the reference image, not the SVG author's
                reasoning.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `frame_count?: number`

                Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

                `minimum: 2`, `maximum: 16`

              - `frame_duration_ms?: number`

                Duration of each GIF frame in milliseconds, rounded to 10 ms.
                Requires `output_format` to be `gif`. Default: 200.

                `minimum: 20`, `maximum: 2000`

              - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

                - `"high"`

                - `"low"`

              - `input_image_mask?: InputImageMask`

                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" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                Deprecated values:

                - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

                - `(string & {})`

                - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                  The image generation model to use. One of `gpt-image-1-mini`,
                  `gpt-image-1.5`, `gpt-image-2`,
                  `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                  `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                  `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                  `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                  `gpt-image-2`.

                  `gpt-image-1` was shut down on October 23, 2026. Use
                  `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                  - `"gpt-image-1"`

                  - `"gpt-image-1-mini"`

                  - `"gpt-image-2"`

                  - `"gpt-image-2-2026-04-21"`

                  - `"gpt-image-2.5-sunburst"`

                  - `"gpt-image-2.5-sunburst-2026-09-08"`

                  - `"gpt-image-2.5-flare"`

                  - `"gpt-image-2.5-flare-2026-09-08"`

                  - `"gpt-image-2.6-sunburst"`

                  - `"gpt-image-2.6-flare"`

                  - `"gpt-image-1.5"`

                  - `"chatgpt-image-latest"`

              - `moderation?: "auto" | "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression?: number`

                Compression level for the output image. Default: 100.

                `minimum: 0`, `maximum: 100`

              - `output_format?: "png" | "webp" | "jpeg" | 2 more`

                The output format of the generated image. One of `png`, `webp`, `jpeg`,
                `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
                that supports the selected format. GIF output does not support
                partial image streaming (`partial_images` greater than `0`),
                `input_image_mask`, or custom `output_compression`.
                Responses lifecycle events can still be streamed for GIF output.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

                - `"gif"`

                - `"svg"`

              - `partial_images?: number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

                `minimum: 0`, `maximum: 3`

              - `quality?: "low" | "medium" | "high" | 3 more`

                The quality of the generated image. The GPT image models support `low`,
                `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
                including their `2026-09-08` snapshots, also support `xhigh` and `max`.
                Default: `auto`.

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

                - `"auto"`

              - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

                - `(string & {})`

                - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

              - `svg?: Svg`

                SVG author model settings. Requires `output_format` to be `svg`.
                When SVG model selection is enabled, omitting this object uses the
                outer response model. Otherwise, the default SVG author is used and
                explicit model overrides are unavailable.

                - `model?: string`

                  `minLength: 1`

                - `reasoning?: Reasoning | null`

                  Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                  - `effort?: "none" | "minimal" | "low" | 4 more`

                    Controls how much effort the model should spend on reasoning for this request.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

            - `LocalShell`

              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`.

                - `"local_shell"`

            - `BetaFunctionShellTool`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

                - `BetaContainerAuto`

                  - `type: "container_auto"`

                    Automatically creates a container for this request

                    - `"container_auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                    - `BetaContainerNetworkPolicyAllowlist`

                  - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

                    An optional list of skills referenced by id or inline data.

                    `maxItems: 200`

                    - `BetaSkillReference`

                      - `skill_id: string`

                        The ID of the referenced skill.

                        `minLength: 1`, `maxLength: 64`

                      - `type: "skill_reference"`

                        References a skill created with the /v1/skills endpoint.

                        - `"skill_reference"`

                      - `version?: string`

                        Optional skill version. Use a positive integer or 'latest'. Omit for default.

                    - `BetaInlineSkill`

                      - `description: string`

                        The description of the skill.

                      - `name: string`

                        The name of the skill.

                      - `source: BetaInlineSkillSource`

                        Inline skill payload

                        - `data: string`

                          Base64-encoded skill zip bundle.

                          `minLength: 1`, `maxLength: 70254592`

                        - `media_type: "application/zip"`

                          The media type of the inline skill payload. Must be `application/zip`.

                          - `"application/zip"`

                        - `type: "base64"`

                          The type of the inline skill source. Must be `base64`.

                          - `"base64"`

                      - `type: "inline"`

                        Defines an inline skill for this request.

                        - `"inline"`

                - `BetaLocalEnvironment`

                  - `type: "local"`

                    Use a local computer environment.

                    - `"local"`

                  - `skills?: Array<BetaLocalSkill>`

                    An optional list of skills.

                    `maxItems: 200`

                    - `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: string`

                    The ID of the referenced container.

                  - `type: "container_reference"`

                    References a container created with the /v1/containers endpoint

                    - `"container_reference"`

            - `BetaCustomTool`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

                - `"custom"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `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 | Grammar`

                The input format for the custom tool. Default is unconstrained text.

                - `Text`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar`

                  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`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `BetaToolSearchOutputNamespaceTool`

              Groups function/custom tools under a shared namespace.

              - `description: string`

                A description of the namespace shown to the model.

              - `name: string`

                The namespace name used in tool calls (for example, `crm`).

                `minLength: 1`

              - `tools: Array<Function | BetaCustomTool>`

                The function/custom tools loaded inside this namespace.

                `minItems: 1`

                - `Function`

                  - `name: string`

                    The name of the loaded function tool.

                    `minLength: 1`, `maxLength: 128`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                    The tool invocation context(s).

                    `minItems: 1`

                    - `"direct"`

                    - `"programmatic"`

                  - `async?: boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `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`

                  A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

              - `type: "namespace"`

                The type of the tool. Always `namespace`.

                - `"namespace"`

            - `BetaToolSearchTool`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"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.

                - `"server"`

                - `"client"`

              - `parameters?: unknown`

                Parameter schema for a client-executed tool search tool.

            - `BetaWebSearchPreviewTool`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `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`.

                - `"web_search_preview"`

                - `"web_search_preview_2025_03_11"`

              - `search_content_types?: Array<"text" | "image">`

                - `"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.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `user_location?: UserLocation | null`

                The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

                - `type: "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `BetaApplyPatchTool`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

          - `type: "tool_search_output"`

            The item type. Always `tool_search_output`.

            - `"tool_search_output"`

          - `id?: string | null`

            The unique ID of this tool search output.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id?: string | null`

            The unique ID of the tool search call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `execution?: "server" | "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the tool search output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AdditionalTools`

          - `role: "developer"`

            The role that provided the additional tools. Only `developer` is supported.

            - `"developer"`

          - `tools: Array<BetaTool>`

            A list of additional tools made available at this item.

            - `BetaFunctionTool`

              Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

            - `BetaFileSearchTool`

              A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

            - `BetaComputerTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `BetaComputerUsePreviewTool`

              A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

            - `BetaWebSearchTool`

              Search the Internet for sources related to the prompt. Learn more about the
              [web search tool](/api/docs/guides/tools-web-search).

            - `Mcp`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

                - `"mcp"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools?: Array<string> | McpToolFilter | null`

                List of allowed tool names or a filter object.

                - `Array<string>`

                - `McpToolFilter`

                  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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

                This field is deprecated for models released after September 1, 2026.
                Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
                connect through a Secure MCP Tunnel.

                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`

                - `"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" | null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter`

                  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`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                      it will match this filter.

                    - `tool_names?: Array<string>`

                      List of allowed tool names.

                  - `never?: Never`

                    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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

                `format: uri`

              - `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`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string | CodeInterpreterToolAuto`

                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.

                - `string`

                - `CodeInterpreterToolAuto`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids?: Array<string>`

                    An optional list of uploaded files to make available to your code.

                    `maxItems: 50`

                  - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled`

                    - `BetaContainerNetworkPolicyAllowlist`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action?: "generate" | "edit" | "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background?: "transparent" | "opaque" | "auto"`

                Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
                `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
                Transparent backgrounds are available for supported GPT Image models. For
                `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
                using `transparent`, set the output format to `png` or `webp`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `complexity?: "low" | "medium" | "high"`

                Computation spent planning the image, independently of rendering quality.
                Overrides the outer response's `reasoning.effort` for image generation.
                When omitted, inherits a supported outer reasoning effort or uses the
                image model's configured default.
                For SVG output, controls the reference image, not the SVG author's
                reasoning.

                - `"low"`

                - `"medium"`

                - `"high"`

              - `frame_count?: number`

                Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

                `minimum: 2`, `maximum: 16`

              - `frame_duration_ms?: number`

                Duration of each GIF frame in milliseconds, rounded to 10 ms.
                Requires `output_format` to be `gif`. Default: 200.

                `minimum: 20`, `maximum: 2000`

              - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

                - `"high"`

                - `"low"`

              - `input_image_mask?: InputImageMask`

                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" | 9 more`

                The image generation model to use. One of `gpt-image-1-mini`,
                `gpt-image-1.5`, `gpt-image-2`,
                `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                `gpt-image-2`.

                `gpt-image-1` was shut down on October 23, 2026. Use
                `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                Deprecated values:

                - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

                - `(string & {})`

                - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

                  The image generation model to use. One of `gpt-image-1-mini`,
                  `gpt-image-1.5`, `gpt-image-2`,
                  `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
                  `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
                  `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
                  `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
                  `gpt-image-2`.

                  `gpt-image-1` was shut down on October 23, 2026. Use
                  `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

                  - `"gpt-image-1"`

                  - `"gpt-image-1-mini"`

                  - `"gpt-image-2"`

                  - `"gpt-image-2-2026-04-21"`

                  - `"gpt-image-2.5-sunburst"`

                  - `"gpt-image-2.5-sunburst-2026-09-08"`

                  - `"gpt-image-2.5-flare"`

                  - `"gpt-image-2.5-flare-2026-09-08"`

                  - `"gpt-image-2.6-sunburst"`

                  - `"gpt-image-2.6-flare"`

                  - `"gpt-image-1.5"`

                  - `"chatgpt-image-latest"`

              - `moderation?: "auto" | "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression?: number`

                Compression level for the output image. Default: 100.

                `minimum: 0`, `maximum: 100`

              - `output_format?: "png" | "webp" | "jpeg" | 2 more`

                The output format of the generated image. One of `png`, `webp`, `jpeg`,
                `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
                that supports the selected format. GIF output does not support
                partial image streaming (`partial_images` greater than `0`),
                `input_image_mask`, or custom `output_compression`.
                Responses lifecycle events can still be streamed for GIF output.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

                - `"gif"`

                - `"svg"`

              - `partial_images?: number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

                `minimum: 0`, `maximum: 3`

              - `quality?: "low" | "medium" | "high" | 3 more`

                The quality of the generated image. The GPT image models support `low`,
                `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
                including their `2026-09-08` snapshots, also support `xhigh` and `max`.
                Default: `auto`.

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

                - `"auto"`

              - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

                - `(string & {})`

                - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

              - `svg?: Svg`

                SVG author model settings. Requires `output_format` to be `svg`.
                When SVG model selection is enabled, omitting this object uses the
                outer response model. Otherwise, the default SVG author is used and
                explicit model overrides are unavailable.

                - `model?: string`

                  `minLength: 1`

                - `reasoning?: Reasoning | null`

                  Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

                  - `effort?: "none" | "minimal" | "low" | 4 more`

                    Controls how much effort the model should spend on reasoning for this request.

                    - `"none"`

                    - `"minimal"`

                    - `"low"`

                    - `"medium"`

                    - `"high"`

                    - `"xhigh"`

                    - `"max"`

            - `LocalShell`

              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`.

                - `"local_shell"`

            - `BetaFunctionShellTool`

              A tool that allows the model to execute shell commands.

            - `BetaCustomTool`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

            - `BetaNamespaceTool`

              Groups function/custom tools under a shared namespace.

              - `description: string`

                A description of the namespace shown to the model.

              - `name: string`

                The namespace name used in tool calls (for example, `crm`).

                `minLength: 1`

              - `tools: Array<Function | BetaCustomTool>`

                The function/custom tools available inside this namespace.

                `minItems: 1`

                - `Function`

                  - `name: string`

                    `minLength: 1`, `maxLength: 128`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                    The tool invocation context(s).

                    `minItems: 1`

                    - `"direct"`

                    - `"programmatic"`

                  - `async?: boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `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`

                  A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

              - `type: "namespace"`

                The type of the tool. Always `namespace`.

                - `"namespace"`

            - `BetaToolSearchTool`

              Hosted or BYOT tool search configuration for deferred tools.

            - `BetaWebSearchPreviewTool`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `BetaApplyPatchTool`

              Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "additional_tools"`

            The item type. Always `additional_tools`.

            - `"additional_tools"`

          - `id?: string | null`

            The unique ID of this additional tools item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `BetaResponseConfigurationUpdateItemParam`

          An update to the conversation's response configuration. Supply reasoning,
          text, or both. Each setting stays in effect until a later update replaces it.

          - `type: "configuration_update"`

            The item type. Always `configuration_update`.

            - `"configuration_update"`

          - `id?: string | null`

            The unique ID of the configuration update item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reasoning?: Reasoning`

            Updates to reasoning configuration. Only effort is supported.

            - `effort?: "none" | "minimal" | "low" | 4 more | null`

              The reasoning effort to use for subsequent responses until another
              configuration update replaces it.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

          - `text?: Text`

            The text output configuration for subsequent responses.

            - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

              Use a JSON schema for structured output or text to return to plain text.

              - `Text`

                Default response format. Used to generate text responses.

                - `type: "text"`

                  The type of response format being defined. Always `text`.

                  - `"text"`

              - `BetaResponseFormatTextJSONSchemaConfig`

                JSON Schema response format. Used to generate structured JSON responses.
                Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

                - `name: string`

                  The name of the response format. Must be a-z, A-Z, 0-9, or contain
                  underscores and dashes, with a maximum length of 64.

                - `schema: Record<string, unknown>`

                  The schema for the response format, described as a JSON Schema object.
                  Learn how to build JSON schemas [here](https://json-schema.org/).

                - `type: "json_schema"`

                  The type of response format being defined. Always `json_schema`.

                  - `"json_schema"`

                - `description?: string`

                  A description of what the response format is for, used by the model to
                  determine how to respond in the format.

                - `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](/api/docs/guides/structured-outputs).

        - `BetaResponseReasoningItem`

          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](/api/docs/guides/conversation-state).

          - `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`.

              - `"summary_text"`

          - `type: "reasoning"`

            The type of the object. Always `reasoning`.

            - `"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`.

              - `"reasoning_text"`

          - `encrypted_content?: string | null`

            The encrypted content of the reasoning item. This is populated by default
            for reasoning items returned by `POST /v1/responses` and WebSocket
            `response.create` requests.

            When streaming, use the completed reasoning item and its
            `encrypted_content` from the `response.output_item.done` event in
            subsequent requests. The `encrypted_content` in
            `response.output_item.added` may be incomplete. This is especially
            important when `store` is `false` or when using Zero Data Retention.

          - `status?: "in_progress" | "completed" | "incomplete"`

            The status of the item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `BetaResponseCompactionItemParam`

          A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

          - `encrypted_content: string`

            The encrypted content of the compaction summary.

            `maxLength: 104857600`

          - `type: "compaction"`

            The type of the item. Always `compaction`.

            - `"compaction"`

          - `id?: string | null`

            The ID of the compaction item.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ImageGenerationCall`

          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.

            - `"in_progress"`

            - `"completed"`

            - `"generating"`

            - `"failed"`

          - `type: "image_generation_call"`

            The type of the image generation call. Always `image_generation_call`.

            - `"image_generation_call"`

          - `action?: "generate" | "edit" | "auto" | null`

            The action used for image generation.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `background?: "transparent" | "opaque" | "auto" | null`

            The background setting used for generation.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `error?: Error`

            Details of a moderation failure, when available.

            - `code: string | null`

              The error code.

            - `message: string`

              A description of the error.

            - `param: string | null`

              The related request parameter.

            - `type: string`

              The error type.

            - `moderation_details?: ModerationDetails`

              Public details for a `moderation_blocked` error, when available.

              - `categories: Array<string>`

                Public moderation categories. New category values may be added over time.

              - `moderation_stage: "input" | "output" | "unknown"`

                The stage where moderation blocked the image generation call.

                - `"input"`

                - `"output"`

                - `"unknown"`

          - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

            The output format used for generation.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

            - `"gif"`

            - `"svg"`

          - `quality?: "low" | "medium" | "high" | 3 more | null`

            The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

            - `"auto"`

          - `revised_prompt?: string | null`

            The prompt that was used after any model prompt rewriting.

          - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `(string & {})`

            - `"1024x1024" | "1024x1536" | "1536x1024"`

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

          - `svg_usage?: SvgUsage`

            - `input_tokens: number`

            - `model: string`

            - `output_tokens: number`

            - `reasoning_tokens: number`

            - `total_tokens: number`

        - `BetaResponseCodeInterpreterToolCall`

          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 | Image> | null`

            The outputs generated by the code interpreter, such as logs or images.
            Can be null if no outputs are available.

            - `Logs`

              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`.

                - `"logs"`

            - `Image`

              The image output from the code interpreter.

              - `type: "image"`

                The type of the output. Always `image`.

                - `"image"`

              - `url: string`

                The URL of the image output from the code interpreter.

                `format: uri`

          - `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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"interpreting"`

            - `"failed"`

          - `type: "code_interpreter_call"`

            The type of the code interpreter tool call. Always `code_interpreter_call`.

            - `"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`

          A tool call to run a command on the local shell.

          - `id: string`

            The unique ID of the local shell call.

          - `action: Action`

            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`.

              - `"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.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: "local_shell_call"`

            The type of the local shell call. Always `local_shell_call`.

            - `"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`

          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`.

            - `"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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCall`

          A tool representing a request to execute one or more shell commands.

          - `action: Action`

            The shell commands and limits that describe how to run the tool call.

            - `commands: Array<string>`

              Ordered shell commands for the execution environment to run.

            - `max_output_length?: number | null`

              Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

            - `timeout_ms?: number | null`

              Maximum wall-clock time in milliseconds to allow the shell commands to run.

          - `call_id: string`

            The unique ID of the shell tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `type: "shell_call"`

            The type of the item. Always `shell_call`.

            - `"shell_call"`

          - `id?: string | null`

            The unique ID of the shell tool call. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

            The environment to execute the shell commands in.

            - `BetaLocalEnvironment`

            - `BetaContainerReference`

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCallOutput`

          The streamed output items emitted by a shell tool call.

          - `call_id: string`

            The unique ID of the shell tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `output: Array<BetaResponseFunctionShellCallOutputContent>`

            Captured chunks of stdout and stderr output, along with their associated outcomes.

            - `outcome: Timeout | Exit`

              The exit or timeout outcome associated with this shell call.

              - `Timeout`

                Indicates that the shell call exceeded its configured time limit.

                - `type: "timeout"`

                  The outcome type. Always `timeout`.

                  - `"timeout"`

              - `Exit`

                Indicates that the shell commands finished and returned an exit code.

                - `exit_code: number`

                  The exit code returned by the shell process.

                - `type: "exit"`

                  The outcome type. Always `exit`.

                  - `"exit"`

            - `stderr: string`

              Captured stderr output for the shell call.

              `maxLength: 10485760`

            - `stdout: string`

              Captured stdout output for the shell call.

              `maxLength: 10485760`

          - `type: "shell_call_output"`

            The type of the item. Always `shell_call_output`.

            - `"shell_call_output"`

          - `id?: string | null`

            The unique ID of the shell tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `max_output_length?: number | null`

            The maximum number of UTF-8 characters captured for this shell call's combined output.

          - `status?: "in_progress" | "completed" | "incomplete" | null`

            The status of the shell call output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ApplyPatchCall`

          A tool call representing a request to create, delete, or update files using diff patches.

          - `call_id: string`

            The unique ID of the apply patch tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `operation: CreateFile | DeleteFile | UpdateFile`

            The specific create, delete, or update instruction for the apply_patch tool call.

            - `CreateFile`

              Instruction for creating a new file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply when creating the file.

                `maxLength: 10485760`

              - `path: string`

                Path of the file to create relative to the workspace root.

                `minLength: 1`

              - `type: "create_file"`

                The operation type. Always `create_file`.

                - `"create_file"`

            - `DeleteFile`

              Instruction for deleting an existing file via the apply_patch tool.

              - `path: string`

                Path of the file to delete relative to the workspace root.

                `minLength: 1`

              - `type: "delete_file"`

                The operation type. Always `delete_file`.

                - `"delete_file"`

            - `UpdateFile`

              Instruction for updating an existing file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply to the existing file.

                `maxLength: 10485760`

              - `path: string`

                Path of the file to update relative to the workspace root.

                `minLength: 1`

              - `type: "update_file"`

                The operation type. Always `update_file`.

                - `"update_file"`

          - `status: "in_progress" | "completed"`

            The status of the apply patch tool call. One of `in_progress` or `completed`.

            - `"in_progress"`

            - `"completed"`

          - `type: "apply_patch_call"`

            The type of the item. Always `apply_patch_call`.

            - `"apply_patch_call"`

          - `id?: string | null`

            The unique ID of the apply patch tool call. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `ApplyPatchCallOutput`

          The streamed output emitted by an apply patch tool call.

          - `call_id: string`

            The unique ID of the apply patch tool call generated by the model.

            `minLength: 1`, `maxLength: 64`

          - `status: "completed" | "failed"`

            The status of the apply patch tool call output. One of `completed` or `failed`.

            - `"completed"`

            - `"failed"`

          - `type: "apply_patch_call_output"`

            The type of the item. Always `apply_patch_call_output`.

            - `"apply_patch_call_output"`

          - `id?: string | null`

            The unique ID of the apply patch tool call output. Populated when this item is returned via API.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `output?: string | null`

            Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

            `maxLength: 10485760`

        - `McpListTools`

          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`.

            - `"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`

          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`.

            - `"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`

          A response to an MCP approval request.

          - `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`.

            - `"mcp_approval_response"`

          - `id?: string | null`

            The unique ID of the 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.

        - `McpCall`

          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`.

            - `"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?: BetaMcpToolCallError | null`

            The error from the tool call, if any.

            - `McpProtocolError`

              - `code: number`

              - `message: string`

              - `type: "mcp_protocol_error"`

                - `"mcp_protocol_error"`

            - `McpToolExecutionError`

              - `content: unknown`

              - `type: "mcp_tool_execution_error"`

                - `"mcp_tool_execution_error"`

            - `HTTPError`

              - `code: number`

              - `message: string`

              - `type: "http_error"`

                - `"http_error"`

          - `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`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"calling"`

            - `"failed"`

        - `BetaResponseCustomToolCallOutput`

          The output of a custom tool call from your code, being sent back to the model.

          - `call_id: string`

            The call ID, used to map this custom tool call output to a custom tool call.

          - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            The output from the custom tool call generated by your code.
            Can be a string or an list of output content.

            - `string`

            - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

              - `BetaResponseInputText`

                A text input to the model.

              - `BetaResponseInputImage`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile`

                A file input to the model.

          - `type: "custom_tool_call_output"`

            The type of the custom tool call output. Always `custom_tool_call_output`.

            - `"custom_tool_call_output"`

          - `id?: string`

            The unique ID of the custom tool call output 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 | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

                `minLength: 1`, `maxLength: 64`

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `BetaResponseCustomToolCall`

          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`.

            - `"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.

          - `async?: boolean`

            Whether the custom tool call runs asynchronously.

          - `caller?: Direct | Program | null`

            The execution context that produced this tool call.

            - `Direct`

              - `type: "direct"`

                - `"direct"`

            - `Program`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace?: string`

            The namespace of the custom tool being called.

        - `CompactionTrigger`

          Compacts the current context. Must be the final input item.

          - `type: "compaction_trigger"`

            The type of the item. Always `compaction_trigger`.

            - `"compaction_trigger"`

          - `id?: string | null`

            The unique ID of this compaction trigger.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ItemReference`

          An internal identifier for an item to reference.

          - `id: string`

            The ID of the item to reference.

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `type?: "item_reference" | null`

            The type of item to reference. Always `item_reference`.

            - `"item_reference"`

        - `Program`

          - `id: string`

            The unique ID of this program item.

          - `call_id: string`

            The stable call ID of the program item.

            `minLength: 1`, `maxLength: 64`

          - `code: string`

            The JavaScript source executed by programmatic tool calling.

            `maxLength: 10485760`

          - `fingerprint: string`

            Opaque program replay fingerprint that must be round-tripped.

            `maxLength: 10485760`

          - `type: "program"`

            The item type. Always `program`.

            - `"program"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ProgramOutput`

          - `id: string`

            The unique ID of this program output item.

          - `call_id: string`

            The call ID of the program item.

            `minLength: 1`, `maxLength: 64`

          - `result: string`

            The result produced by the program item.

            `maxLength: 10485760`

          - `status: "completed" | "incomplete"`

            The terminal status of the program output.

            - `"completed"`

            - `"incomplete"`

          - `type: "program_output"`

            The item type. Always `program_output`.

            - `"program_output"`

          - `agent?: Agent | null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

    - `metadata: Record<string, string> | 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: "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more | (string & {})`

      Model ID used to generate the response, like `gpt-6-astra`. OpenAI
      offers a wide range of models with different capabilities, performance
      characteristics, and price points. Refer to the [model guide](/api/docs/models)
      to browse and compare available models.

      Deprecated values:

      - "gpt-5.4-nano", "gpt-5.4-nano-2026-03-17", "gpt-5.1", "gpt-5.1-2025-11-13": Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.3-chat-latest", "gpt-5.2-chat-latest": Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.1-codex", "gpt-5.1-chat-latest", "gpt-5-chat-latest", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", "o3-deep-research", "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5-codex", "gpt-5.1-codex-max": Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-5.1-mini": Not a supported model ID. Retained for SDK compatibility.
      - "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "o3", "o3-2025-04-16", "o3-pro", "o3-pro-2025-06-10", "gpt-5-pro", "gpt-5-pro-2025-10-06": Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-mini", "gpt-4o-mini-2024-07-18": Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4.1-nano", "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3-mini", "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "gpt-4o-2024-05-13", "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-1106-preview", "gpt-4", "gpt-4-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-0125", "o1-pro", "o1-pro-2025-03-19": Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "o1-preview", "o1-preview-2024-09-12": Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "o1-mini", "o1-mini-2024-09-12": Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-audio-mini", "gpt-audio-mini-2025-12-15": Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-12-17", "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", "gpt-4o-mini-audio-preview-2024-12-17": Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4o-audio-preview-2024-10-01": Announced shutdown date: 2025-10-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "chatgpt-4o-latest": Announced shutdown date: 2026-02-17. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "codex-mini-latest": Announced shutdown date: 2026-02-12. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-0125-preview", "gpt-4-turbo-preview", "gpt-4-0314": Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-vision-preview": Announced shutdown date: 2024-12-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-0613": Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k-0613": Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.
      - "gpt-3.5-turbo-1106": Announced shutdown date: 2026-09-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.

      - `"gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | 109 more`

        Model ID used to generate the response, like `gpt-6-astra`. OpenAI
        offers a wide range of models with different capabilities, performance
        characteristics, and price points. Refer to the [model guide](/api/docs/models)
        to browse and compare available models.

        - `"gpt-6-astra"`

        - `"gpt-6.1-sol"`

        - `"gpt-6.1-terra"`

        - `"gpt-6-sol"`

        - `"gpt-6-luna"`

        - `"gpt-5.6-sol"`

        - `"gpt-5.6-terra"`

        - `"gpt-5.6-luna"`

        - `"gpt-5.5"`

        - `"gpt-5.5-2026-04-23"`

        - `"gpt-5.4"`

        - `"gpt-5.4-mini"`

        - `"gpt-5.4-nano"`

        - `"gpt-5.4-mini-2026-03-17"`

        - `"gpt-5.4-nano-2026-03-17"`

        - `"gpt-5.3-chat-latest"`

        - `"gpt-5.2"`

        - `"gpt-5.2-2025-12-11"`

        - `"gpt-5.2-chat-latest"`

        - `"gpt-5.2-pro"`

        - `"gpt-5.2-pro-2025-12-11"`

        - `"gpt-5.1"`

        - `"gpt-5.1-2025-11-13"`

        - `"gpt-5.1-codex"`

        - `"gpt-5.1-mini"`

        - `"gpt-5.1-chat-latest"`

        - `"gpt-5"`

        - `"gpt-5-mini"`

        - `"gpt-5-nano"`

        - `"gpt-5-2025-08-07"`

        - `"gpt-5-mini-2025-08-07"`

        - `"gpt-5-nano-2025-08-07"`

        - `"gpt-5-chat-latest"`

        - `"gpt-4.1"`

        - `"gpt-4.1-mini"`

        - `"gpt-4.1-nano"`

        - `"gpt-4.1-2025-04-14"`

        - `"gpt-4.1-mini-2025-04-14"`

        - `"gpt-4.1-nano-2025-04-14"`

        - `"o4-mini"`

        - `"o4-mini-2025-04-16"`

        - `"o3"`

        - `"o3-2025-04-16"`

        - `"o3-mini"`

        - `"o3-mini-2025-01-31"`

        - `"o1"`

        - `"o1-2024-12-17"`

        - `"o1-preview"`

        - `"o1-preview-2024-09-12"`

        - `"o1-mini"`

        - `"o1-mini-2024-09-12"`

        - `"gpt-4o"`

        - `"gpt-4o-2024-11-20"`

        - `"gpt-4o-2024-08-06"`

        - `"gpt-4o-2024-05-13"`

        - `"gpt-audio-mini"`

        - `"gpt-audio-mini-2025-12-15"`

        - `"gpt-4o-audio-preview"`

        - `"gpt-4o-audio-preview-2024-10-01"`

        - `"gpt-4o-audio-preview-2024-12-17"`

        - `"gpt-4o-audio-preview-2025-06-03"`

        - `"gpt-4o-mini-audio-preview"`

        - `"gpt-4o-mini-audio-preview-2024-12-17"`

        - `"gpt-4o-search-preview"`

        - `"gpt-4o-mini-search-preview"`

        - `"gpt-4o-search-preview-2025-03-11"`

        - `"gpt-4o-mini-search-preview-2025-03-11"`

        - `"chatgpt-4o-latest"`

        - `"codex-mini-latest"`

        - `"gpt-4o-mini"`

        - `"gpt-4o-mini-2024-07-18"`

        - `"gpt-4-turbo"`

        - `"gpt-4-turbo-2024-04-09"`

        - `"gpt-4-0125-preview"`

        - `"gpt-4-turbo-preview"`

        - `"gpt-4-1106-preview"`

        - `"gpt-4-vision-preview"`

        - `"gpt-4"`

        - `"gpt-4-0314"`

        - `"gpt-4-0613"`

        - `"gpt-4-32k"`

        - `"gpt-4-32k-0314"`

        - `"gpt-4-32k-0613"`

        - `"gpt-3.5-turbo"`

        - `"gpt-3.5-turbo-16k"`

        - `"gpt-3.5-turbo-0301"`

        - `"gpt-3.5-turbo-0613"`

        - `"gpt-3.5-turbo-1106"`

        - `"gpt-3.5-turbo-0125"`

        - `"gpt-3.5-turbo-16k-0613"`

        - `"o1-pro"`

        - `"o1-pro-2025-03-19"`

        - `"o3-pro"`

        - `"o3-pro-2025-06-10"`

        - `"o3-deep-research"`

        - `"o3-deep-research-2025-06-26"`

        - `"o4-mini-deep-research"`

        - `"o4-mini-deep-research-2025-06-26"`

        - `"computer-use-preview"`

        - `"computer-use-preview-2025-03-11"`

        - `"gpt-5.5-pro"`

        - `"gpt-5.5-pro-2026-04-23"`

        - `"gpt-5-codex"`

        - `"gpt-5-pro"`

        - `"gpt-5-pro-2025-10-06"`

        - `"gpt-5.1-codex-max"`

        - `"gpt-daybreak-blue-latest"`

        - `"gpt-daybreak-red-latest"`

        - `"gpt-5.6-cyber"`

        - `"gpt-6-cyber"`

        - `"gpt-rosalind-research"`

        - `"gpt-6-rosalind"`

      - `(string & {})`

    - `object: "response"`

      The object type of this resource - always set to `response`.

      - `"response"`

    - `output: Array<BetaResponseOutputItem>`

      An array of content items generated by the model.

      - The length and order of items in the `output` array is dependent
        on the model's response.
      - Rather than accessing the first item in the `output` array and
        assuming it's an `assistant` message with the content generated by
        the model, you might consider using the `output_text` property where
        supported in SDKs.

      - `BetaResponseOutputMessage`

        An output message from the model.

      - `BetaResponseFileSearchToolCall`

        The results of a file search tool call. See the
        [file search guide](/api/docs/guides/tools-file-search) for more information.

      - `BetaResponseFunctionToolCall`

        A tool call to run a function. See the
        [function calling guide](/api/docs/guides/function-calling) for more information.

      - `BetaResponseFunctionToolCallOutputItem`

        - `id: string`

          The unique ID of the function call tool output.

        - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          The output from the function call generated by your code.
          Can be a string or an list of output content.

          - `string`

          - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

            - `BetaResponseInputText`

              A text input to the model.

            - `BetaResponseInputImage`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile`

              A file input to the model.

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "function_call_output"`

          The type of the function tool call output. Always `function_call_output`.

          - `"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.

        - `call_id?: string`

          The unique ID of the function tool call generated by the model.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

              `minLength: 1`, `maxLength: 64`

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by?: string`

          The identifier of the actor that created the item.

        - `name?: string`

          The name of the tool that produced the output.

        - `namespace?: string`

          The namespace of the tool that produced the output.

      - `AgentMessage`

        - `id: string`

          The unique ID of the agent message.

        - `author: string`

          The sending agent identity.

        - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

          Encrypted content sent between agents.

          - `BetaResponseInputText`

            A text input to the model.

          - `BetaResponseOutputText`

            A text output from the model.

          - `Text`

            A text content.

            - `text: string`

            - `type: "text"`

              - `"text"`

          - `SummaryText`

            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`.

              - `"summary_text"`

          - `ReasoningText`

            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`.

              - `"reasoning_text"`

          - `BetaResponseOutputRefusal`

            A refusal from the model.

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `ComputerScreenshot`

            A screenshot of a computer.

            - `detail: BetaImageDetail`

              The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

            - `file_id: string | null`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: string | null`

              The URL of the screenshot image.

              `format: uri`

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFile`

            A file input to the model.

          - `EncryptedContent`

            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`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The type of the item. Always `agent_message`.

          - `"agent_message"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall`

        - `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.

          - `"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`.

          - `"multi_agent_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput`

        - `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.

          - `"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>`

          Text output returned by the multi-agent action.

          - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

            The annotations of the text output.

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

          - `logprobs?: Array<Logprob>`

        - `type: "multi_agent_call_output"`

          The type of the multi-agent result. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseFunctionWebSearch`

        The results of a web search tool call. See the
        [web search guide](/api/docs/guides/tools-web-search) for more information.

      - `BetaResponseComputerToolCall`

        A tool call to a computer use tool. See the
        [computer use guide](/api/docs/guides/tools-computer-use) for more information.

      - `BetaResponseComputerToolCallOutputItem`

        - `id: string`

          The ID of the computer tool call output.

        - `call_id: string`

          The ID of the computer tool call that produced the output.

        - `output: BetaResponseComputerToolCallOutputScreenshot`

          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.

          - `"completed"`

          - `"incomplete"`

          - `"failed"`

          - `"in_progress"`

        - `type: "computer_call_output"`

          The type of the computer tool call output. Always `computer_call_output`.

          - `"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`

        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](/api/docs/guides/conversation-state).

      - `Program`

        - `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`.

          - `"program"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput`

        - `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.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The type of the item. Always `program_output`.

          - `"program_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseToolSearchCall`

        - `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.

          - `"server"`

          - `"client"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the tool search call item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "tool_search_call"`

          The type of the item. Always `tool_search_call`.

          - `"tool_search_call"`

        - `agent?: Agent`

          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: 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.

          - `"server"`

          - `"client"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the tool search output item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `tools: Array<BetaTool>`

          The loaded tool definitions returned by tool search.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

          - `CodeInterpreter`

            A tool that runs Python code to help generate a response to a prompt.

          - `ProgrammaticToolCalling`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

          - `LocalShell`

            A tool that allows the model to execute shell commands in a local environment.

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "tool_search_output"`

          The type of the item. Always `tool_search_output`.

          - `"tool_search_output"`

        - `agent?: Agent`

          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: string`

          The unique ID of the additional tools item.

        - `role: "unknown" | "user" | "assistant" | 5 more`

          The role that provided the additional tools.

          - `"unknown"`

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"critic"`

          - `"discriminator"`

          - `"developer"`

          - `"tool"`

        - `tools: Array<BetaTool>`

          The additional tool definitions made available at this item.

          - `BetaFunctionTool`

            Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

          - `BetaFileSearchTool`

            A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `BetaComputerTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaComputerUsePreviewTool`

            A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `BetaWebSearchTool`

            Search the Internet for sources related to the prompt. Learn more about the
            [web search tool](/api/docs/guides/tools-web-search).

          - `Mcp`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

          - `CodeInterpreter`

            A tool that runs Python code to help generate a response to a prompt.

          - `ProgrammaticToolCalling`

          - `ImageGeneration`

            A tool that generates images using the GPT image models.

          - `LocalShell`

            A tool that allows the model to execute shell commands in a local environment.

          - `BetaFunctionShellTool`

            A tool that allows the model to execute shell commands.

          - `BetaCustomTool`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `BetaNamespaceTool`

            Groups function/custom tools under a shared namespace.

          - `BetaToolSearchTool`

            Hosted or BYOT tool search configuration for deferred tools.

          - `BetaWebSearchPreviewTool`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `BetaApplyPatchTool`

            Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "additional_tools"`

          The type of the item. Always `additional_tools`.

          - `"additional_tools"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `BetaResponseCompactionItem`

        A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

        - `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`.

          - `"compaction"`

        - `agent?: Agent`

          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`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"generating"`

          - `"failed"`

        - `type: "image_generation_call"`

          The type of the image generation call. Always `image_generation_call`.

          - `"image_generation_call"`

        - `action?: "generate" | "edit" | "auto" | null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent?: Agent | null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background?: "transparent" | "opaque" | "auto" | null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error?: Error`

          Details of a moderation failure, when available.

          - `code: string | null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string | null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details?: ModerationDetails`

            Public details for a `moderation_blocked` error, when available.

            - `categories: Array<string>`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" | "output" | "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `quality?: "low" | "medium" | "high" | 3 more | null`

          The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `revised_prompt?: string | null`

          The prompt that was used after any model prompt rewriting.

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

        - `svg_usage?: SvgUsage`

          - `input_tokens: number`

          - `model: string`

          - `output_tokens: number`

          - `reasoning_tokens: number`

          - `total_tokens: number`

      - `BetaResponseCodeInterpreterToolCall`

        A tool call to run code.

      - `LocalShellCall`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: Action`

          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`.

            - `"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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "local_shell_call"`

          The type of the local shell call. Always `local_shell_call`.

          - `"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`

        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`.

          - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `BetaResponseFunctionShellToolCall`

        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`

          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 | BetaResponseContainerReference | null`

          Represents the use of a local environment to perform shell actions.

          - `BetaResponseLocalEnvironment`

            Represents the use of a local environment to perform shell actions.

            - `type: "local"`

              The environment type. Always `local`.

              - `"local"`

          - `BetaResponseContainerReference`

            Represents a container created with /v1/containers.

            - `container_id: string`

            - `type: "container_reference"`

              The environment type. Always `container_reference`.

              - `"container_reference"`

        - `status: "in_progress" | "completed" | "incomplete"`

          The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The ID of the entity that created this tool call.

      - `BetaResponseFunctionShellToolCallOutput`

        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 | Exit`

            Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

            - `Timeout`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit`

              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`.

                - `"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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: "shell_call_output"`

          The type of the shell call output. Always `shell_call_output`.

          - `"shell_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The identifier of the actor that created the item.

      - `BetaResponseApplyPatchToolCall`

        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 | DeleteFile | UpdateFile`

          One of the create_file, delete_file, or update_file operations applied via apply_patch.

          - `CreateFile`

            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.

              - `"create_file"`

          - `DeleteFile`

            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.

              - `"delete_file"`

          - `UpdateFile`

            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.

              - `"update_file"`

        - `status: "in_progress" | "completed"`

          The status of the apply patch tool call. One of `in_progress` or `completed`.

          - `"in_progress"`

          - `"completed"`

        - `type: "apply_patch_call"`

          The type of the item. Always `apply_patch_call`.

          - `"apply_patch_call"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by?: string`

          The ID of the entity that created this tool call.

      - `BetaResponseApplyPatchToolCallOutput`

        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`.

          - `"completed"`

          - `"failed"`

        - `type: "apply_patch_call_output"`

          The type of the item. Always `apply_patch_call_output`.

          - `"apply_patch_call_output"`

        - `agent?: Agent`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller?: Direct | Program | null`

          The execution context that produced this tool call.

          - `Direct`

            - `type: "direct"`

              - `"direct"`

          - `Program`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"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`

        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`.

          - `"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?: BetaMcpToolCallError | 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`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `McpListTools`

        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`.

          - `"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`

        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`.

          - `"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`

        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`.

          - `"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`

        A call to a custom tool created by the model.

      - `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

        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.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `created_by?: string`

          The identifier of the actor that created the item.

    - `parallel_tool_calls: boolean`

      Whether to allow the model to run tool calls in parallel.

    - `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.
      We generally recommend altering this or `top_p` but not both.

      `minimum: 0`, `maximum: 2`

    - `tool_choice: BetaToolChoiceOptions | BetaToolChoiceAllowed | BetaToolChoiceTypes | 6 more`

      How the model should select which tool (or tools) to use when generating
      a response. See the `tools` parameter to see how to specify which tools
      the model can call.

      - `BetaToolChoiceOptions = "none" | "auto" | "required"`

        Controls which (if any) tool is called by the model.

        `none` means the model will not call any tool and instead generates a message.

        `auto` means the model can pick between generating a message or calling one or
        more tools.

        `required` means the model must call one or more tools.

        - `"none"`

        - `"auto"`

        - `"required"`

      - `BetaToolChoiceAllowed`

        Constrains the tools available to the model to a pre-defined set.

        - `mode: "auto" | "required"`

          Constrains the tools available to the model to a pre-defined set.

          `auto` allows the model to pick from among the allowed tools and generate a
          message.

          `required` requires the model to call one or more of the allowed tools.

          - `"auto"`

          - `"required"`

        - `tools: Array<Record<string, unknown>>`

          A list of tool definitions that the model should be allowed to call.

          For the Responses API, the list of tool definitions might look like:

          ```json
          [
            { "type": "function", "name": "get_weather" },
            { "type": "mcp", "server_label": "deepwiki" },
            { "type": "image_generation" }
          ]
          ```

        - `type: "allowed_tools"`

          Allowed tool configuration type. Always `allowed_tools`.

          - `"allowed_tools"`

      - `BetaToolChoiceTypes`

        Indicates that the model should use a built-in tool to generate a response.
        [Learn more about built-in tools](/api/docs/guides/tools).

        - `type: "file_search" | "web_search_preview" | "computer" | 5 more`

          The type of hosted tool the model should to use. Learn more about
          [built-in tools](/api/docs/guides/tools).

          Allowed values are:

          - `file_search`
          - `web_search_preview`
          - `computer`
          - `computer_use_preview`
          - `computer_use`
          - `code_interpreter`
          - `image_generation`

          - `"file_search"`

          - `"web_search_preview"`

          - `"computer"`

          - `"computer_use_preview"`

          - `"computer_use"`

          - `"web_search_preview_2025_03_11"`

          - `"image_generation"`

          - `"code_interpreter"`

      - `BetaToolChoiceFunction`

        Use this option to force the model to call a specific function.

        - `name: string`

          The name of the function to call.

        - `type: "function"`

          For function calling, the type is always `function`.

          - `"function"`

      - `BetaToolChoiceMcp`

        Use this option to force the model to call a specific tool on a remote MCP server.

        - `server_label: string`

          The label of the MCP server to use.

        - `type: "mcp"`

          For MCP tools, the type is always `mcp`.

          - `"mcp"`

        - `name?: string | null`

          The name of the tool to call on the server.

      - `BetaToolChoiceCustom`

        Use this option to force the model to call a specific custom tool.

        - `name: string`

          The name of the custom tool to call.

        - `type: "custom"`

          For custom tool calling, the type is always `custom`.

          - `"custom"`

      - `BetaSpecificProgrammaticToolCallingParam`

        - `type: "programmatic_tool_calling"`

          The tool to call. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `BetaToolChoiceApplyPatch`

        Forces the model to call the apply_patch tool when executing a tool call.

        - `type: "apply_patch"`

          The tool to call. Always `apply_patch`.

          - `"apply_patch"`

      - `BetaToolChoiceShell`

        Forces the model to call the shell tool when a tool call is required.

        - `type: "shell"`

          The tool to call. Always `shell`.

          - `"shell"`

    - `tools: Array<BetaTool>`

      An array of tools the model may call while generating a response. You
      can specify which tool to use by setting the `tool_choice` parameter.

      We support the following categories of tools:

      - **Built-in tools**: Tools that are provided by OpenAI that extend the
        model's capabilities, like [web search](/api/docs/guides/tools-web-search)
        or [file search](/api/docs/guides/tools-file-search). Learn more about
        [built-in tools](/api/docs/guides/tools).
      - **MCP Tools**: Integrations with third-party systems via custom MCP servers
        or predefined connectors such as Google Drive and SharePoint. Learn more about
        [MCP Tools](/api/docs/guides/tools-connectors-mcp).
      - **Function calls (custom tools)**: Functions that are defined by you,
        enabling the model to call your own code with strongly typed arguments
        and outputs. Learn more about
        [function calling](/api/docs/guides/function-calling). You can also use
        custom tools to call your own code.

      - `BetaFunctionTool`

        Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

      - `BetaFileSearchTool`

        A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

      - `BetaComputerTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaComputerUsePreviewTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaWebSearchTool`

        Search the Internet for sources related to the prompt. Learn more about the
        [web search tool](/api/docs/guides/tools-web-search).

      - `Mcp`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

      - `CodeInterpreter`

        A tool that runs Python code to help generate a response to a prompt.

      - `ProgrammaticToolCalling`

      - `ImageGeneration`

        A tool that generates images using the GPT image models.

      - `LocalShell`

        A tool that allows the model to execute shell commands in a local environment.

      - `BetaFunctionShellTool`

        A tool that allows the model to execute shell commands.

      - `BetaCustomTool`

        A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

      - `BetaNamespaceTool`

        Groups function/custom tools under a shared namespace.

      - `BetaToolSearchTool`

        Hosted or BYOT tool search configuration for deferred tools.

      - `BetaWebSearchPreviewTool`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

      - `BetaApplyPatchTool`

        Allows the assistant to create, delete, or update files using unified diffs.

    - `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.

      `minimum: 0`, `maximum: 1`

    - `background?: boolean | null`

      Whether to run the model response in the background.
      [Learn more](/api/docs/guides/background).

    - `completed_at?: number | null`

      Unix timestamp (in seconds) of when this Response was completed.
      Only present when the status is `completed`.

      `format: unixtime`

    - `conversation?: Conversation | null`

      The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation.

      - `id: string`

        The unique ID of the conversation that this response was associated with.

    - `image?: Image`

      - `context_compression: "enabled" | "disabled"`

        Effective image context optimization policy.

        - `"enabled"`

        - `"disabled"`

    - `max_output_tokens?: number | null`

      An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/api/docs/guides/reasoning).

    - `max_tool_calls?: number | null`

      The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.

    - `moderation?: Moderation | null`

      Moderation results for the response input and output, if moderated completions were requested.

      - `input: ModerationResult | Error`

        Moderation for the response input.

        - `ModerationResult`

          A moderation result produced for the response input or output.

          - `categories: Record<string, boolean>`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: Record<string, Array<"text" | "image">>`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: Record<string, number>`

            A dictionary of moderation categories to scores.

          - `flagged: boolean`

            A boolean indicating whether the content was flagged by any category.

          - `model: string`

            The moderation model that produced this result.

          - `type: "moderation_result"`

            The object type, which was always `moderation_result` for successful moderation results.

            - `"moderation_result"`

        - `Error`

          An error produced while attempting moderation for the response input or output.

          - `code: string`

            The error code.

          - `message: string`

            The error message.

          - `type: "error"`

            The object type, which was always `error` for moderation failures.

            - `"error"`

      - `output: ModerationResult | Error`

        Moderation for the response output.

        - `ModerationResult`

          A moderation result produced for the response input or output.

          - `categories: Record<string, boolean>`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: Record<string, Array<"text" | "image">>`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: Record<string, number>`

            A dictionary of moderation categories to scores.

          - `flagged: boolean`

            A boolean indicating whether the content was flagged by any category.

          - `model: string`

            The moderation model that produced this result.

          - `type: "moderation_result"`

            The object type, which was always `moderation_result` for successful moderation results.

            - `"moderation_result"`

        - `Error`

          An error produced while attempting moderation for the response input or output.

          - `code: string`

            The error code.

          - `message: string`

            The error message.

          - `type: "error"`

            The object type, which was always `error` for moderation failures.

            - `"error"`

    - `previous_response_id?: string | null`

      The unique ID of the previous response to the model. Use this to
      create multi-turn conversations. Learn more about
      [conversation state](/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.

    - `prompt?: BetaResponsePrompt | null`

      Reference to a prompt template and its variables.
      [Learn more](/api/docs/guides/text?api-mode=responses#version-prompts-in-code).

      - `id: string`

        The unique identifier of the prompt template to use.

      - `variables?: Record<string, string | BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile> | null`

        Optional map of values to substitute in for variables in your
        prompt. The substitution values can either be strings, or other
        Response input types like images or files.

        - `string`

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile`

          A file input to the model.

      - `version?: string | null`

        Optional version of the prompt template.

    - `prompt_cache_diagnostics?: CacheMiss | CacheHit | ComparisonResponseNotFound | Unavailable`

      Prompt cache diagnostics requested for this response.

      - `CacheMiss`

        - `cache_missed_tokens: number`

          The estimated number of input tokens affected after the first detected divergence.

        - `reason: "model_changed" | "prompt_cache_key_changed" | "tools_changed" | 6 more`

          The reason prompt cache reuse did not occur.

          - `"model_changed"`

          - `"prompt_cache_key_changed"`

          - `"tools_changed"`

          - `"text_format_changed"`

          - `"reasoning_effort_changed"`

          - `"verbosity_changed"`

          - `"context_compacted"`

          - `"input_changed"`

          - `"service_tier_changed"`

        - `type: "cache_miss"`

          - `"cache_miss"`

        - `comparison_reusable_tokens?: number`

          The raw token count of the reusable prefix in the compared response.

      - `CacheHit`

        - `type: "cache_hit"`

          - `"cache_hit"`

      - `ComparisonResponseNotFound`

        - `type: "comparison_response_not_found"`

          - `"comparison_response_not_found"`

      - `Unavailable`

        - `type: "unavailable"`

          - `"unavailable"`

    - `prompt_cache_key?: string | null`

      Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/api/docs/guides/prompt-caching).

    - `prompt_cache_options?: PromptCacheOptions`

      The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

      - `mode: "implicit" | "explicit"`

        Whether implicit prompt-cache breakpoints were enabled.

        - `"implicit"`

        - `"explicit"`

      - `ttl: "30m" | "12h"`

        The minimum lifetime applied to each cache breakpoint.

        - `"30m"`

        - `"12h"`

      - `comparison_response_id?: string | null`

        The response ID supplied as the prompt cache diagnostics comparison.

    - `prompt_cache_retention?: "in_memory" | "24h" | null`

      Deprecated. Use `prompt_cache_options.ttl` instead.

      The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/api/docs/guides/prompt-caching#prompt-cache-retention).
      This field expresses a maximum retention policy, while
      `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two
      fields are independent and do not interact.
      For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported.

      For older models that support both `in_memory` and `24h`, the default depends on your organization's data retention policy:

      - Organizations without ZDR enabled default to `24h`.
      - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified.

      - `"in_memory"`

      - `"24h"`

    - `reasoning?: Reasoning | null`

      Configuration options for
      [reasoning models](/api/docs/guides/reasoning).

      - `context?: "auto" | "current_turn" | "all_turns" | null`

        Controls which reasoning items are rendered back to the model on later turns.
        If omitted or set to `auto`, the model determines the context mode. The
        `gpt-5.6` model family defaults to `all_turns`; earlier models default to
        `current_turn`.

        When returned on a response, this is the effective reasoning context mode
        used for the response.

        - `"auto"`

        - `"current_turn"`

        - `"all_turns"`

      - `effort?: "none" | "minimal" | "low" | 4 more | null`

        Constrains effort on reasoning for reasoning models. Currently supported
        values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
        Reducing reasoning effort can result in faster responses and fewer tokens
        used on reasoning in a response. Not all reasoning models support every
        value. See the
        [reasoning guide](/api/docs/guides/reasoning)
        for model-specific support.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `generate_summary?: "auto" | "concise" | "detailed" | null`

        **Deprecated:** use `summary` instead.

        A summary of the reasoning performed by the model. This can be
        useful for debugging and understanding the model's reasoning process.
        One of `auto`, `concise`, or `detailed`.

        - `"auto"`

        - `"concise"`

        - `"detailed"`

      - `mode?: (string & {}) | "standard" | "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `(string & {})`

        - `"standard" | "pro"`

          - `"standard"`

          - `"pro"`

      - `summary?: "auto" | "concise" | "detailed" | null`

        A summary of the reasoning performed by the model. This can be
        useful for debugging and understanding the model's reasoning process.
        One of `auto`, `concise`, or `detailed`.

        `concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.

        - `"auto"`

        - `"concise"`

        - `"detailed"`

    - `safety_identifier?: string | null`

      A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.
      The IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

      `maxLength: 128`

    - `service_tier?: BetaServiceTier | null`

      Specifies the processing type used for serving the request.

      - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
      - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
      - If set to '[flex](/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.
      - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.
      - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for `gpt-5.6-sol`; a response served through it will show `service_tier=ultrafast`.
      - When not set, the default behavior is 'auto'.

      When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

      - `"auto"`

      - `"default"`

      - `"flex"`

      - `"scale"`

      - `"priority"`

      - `"fast"`

      - `"ultrafast"`

    - `status?: BetaResponseStatus`

      The status of the response generation. One of `completed`, `failed`,
      `in_progress`, `cancelled`, `queued`, or `incomplete`.

      - `"completed"`

      - `"failed"`

      - `"in_progress"`

      - `"cancelled"`

      - `"queued"`

      - `"incomplete"`

    - `text?: BetaResponseTextConfig`

      Configuration options for a text response from the model. Can be plain
      text or structured JSON data. Learn more:

      - [Text inputs and outputs](/api/docs/guides/text)
      - [Structured Outputs](/api/docs/guides/structured-outputs)

      - `format?: BetaResponseFormatTextConfig`

        An object specifying the format that the model must output.

        Configuring `{ "type": "json_schema" }` enables Structured Outputs,
        which ensures the model will match your supplied JSON schema. Learn more in the
        [Structured Outputs guide](/api/docs/guides/structured-outputs).

        The default format is `{ "type": "text" }` with no additional options.

        **Not recommended for gpt-4o and newer models:**

        Setting to `{ "type": "json_object" }` enables the older JSON mode, which
        ensures the message the model generates is valid JSON. Using `json_schema`
        is preferred for models that support it.

        - `Text`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig`

          JSON Schema response format. Used to generate structured JSON responses.
          Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

        - `JSONObject`

          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`.

            - `"json_object"`

      - `verbosity?: "low" | "medium" | "high" | null`

        Constrains the verbosity of the model's response. Lower values will result in
        more concise responses, while higher values will result in more verbose responses.
        Currently supported values are `low`, `medium`, and `high`. The default is
        `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tool_usage?: ToolUsage`

      Usage reported by hosted tools, separate from base model `usage`. The field
      can be omitted when tool usage is unavailable. When present, tool families
      with no recorded usage have zero counts.

      `image_gen` sums available token counts across image generation calls.
      Calls with missing or incomplete usage records may be skipped. Output
      token details and cached input counts can be omitted. An omitted cache
      count means cache usage is unknown.

      `web_search.num_requests` counts billable searches. Discounted searches
      and actions such as opening a page are excluded. Use billing records to
      reconcile final charges.

      - `image_gen: ImageGen`

        Aggregated usage statistics for image generation tool calls.

        - `input_tokens: number`

          The number of tokens (images and text) in the input prompt.

        - `input_tokens_details: InputTokensDetails`

          The input tokens detailed information for the image generation.

          - `image_tokens: number`

            The number of image tokens in the input prompt.

          - `text_tokens: number`

            The number of text tokens in the input prompt.

        - `output_tokens: number`

          The number of output tokens generated by the model.

        - `total_tokens: number`

          The total number of tokens (images and text) used for the image generation.

        - `cached_tokens?: number`

        - `cached_tokens_details?: CachedTokensDetails`

          - `cached_image_tokens: number`

          - `cached_text_tokens: number`

        - `output_tokens_details?: OutputTokensDetails`

          The output token details for the image generation.

          - `image_tokens: number`

            The number of image output tokens generated by the model.

          - `text_tokens: number`

            The number of text output tokens generated by the model.

      - `web_search: WebSearch`

        Aggregated billable usage statistics for web search tool calls.

        - `num_requests: number`

          The number of billable web search requests issued.

    - `top_logprobs?: number | null`

      An integer between 0 and 20 specifying the maximum number of most likely
      tokens to return at each token position, each with an associated log
      probability. In some cases, the number of returned tokens may be fewer than
      requested.

      `minimum: 0`, `maximum: 20`

    - `truncation?: "auto" | "disabled" | null`

      The truncation strategy to use for the model response.

      - `auto`: If the input to this Response exceeds
        the model's context window size, the model will truncate the
        response to fit the context window by dropping items from the beginning of the conversation.
        On some models, trimming can begin earlier because the API subtracts the model's
        maximum output allowance from its input limit, even if you set a lower `max_output_tokens`.
      - `disabled` (default): If the input size will exceed the context window
        size for a model, the request will fail with a 400 error.

      - `"auto"`

      - `"disabled"`

    - `usage?: BetaResponseUsage`

      Represents token usage details including input tokens, output tokens,
      a breakdown of output tokens, and the total tokens used.

      - `input_tokens: number`

        The number of input tokens.

      - `input_tokens_details: InputTokensDetails`

        A detailed breakdown of the input tokens.

        - `cache_write_tokens: number`

          The number of input tokens that were written to the cache.

        - `cached_tokens: number`

          The number of tokens that were retrieved from the cache.
          [More on prompt caching](/api/docs/guides/prompt-caching).

        - `cache_write_tokens_details?: CacheWriteTokensDetails`

          - `ttl_12h_tokens: number`

            The number of input tokens written with 12-hour retention.

          - `ttl_30m_tokens: number`

            The number of input tokens written with 30-minute retention.

      - `output_tokens: number`

        The number of output tokens.

      - `output_tokens_details: OutputTokensDetails`

        A detailed breakdown of the output tokens.

        - `reasoning_tokens: number`

          The number of reasoning tokens.

      - `total_tokens: number`

        The total number of tokens used.

    - `user?: string`

      This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.
      A stable identifier for your end-users.
      Used to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.incomplete"`

    The type of the event. Always `response.incomplete`.

    - `"response.incomplete"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Inject Created Event

- `BetaResponseInjectCreatedEvent`

  Emitted when all injected input items were validated and committed to the
  active response.

  - `response_id: string`

    The ID of the response that accepted the input.

  - `sequence_number: number`

    The sequence number for this event.

  - `type: "response.inject.created"`

    The event discriminator. Always `response.inject.created`.

    - `"response.inject.created"`

  - `stream_id?: string`

    The multiplexed WebSocket stream that emitted the event. This field is
    present only when WebSocket multiplexing is enabled separately.

### Beta Response Inject Event

- `BetaResponseInjectEvent`

  Injects input items into an active response over a WebSocket connection.
  The items are validated and committed atomically. Currently, the server
  accepts client-owned tool outputs that resume a waiting agent.

  - `input: Array<BetaResponseInputItem>`

    Input items to inject into the active response.

    `maxItems: 16384`

    - `BetaEasyInputMessage`

      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.

        - `string`

        - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

          A list of one or many input items to the model, containing different content
          types.

          - `BetaResponseInputText`

            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`.

              - `"input_text"`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `detail: BetaImageDetail`

              The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

              - `"low"`

              - `"high"`

              - `"auto"`

              - `"original"`

            - `type: "input_image"`

              The type of the input item. Always `input_image`.

              - `"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.

              `format: uri`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFile`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"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`.

              - `"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.

              `format: uri`

            - `filename?: string`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

      - `role: "user" | "assistant" | "system" | "developer"`

        The role of the message input. One of `user`, `assistant`, `system`, or
        `developer`.

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"developer"`

      - `phase?: "commentary" | "final_answer" | 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.

        - `"commentary"`

        - `"final_answer"`

      - `type?: "message"`

        The type of the message input. Always `message`.

        - `"message"`

    - `Message`

      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.

      - `content: BetaResponseInputMessageContentList`

        A list of one or many input items to the model, containing different content
        types.

      - `role: "user" | "system" | "developer"`

        The role of the message input. One of `user`, `system`, or `developer`.

        - `"user"`

        - `"system"`

        - `"developer"`

      - `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"`

        The status of item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type?: "message"`

        The type of the message input. Always set to `message`.

        - `"message"`

    - `BetaResponseOutputMessage`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

        The content of the output message.

        - `BetaResponseOutputText`

          A text output from the model.

          - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

            The annotations of the text output.

            - `FileCitation`

              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 in the output text at which to insert the file citation.

              - `type: "file_citation"`

                The type of the file citation. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation`

              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_citation"`

              - `url: string`

                The URL of the web resource.

                `format: uri`

            - `ContainerFileCitation`

              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`.

                - `"container_file_citation"`

            - `FilePath`

              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`.

                - `"file_path"`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

          - `logprobs?: Array<Logprob>`

            - `token: string`

            - `bytes: Array<number>`

            - `logprob: number`

            - `top_logprobs: Array<TopLogprob>`

              - `token: string`

              - `bytes: Array<number>`

              - `logprob: number`

        - `BetaResponseOutputRefusal`

          A refusal from the model.

          - `refusal: string`

            The refusal explanation from the model.

          - `type: "refusal"`

            The type of the refusal. Always `refusal`.

            - `"refusal"`

      - `role: "assistant"`

        The role of the output message. Always `assistant`.

        - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "message"`

        The type of the output message. Always `message`.

        - `"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" | "final_answer" | 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.

        - `"commentary"`

        - `"final_answer"`

    - `BetaResponseFileSearchToolCall`

      The results of a file search tool call. See the
      [file search guide](/api/docs/guides/tools-file-search) 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`,

        - `"in_progress"`

        - `"searching"`

        - `"completed"`

        - `"incomplete"`

        - `"failed"`

      - `type: "file_search_call"`

        The type of the file search tool call. Always `file_search_call`.

        - `"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.

          - `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.

          `format: float`

        - `text?: string`

          The text that was retrieved from the file.

    - `BetaResponseComputerToolCall`

      A tool call to a computer use tool. See the
      [computer use guide](/api/docs/guides/tools-computer-use) 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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "computer_call"`

        The type of the computer call. Always `computer_call`.

        - `"computer_call"`

      - `action?: BetaComputerAction`

        A click action.

        - `Click`

          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`.

            - `"left"`

            - `"right"`

            - `"wheel"`

            - `"back"`

            - `"forward"`

          - `type: "click"`

            Specifies the event type. For a click action, this property is always `click`.

            - `"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`

          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`.

            - `"double_click"`

          - `x: number`

            The x-coordinate where the double click occurred.

          - `y: number`

            The y-coordinate where the double click occurred.

        - `Drag`

          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`.

            - `"drag"`

          - `keys?: Array<string> | null`

            The keys being held while dragging the mouse.

        - `Keypress`

          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`.

            - `"keypress"`

        - `Move`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"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`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll`

          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`.

            - `"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`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions?: BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click`

          A click action.

        - `DoubleClick`

          A double click action.

        - `Drag`

          A drag action.

        - `Keypress`

          A collection of keypresses the model would like to perform.

        - `Move`

          A mouse move action.

        - `Screenshot`

          A screenshot action.

        - `Scroll`

          A scroll action.

        - `Type`

          An action to type in text.

        - `Wait`

          A wait action.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput`

      The output of a computer tool call.

      - `call_id: string`

        The ID of the computer tool call that produced the output.

        `minLength: 1`, `maxLength: 64`

      - `output: BetaResponseComputerToolCallOutputScreenshot`

        A computer screenshot image used with the computer use tool.

        - `type: "computer_screenshot"`

          Specifies the event type. For a computer screenshot, this property is
          always set to `computer_screenshot`.

          - `"computer_screenshot"`

        - `file_id?: string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url?: string`

          The URL of the screenshot image.

          `format: uri`

      - `type: "computer_call_output"`

        The type of the computer tool call output. Always `computer_call_output`.

        - `"computer_call_output"`

      - `id?: string | null`

        The ID of the computer tool call output.

      - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

        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.

      - `status?: "in_progress" | "completed" | "incomplete" | null`

        The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseFunctionWebSearch`

      The results of a web search tool call. See the
      [web search guide](/api/docs/guides/tools-web-search) for more information.

      - `id: string`

        The unique ID of the web search tool call.

      - `action: Search | OpenPage | FindInPage`

        An object describing the specific action taken in this web search call.
        Includes details on how the model used the web (search, open_page, find_in_page).

        - `Search`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries?: Array<string>`

            The search queries.

          - `query?: string`

            The search query.

          - `sources?: Array<Source>`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

              `format: uri`

        - `OpenPage`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url?: string | null`

            The URL opened by the model.

            `format: uri`

        - `FindInPage`

          Action type "find_in_page": Searches for a pattern within a loaded page.

          - `pattern: string`

            The pattern or text to search for within the page.

          - `type: "find_in_page"`

            The action type.

            - `"find_in_page"`

          - `url: string`

            The URL of the page searched for the pattern.

            `format: uri`

      - `status: "in_progress" | "searching" | "completed" | 2 more`

        The status of the web search tool call.

        - `"in_progress"`

        - `"searching"`

        - `"completed"`

        - `"failed"`

        - `"incomplete"`

      - `type: "web_search_call"`

        The type of the web search tool call. Always `web_search_call`.

        - `"web_search_call"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseFunctionToolCall`

      A tool call to run a function. See the
      [function calling guide](/api/docs/guides/function-calling) 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`.

        - `"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.

      - `async?: boolean`

        Whether the function tool call runs asynchronously.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `FunctionCallOutput`

      The output of a function tool call.

      - `output: string | BetaResponseFunctionCallOutputItemList`

        Text, image, or file output of the function tool call.

        - `string`

        - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

          An array of content outputs (text, image, file) for the function tool call.

          - `BetaResponseInputTextContent`

            A text input to the model.

            - `text: string`

              The text input to the model.

              `maxLength: 10485760`

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputImageContent`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `type: "input_image"`

              The type of the input item. Always `input_image`.

              - `"input_image"`

            - `detail?: BetaImageDetail | null`

              The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

            - `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.

              `maxLength: 20971520`, `format: uri`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFileContent`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"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`.

              - `"auto"`

              - `"low"`

              - `"high"`

            - `file_data?: string | null`

              The base64-encoded data of the file to be sent to the model.

              `maxLength: 73400320`

            - `file_id?: string | null`

              The ID of the file to be sent to the model.

            - `file_url?: string | null`

              The URL of the file to be sent to the model.

              `format: uri`

            - `filename?: string | null`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

      - `type: "function_call_output"`

        The type of the function tool call output. Always `function_call_output`.

        - `"function_call_output"`

      - `id?: string | null`

        The unique ID of the function tool call output. Populated when this item is returned via API.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id?: string | null`

        The unique ID of the function tool call generated by the model.

        `minLength: 1`, `maxLength: 64`

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `name?: string | null`

        The name of the tool that produced the output.

        `minLength: 1`, `maxLength: 128`

      - `namespace?: string | null`

        The namespace of the tool that produced the output.

        `minLength: 1`, `maxLength: 128`

      - `status?: "in_progress" | "completed" | "incomplete" | null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `AgentMessage`

      A message routed between agents.

      - `author: string`

        The sending agent identity.

      - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

        Plaintext, image, or encrypted content sent between agents.

        - `BetaResponseInputTextContent`

          A text input to the model.

        - `BetaResponseInputImageContent`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

        - `EncryptedContent`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

            `maxLength: 10485760`

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The item type. Always `agent_message`.

        - `"agent_message"`

      - `id?: string | null`

        The unique ID of this agent message item.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall`

      - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

        The multi-agent action that was executed.

        - `"spawn_agent"`

        - `"interrupt_agent"`

        - `"list_agents"`

        - `"send_message"`

        - `"followup_task"`

        - `"wait_agent"`

      - `arguments: string`

        The action arguments as a JSON string.

      - `call_id: string`

        The unique ID linking this call to its output.

        `minLength: 1`, `maxLength: 64`

      - `type: "multi_agent_call"`

        The item type. Always `multi_agent_call`.

        - `"multi_agent_call"`

      - `id?: string | null`

        The unique ID of this multi-agent call.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput`

      - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

        The multi-agent action that produced this result.

        - `"spawn_agent"`

        - `"interrupt_agent"`

        - `"list_agents"`

        - `"send_message"`

        - `"followup_task"`

        - `"wait_agent"`

      - `call_id: string`

        The unique ID of the multi-agent call.

        `minLength: 1`, `maxLength: 64`

      - `output: Array<Output>`

        Text output returned by the multi-agent action.

        - `text: string`

          The text content.

          `maxLength: 10485760`

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

        - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

          Citations associated with the text content.

          - `FileCitation`

            - `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.

              `minimum: 0`

            - `type: "file_citation"`

              The citation type. Always `file_citation`.

              - `"file_citation"`

          - `URLCitation`

            - `end_index: number`

              The index of the last character of the citation in the message.

              `minimum: 0`

            - `start_index: number`

              The index of the first character of the citation in the message.

              `minimum: 0`

            - `title: string`

              The title of the cited resource.

            - `type: "url_citation"`

              The citation type. Always `url_citation`.

              - `"url_citation"`

            - `url: string`

              The URL of the cited resource.

              `format: uri`

          - `ContainerFileCitation`

            - `container_id: string`

              The ID of the container.

            - `end_index: number`

              The index of the last character of the citation in the message.

              `minimum: 0`

            - `file_id: string`

              The ID of the container file.

            - `filename: string`

              The filename of the container file cited.

            - `start_index: number`

              The index of the first character of the citation in the message.

              `minimum: 0`

            - `type: "container_file_citation"`

              The citation type. Always `container_file_citation`.

              - `"container_file_citation"`

      - `type: "multi_agent_call_output"`

        The item type. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `id?: string | null`

        The unique ID of this multi-agent call output.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall`

      - `arguments: unknown`

        The arguments supplied to the tool search call.

      - `type: "tool_search_call"`

        The item type. Always `tool_search_call`.

        - `"tool_search_call"`

      - `id?: string | null`

        The unique ID of this tool search call.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id?: string | null`

        The unique ID of the tool search call generated by the model.

        `minLength: 1`, `maxLength: 64`

      - `execution?: "server" | "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status?: "in_progress" | "completed" | "incomplete" | null`

        The status of the tool search call.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseToolSearchOutputItemParam`

      - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

        The loaded tool definitions returned by the tool search output.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

            - `"function"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async?: boolean`

          - `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`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `type: "file_search"`

            The type of the file search tool. Always `file_search`.

            - `"file_search"`

          - `vector_store_ids: Array<string>`

            The IDs of the vector stores to search.

          - `filters?: ComparisonFilter | CompoundFilter | null`

            A filter to apply.

            - `ComparisonFilter`

              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

                - `"eq"`

                - `"ne"`

                - `"gt"`

                - `"gte"`

                - `"lt"`

                - `"lte"`

                - `"in"`

                - `"nin"`

              - `value: string | number | boolean | Array<string | number>`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `Array<string | number>`

                  - `string`

                  - `number`

            - `CompoundFilter`

              Combine multiple filters using `and` or `or`.

              - `filters: Array<ComparisonFilter | unknown>`

                Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

                - `ComparisonFilter`

                  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

                    - `"eq"`

                    - `"ne"`

                    - `"gt"`

                    - `"gte"`

                    - `"lt"`

                    - `"lte"`

                    - `"in"`

                    - `"nin"`

                  - `value: string | number | boolean | Array<string | number>`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `Array<string | number>`

                      - `string`

                      - `number`

                - `unknown`

              - `type: "and" | "or"`

                Type of operation: `and` or `or`.

                - `"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`

            Ranking options for search.

            - `hybrid_search?: HybridSearch`

              Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

              - `embedding_weight: number`

                The weight of the embedding in the reciprocal ranking fusion.

              - `text_weight: number`

                The weight of the text in the reciprocal ranking fusion.

            - `ranker?: "auto" | "default-2024-11-15"`

              The ranker to use for the file search.

              - `"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`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `type: "computer"`

            The type of the computer tool. Always `computer`.

            - `"computer"`

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `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.

            - `"windows"`

            - `"mac"`

            - `"linux"`

            - `"ubuntu"`

            - `"browser"`

          - `type: "computer_use_preview"`

            The type of the computer use tool. Always `computer_use_preview`.

            - `"computer_use_preview"`

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

          - `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`.

            - `"web_search"`

            - `"web_search_2025_08_26"`

          - `external_web_access?: boolean`

            Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

          - `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.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `user_location?: UserLocation | null`

            The approximate location of the user. If omitted or null, defaults to the
            United States. To avoid this fallback, pass `{"type": "approximate"}` without
            location fields. To localize results, provide the relevant location fields.

            - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type?: "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

            - `"mcp"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools?: Array<string> | McpToolFilter | null`

            List of allowed tool names or a filter object.

            - `Array<string>`

            - `McpToolFilter`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

            This field is deprecated for models released after September 1, 2026.
            Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
            connect through a Secure MCP Tunnel.

            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`

            - `"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" | null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter`

              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`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                  it will match this filter.

                - `tool_names?: Array<string>`

                  List of allowed tool names.

              - `never?: Never`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

            `format: uri`

          - `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`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string | CodeInterpreterToolAuto`

            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.

            - `string`

            - `CodeInterpreterToolAuto`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids?: Array<string>`

                An optional list of uploaded files to make available to your code.

                `maxItems: 50`

              - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist`

                  - `allowed_domains: Array<string>`

                    A list of allowed domains when type is `allowlist`.

                    `minItems: 1`

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                    Optional domain-scoped secrets for allowlisted domains.

                    `minItems: 1`

                    - `domain: string`

                      The domain associated with the secret.

                      `minLength: 1`

                    - `name: string`

                      The name of the secret to inject for the domain.

                      `minLength: 1`

                    - `value: string`

                      The secret value to inject for the domain.

                      `minLength: 1`, `maxLength: 10485760`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action?: "generate" | "edit" | "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background?: "transparent" | "opaque" | "auto"`

            Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
            `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
            Transparent backgrounds are available for supported GPT Image models. For
            `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
            using `transparent`, set the output format to `png` or `webp`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `complexity?: "low" | "medium" | "high"`

            Computation spent planning the image, independently of rendering quality.
            Overrides the outer response's `reasoning.effort` for image generation.
            When omitted, inherits a supported outer reasoning effort or uses the
            image model's configured default.
            For SVG output, controls the reference image, not the SVG author's
            reasoning.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `frame_count?: number`

            Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

            `minimum: 2`, `maximum: 16`

          - `frame_duration_ms?: number`

            Duration of each GIF frame in milliseconds, rounded to 10 ms.
            Requires `output_format` to be `gif`. Default: 200.

            `minimum: 20`, `maximum: 2000`

          - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

            - `"high"`

            - `"low"`

          - `input_image_mask?: InputImageMask`

            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" | 9 more`

            The image generation model to use. One of `gpt-image-1-mini`,
            `gpt-image-1.5`, `gpt-image-2`,
            `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
            `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
            `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
            `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
            `gpt-image-2`.

            `gpt-image-1` was shut down on October 23, 2026. Use
            `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

            Deprecated values:

            - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

            - `(string & {})`

            - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              - `"gpt-image-1"`

              - `"gpt-image-1-mini"`

              - `"gpt-image-2"`

              - `"gpt-image-2-2026-04-21"`

              - `"gpt-image-2.5-sunburst"`

              - `"gpt-image-2.5-sunburst-2026-09-08"`

              - `"gpt-image-2.5-flare"`

              - `"gpt-image-2.5-flare-2026-09-08"`

              - `"gpt-image-2.6-sunburst"`

              - `"gpt-image-2.6-flare"`

              - `"gpt-image-1.5"`

              - `"chatgpt-image-latest"`

          - `moderation?: "auto" | "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression?: number`

            Compression level for the output image. Default: 100.

            `minimum: 0`, `maximum: 100`

          - `output_format?: "png" | "webp" | "jpeg" | 2 more`

            The output format of the generated image. One of `png`, `webp`, `jpeg`,
            `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
            that supports the selected format. GIF output does not support
            partial image streaming (`partial_images` greater than `0`),
            `input_image_mask`, or custom `output_compression`.
            Responses lifecycle events can still be streamed for GIF output.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

            - `"gif"`

            - `"svg"`

          - `partial_images?: number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            `minimum: 0`, `maximum: 3`

          - `quality?: "low" | "medium" | "high" | 3 more`

            The quality of the generated image. The GPT image models support `low`,
            `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
            including their `2026-09-08` snapshots, also support `xhigh` and `max`.
            Default: `auto`.

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

            - `"auto"`

          - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

            The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

            - `(string & {})`

            - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

          - `svg?: Svg`

            SVG author model settings. Requires `output_format` to be `svg`.
            When SVG model selection is enabled, omitting this object uses the
            outer response model. Otherwise, the default SVG author is used and
            explicit model overrides are unavailable.

            - `model?: string`

              `minLength: 1`

            - `reasoning?: Reasoning | null`

              Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

              - `effort?: "none" | "minimal" | "low" | 4 more`

                Controls how much effort the model should spend on reasoning for this request.

                - `"none"`

                - `"minimal"`

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

        - `LocalShell`

          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`.

            - `"local_shell"`

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

            - `BetaContainerAuto`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids?: Array<string>`

                An optional list of uploaded files to make available to your code.

                `maxItems: 50`

              - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled`

                - `BetaContainerNetworkPolicyAllowlist`

              - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

                An optional list of skills referenced by id or inline data.

                `maxItems: 200`

                - `BetaSkillReference`

                  - `skill_id: string`

                    The ID of the referenced skill.

                    `minLength: 1`, `maxLength: 64`

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version?: string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill`

                  - `description: string`

                    The description of the skill.

                  - `name: string`

                    The name of the skill.

                  - `source: BetaInlineSkillSource`

                    Inline skill payload

                    - `data: string`

                      Base64-encoded skill zip bundle.

                      `minLength: 1`, `maxLength: 70254592`

                    - `media_type: "application/zip"`

                      The media type of the inline skill payload. Must be `application/zip`.

                      - `"application/zip"`

                    - `type: "base64"`

                      The type of the inline skill source. Must be `base64`.

                      - `"base64"`

                  - `type: "inline"`

                    Defines an inline skill for this request.

                    - `"inline"`

            - `BetaLocalEnvironment`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills?: Array<BetaLocalSkill>`

                An optional list of skills.

                `maxItems: 200`

                - `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: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

            - `"custom"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `async?: boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `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 | Grammar`

            The input format for the custom tool. Default is unconstrained text.

            - `Text`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar`

              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`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `BetaToolSearchOutputNamespaceTool`

          Groups function/custom tools under a shared namespace.

          - `description: string`

            A description of the namespace shown to the model.

          - `name: string`

            The namespace name used in tool calls (for example, `crm`).

            `minLength: 1`

          - `tools: Array<Function | BetaCustomTool>`

            The function/custom tools loaded inside this namespace.

            `minItems: 1`

            - `Function`

              - `name: string`

                The name of the loaded function tool.

                `minLength: 1`, `maxLength: 128`

              - `type: "function"`

                - `"function"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `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`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `type: "namespace"`

            The type of the tool. Always `namespace`.

            - `"namespace"`

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"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.

            - `"server"`

            - `"client"`

          - `parameters?: unknown`

            Parameter schema for a client-executed tool search tool.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `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`.

            - `"web_search_preview"`

            - `"web_search_preview_2025_03_11"`

          - `search_content_types?: Array<"text" | "image">`

            - `"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.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `user_location?: UserLocation | null`

            The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

            - `type: "approximate"`

              The type of location approximation. Always `approximate`.

              - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `BetaApplyPatchTool`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The item type. Always `tool_search_output`.

        - `"tool_search_output"`

      - `id?: string | null`

        The unique ID of this tool search output.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id?: string | null`

        The unique ID of the tool search call generated by the model.

        `minLength: 1`, `maxLength: 64`

      - `execution?: "server" | "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status?: "in_progress" | "completed" | "incomplete" | null`

        The status of the tool search output.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `AdditionalTools`

      - `role: "developer"`

        The role that provided the additional tools. Only `developer` is supported.

        - `"developer"`

      - `tools: Array<BetaTool>`

        A list of additional tools made available at this item.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

        - `BetaFileSearchTool`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `BetaComputerTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

            - `"mcp"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools?: Array<string> | McpToolFilter | null`

            List of allowed tool names or a filter object.

            - `Array<string>`

            - `McpToolFilter`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

            This field is deprecated for models released after September 1, 2026.
            Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
            connect through a Secure MCP Tunnel.

            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`

            - `"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" | null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter`

              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`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                  it will match this filter.

                - `tool_names?: Array<string>`

                  List of allowed tool names.

              - `never?: Never`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

            `format: uri`

          - `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`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string | CodeInterpreterToolAuto`

            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.

            - `string`

            - `CodeInterpreterToolAuto`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids?: Array<string>`

                An optional list of uploaded files to make available to your code.

                `maxItems: 50`

              - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled`

                - `BetaContainerNetworkPolicyAllowlist`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action?: "generate" | "edit" | "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background?: "transparent" | "opaque" | "auto"`

            Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
            `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
            Transparent backgrounds are available for supported GPT Image models. For
            `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
            using `transparent`, set the output format to `png` or `webp`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `complexity?: "low" | "medium" | "high"`

            Computation spent planning the image, independently of rendering quality.
            Overrides the outer response's `reasoning.effort` for image generation.
            When omitted, inherits a supported outer reasoning effort or uses the
            image model's configured default.
            For SVG output, controls the reference image, not the SVG author's
            reasoning.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `frame_count?: number`

            Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

            `minimum: 2`, `maximum: 16`

          - `frame_duration_ms?: number`

            Duration of each GIF frame in milliseconds, rounded to 10 ms.
            Requires `output_format` to be `gif`. Default: 200.

            `minimum: 20`, `maximum: 2000`

          - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

            - `"high"`

            - `"low"`

          - `input_image_mask?: InputImageMask`

            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" | 9 more`

            The image generation model to use. One of `gpt-image-1-mini`,
            `gpt-image-1.5`, `gpt-image-2`,
            `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
            `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
            `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
            `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
            `gpt-image-2`.

            `gpt-image-1` was shut down on October 23, 2026. Use
            `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

            Deprecated values:

            - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

            - `(string & {})`

            - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              - `"gpt-image-1"`

              - `"gpt-image-1-mini"`

              - `"gpt-image-2"`

              - `"gpt-image-2-2026-04-21"`

              - `"gpt-image-2.5-sunburst"`

              - `"gpt-image-2.5-sunburst-2026-09-08"`

              - `"gpt-image-2.5-flare"`

              - `"gpt-image-2.5-flare-2026-09-08"`

              - `"gpt-image-2.6-sunburst"`

              - `"gpt-image-2.6-flare"`

              - `"gpt-image-1.5"`

              - `"chatgpt-image-latest"`

          - `moderation?: "auto" | "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression?: number`

            Compression level for the output image. Default: 100.

            `minimum: 0`, `maximum: 100`

          - `output_format?: "png" | "webp" | "jpeg" | 2 more`

            The output format of the generated image. One of `png`, `webp`, `jpeg`,
            `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
            that supports the selected format. GIF output does not support
            partial image streaming (`partial_images` greater than `0`),
            `input_image_mask`, or custom `output_compression`.
            Responses lifecycle events can still be streamed for GIF output.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

            - `"gif"`

            - `"svg"`

          - `partial_images?: number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            `minimum: 0`, `maximum: 3`

          - `quality?: "low" | "medium" | "high" | 3 more`

            The quality of the generated image. The GPT image models support `low`,
            `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
            including their `2026-09-08` snapshots, also support `xhigh` and `max`.
            Default: `auto`.

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

            - `"auto"`

          - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

            The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

            - `(string & {})`

            - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

          - `svg?: Svg`

            SVG author model settings. Requires `output_format` to be `svg`.
            When SVG model selection is enabled, omitting this object uses the
            outer response model. Otherwise, the default SVG author is used and
            explicit model overrides are unavailable.

            - `model?: string`

              `minLength: 1`

            - `reasoning?: Reasoning | null`

              Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

              - `effort?: "none" | "minimal" | "low" | 4 more`

                Controls how much effort the model should spend on reasoning for this request.

                - `"none"`

                - `"minimal"`

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

        - `LocalShell`

          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`.

            - `"local_shell"`

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

          - `description: string`

            A description of the namespace shown to the model.

          - `name: string`

            The namespace name used in tool calls (for example, `crm`).

            `minLength: 1`

          - `tools: Array<Function | BetaCustomTool>`

            The function/custom tools available inside this namespace.

            `minItems: 1`

            - `Function`

              - `name: string`

                `minLength: 1`, `maxLength: 128`

              - `type: "function"`

                - `"function"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `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`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `type: "namespace"`

            The type of the tool. Always `namespace`.

            - `"namespace"`

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `BetaApplyPatchTool`

          Allows the assistant to create, delete, or update files using unified diffs.

      - `type: "additional_tools"`

        The item type. Always `additional_tools`.

        - `"additional_tools"`

      - `id?: string | null`

        The unique ID of this additional tools item.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseConfigurationUpdateItemParam`

      An update to the conversation's response configuration. Supply reasoning,
      text, or both. Each setting stays in effect until a later update replaces it.

      - `type: "configuration_update"`

        The item type. Always `configuration_update`.

        - `"configuration_update"`

      - `id?: string | null`

        The unique ID of the configuration update item.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reasoning?: Reasoning`

        Updates to reasoning configuration. Only effort is supported.

        - `effort?: "none" | "minimal" | "low" | 4 more | null`

          The reasoning effort to use for subsequent responses until another
          configuration update replaces it.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

      - `text?: Text`

        The text output configuration for subsequent responses.

        - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

          Use a JSON schema for structured output or text to return to plain text.

          - `Text`

            Default response format. Used to generate text responses.

            - `type: "text"`

              The type of response format being defined. Always `text`.

              - `"text"`

          - `BetaResponseFormatTextJSONSchemaConfig`

            JSON Schema response format. Used to generate structured JSON responses.
            Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

            - `name: string`

              The name of the response format. Must be a-z, A-Z, 0-9, or contain
              underscores and dashes, with a maximum length of 64.

            - `schema: Record<string, unknown>`

              The schema for the response format, described as a JSON Schema object.
              Learn how to build JSON schemas [here](https://json-schema.org/).

            - `type: "json_schema"`

              The type of response format being defined. Always `json_schema`.

              - `"json_schema"`

            - `description?: string`

              A description of what the response format is for, used by the model to
              determine how to respond in the format.

            - `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](/api/docs/guides/structured-outputs).

    - `BetaResponseReasoningItem`

      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](/api/docs/guides/conversation-state).

      - `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`.

          - `"summary_text"`

      - `type: "reasoning"`

        The type of the object. Always `reasoning`.

        - `"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`.

          - `"reasoning_text"`

      - `encrypted_content?: string | null`

        The encrypted content of the reasoning item. This is populated by default
        for reasoning items returned by `POST /v1/responses` and WebSocket
        `response.create` requests.

        When streaming, use the completed reasoning item and its
        `encrypted_content` from the `response.output_item.done` event in
        subsequent requests. The `encrypted_content` in
        `response.output_item.added` may be incomplete. This is especially
        important when `store` is `false` or when using Zero Data Retention.

      - `status?: "in_progress" | "completed" | "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseCompactionItemParam`

      A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

      - `encrypted_content: string`

        The encrypted content of the compaction summary.

        `maxLength: 104857600`

      - `type: "compaction"`

        The type of the item. Always `compaction`.

        - `"compaction"`

      - `id?: string | null`

        The ID of the compaction item.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ImageGenerationCall`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"generating"`

        - `"failed"`

      - `type: "image_generation_call"`

        The type of the image generation call. Always `image_generation_call`.

        - `"image_generation_call"`

      - `action?: "generate" | "edit" | "auto" | null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background?: "transparent" | "opaque" | "auto" | null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error?: Error`

        Details of a moderation failure, when available.

        - `code: string | null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string | null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details?: ModerationDetails`

          Public details for a `moderation_blocked` error, when available.

          - `categories: Array<string>`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" | "output" | "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

        - `"gif"`

        - `"svg"`

      - `quality?: "low" | "medium" | "high" | 3 more | null`

        The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

        - `"auto"`

      - `revised_prompt?: string | null`

        The prompt that was used after any model prompt rewriting.

      - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `(string & {})`

        - `"1024x1024" | "1024x1536" | "1536x1024"`

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

      - `svg_usage?: SvgUsage`

        - `input_tokens: number`

        - `model: string`

        - `output_tokens: number`

        - `reasoning_tokens: number`

        - `total_tokens: number`

    - `BetaResponseCodeInterpreterToolCall`

      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 | Image> | null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs`

          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`.

            - `"logs"`

        - `Image`

          The image output from the code interpreter.

          - `type: "image"`

            The type of the output. Always `image`.

            - `"image"`

          - `url: string`

            The URL of the image output from the code interpreter.

            `format: uri`

      - `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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"interpreting"`

        - `"failed"`

      - `type: "code_interpreter_call"`

        The type of the code interpreter tool call. Always `code_interpreter_call`.

        - `"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`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: Action`

        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`.

          - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "local_shell_call"`

        The type of the local shell call. Always `local_shell_call`.

        - `"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`

      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`.

        - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall`

      A tool representing a request to execute one or more shell commands.

      - `action: Action`

        The shell commands and limits that describe how to run the tool call.

        - `commands: Array<string>`

          Ordered shell commands for the execution environment to run.

        - `max_output_length?: number | null`

          Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

        - `timeout_ms?: number | null`

          Maximum wall-clock time in milliseconds to allow the shell commands to run.

      - `call_id: string`

        The unique ID of the shell tool call generated by the model.

        `minLength: 1`, `maxLength: 64`

      - `type: "shell_call"`

        The type of the item. Always `shell_call`.

        - `"shell_call"`

      - `id?: string | null`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

        The environment to execute the shell commands in.

        - `BetaLocalEnvironment`

        - `BetaContainerReference`

      - `status?: "in_progress" | "completed" | "incomplete" | null`

        The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCallOutput`

      The streamed output items emitted by a shell tool call.

      - `call_id: string`

        The unique ID of the shell tool call generated by the model.

        `minLength: 1`, `maxLength: 64`

      - `output: Array<BetaResponseFunctionShellCallOutputContent>`

        Captured chunks of stdout and stderr output, along with their associated outcomes.

        - `outcome: Timeout | Exit`

          The exit or timeout outcome associated with this shell call.

          - `Timeout`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit`

            Indicates that the shell commands finished and returned an exit code.

            - `exit_code: number`

              The exit code returned by the shell process.

            - `type: "exit"`

              The outcome type. Always `exit`.

              - `"exit"`

        - `stderr: string`

          Captured stderr output for the shell call.

          `maxLength: 10485760`

        - `stdout: string`

          Captured stdout output for the shell call.

          `maxLength: 10485760`

      - `type: "shell_call_output"`

        The type of the item. Always `shell_call_output`.

        - `"shell_call_output"`

      - `id?: string | null`

        The unique ID of the shell tool call output. Populated when this item is returned via API.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `max_output_length?: number | null`

        The maximum number of UTF-8 characters captured for this shell call's combined output.

      - `status?: "in_progress" | "completed" | "incomplete" | null`

        The status of the shell call output.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ApplyPatchCall`

      A tool call representing a request to create, delete, or update files using diff patches.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

        `minLength: 1`, `maxLength: 64`

      - `operation: CreateFile | DeleteFile | UpdateFile`

        The specific create, delete, or update instruction for the apply_patch tool call.

        - `CreateFile`

          Instruction for creating a new file via the apply_patch tool.

          - `diff: string`

            Unified diff content to apply when creating the file.

            `maxLength: 10485760`

          - `path: string`

            Path of the file to create relative to the workspace root.

            `minLength: 1`

          - `type: "create_file"`

            The operation type. Always `create_file`.

            - `"create_file"`

        - `DeleteFile`

          Instruction for deleting an existing file via the apply_patch tool.

          - `path: string`

            Path of the file to delete relative to the workspace root.

            `minLength: 1`

          - `type: "delete_file"`

            The operation type. Always `delete_file`.

            - `"delete_file"`

        - `UpdateFile`

          Instruction for updating an existing file via the apply_patch tool.

          - `diff: string`

            Unified diff content to apply to the existing file.

            `maxLength: 10485760`

          - `path: string`

            Path of the file to update relative to the workspace root.

            `minLength: 1`

          - `type: "update_file"`

            The operation type. Always `update_file`.

            - `"update_file"`

      - `status: "in_progress" | "completed"`

        The status of the apply patch tool call. One of `in_progress` or `completed`.

        - `"in_progress"`

        - `"completed"`

      - `type: "apply_patch_call"`

        The type of the item. Always `apply_patch_call`.

        - `"apply_patch_call"`

      - `id?: string | null`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

    - `ApplyPatchCallOutput`

      The streamed output emitted by an apply patch tool call.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

        `minLength: 1`, `maxLength: 64`

      - `status: "completed" | "failed"`

        The status of the apply patch tool call output. One of `completed` or `failed`.

        - `"completed"`

        - `"failed"`

      - `type: "apply_patch_call_output"`

        The type of the item. Always `apply_patch_call_output`.

        - `"apply_patch_call_output"`

      - `id?: string | null`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `output?: string | null`

        Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

        `maxLength: 10485760`

    - `McpListTools`

      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`.

        - `"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`

      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`.

        - `"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`

      A response to an MCP approval request.

      - `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`.

        - `"mcp_approval_response"`

      - `id?: string | null`

        The unique ID of the 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.

    - `McpCall`

      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`.

        - `"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?: BetaMcpToolCallError | null`

        The error from the tool call, if any.

        - `McpProtocolError`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `BetaResponseCustomToolCallOutput`

      The output of a custom tool call from your code, being sent back to the model.

      - `call_id: string`

        The call ID, used to map this custom tool call output to a custom tool call.

      - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `string`

        - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          - `BetaResponseInputText`

            A text input to the model.

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile`

            A file input to the model.

      - `type: "custom_tool_call_output"`

        The type of the custom tool call output. Always `custom_tool_call_output`.

        - `"custom_tool_call_output"`

      - `id?: string`

        The unique ID of the custom tool call output 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 | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

    - `BetaResponseCustomToolCall`

      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`.

        - `"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.

      - `async?: boolean`

        Whether the custom tool call runs asynchronously.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace?: string`

        The namespace of the custom tool being called.

    - `CompactionTrigger`

      Compacts the current context. Must be the final input item.

      - `type: "compaction_trigger"`

        The type of the item. Always `compaction_trigger`.

        - `"compaction_trigger"`

      - `id?: string | null`

        The unique ID of this compaction trigger.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ItemReference`

      An internal identifier for an item to reference.

      - `id: string`

        The ID of the item to reference.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `type?: "item_reference" | null`

        The type of item to reference. Always `item_reference`.

        - `"item_reference"`

    - `Program`

      - `id: string`

        The unique ID of this program item.

      - `call_id: string`

        The stable call ID of the program item.

        `minLength: 1`, `maxLength: 64`

      - `code: string`

        The JavaScript source executed by programmatic tool calling.

        `maxLength: 10485760`

      - `fingerprint: string`

        Opaque program replay fingerprint that must be round-tripped.

        `maxLength: 10485760`

      - `type: "program"`

        The item type. Always `program`.

        - `"program"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput`

      - `id: string`

        The unique ID of this program output item.

      - `call_id: string`

        The call ID of the program item.

        `minLength: 1`, `maxLength: 64`

      - `result: string`

        The result produced by the program item.

        `maxLength: 10485760`

      - `status: "completed" | "incomplete"`

        The terminal status of the program output.

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The item type. Always `program_output`.

        - `"program_output"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

  - `response_id: string`

    The ID of the active response that should receive the input.

  - `type: "response.inject"`

    The event discriminator. Always `response.inject`.

    - `"response.inject"`

### Beta Response Inject Failed Event

- `BetaResponseInjectFailedEvent`

  Emitted when injected input could not be committed to a response. The event
  returns the uncommitted raw input so the client can retry it in another
  response when appropriate.

  - `error: Error`

    Information about why the input was not committed.

    - `code: "response_already_completed" | "response_not_found"`

      A machine-readable error code.

      - `"response_already_completed"`

      - `"response_not_found"`

    - `message: string`

      A human-readable description of the error.

  - `input: Array<BetaResponseInputItem>`

    The raw input items that were not committed.

    - `BetaEasyInputMessage`

      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.

        - `string`

        - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

          A list of one or many input items to the model, containing different content
          types.

          - `BetaResponseInputText`

            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`.

              - `"input_text"`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `detail: BetaImageDetail`

              The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

              - `"low"`

              - `"high"`

              - `"auto"`

              - `"original"`

            - `type: "input_image"`

              The type of the input item. Always `input_image`.

              - `"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.

              `format: uri`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFile`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"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`.

              - `"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.

              `format: uri`

            - `filename?: string`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

      - `role: "user" | "assistant" | "system" | "developer"`

        The role of the message input. One of `user`, `assistant`, `system`, or
        `developer`.

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"developer"`

      - `phase?: "commentary" | "final_answer" | 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.

        - `"commentary"`

        - `"final_answer"`

      - `type?: "message"`

        The type of the message input. Always `message`.

        - `"message"`

    - `Message`

      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.

      - `content: BetaResponseInputMessageContentList`

        A list of one or many input items to the model, containing different content
        types.

      - `role: "user" | "system" | "developer"`

        The role of the message input. One of `user`, `system`, or `developer`.

        - `"user"`

        - `"system"`

        - `"developer"`

      - `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"`

        The status of item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type?: "message"`

        The type of the message input. Always set to `message`.

        - `"message"`

    - `BetaResponseOutputMessage`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

        The content of the output message.

        - `BetaResponseOutputText`

          A text output from the model.

          - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

            The annotations of the text output.

            - `FileCitation`

              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 in the output text at which to insert the file citation.

              - `type: "file_citation"`

                The type of the file citation. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation`

              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_citation"`

              - `url: string`

                The URL of the web resource.

                `format: uri`

            - `ContainerFileCitation`

              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`.

                - `"container_file_citation"`

            - `FilePath`

              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`.

                - `"file_path"`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

          - `logprobs?: Array<Logprob>`

            - `token: string`

            - `bytes: Array<number>`

            - `logprob: number`

            - `top_logprobs: Array<TopLogprob>`

              - `token: string`

              - `bytes: Array<number>`

              - `logprob: number`

        - `BetaResponseOutputRefusal`

          A refusal from the model.

          - `refusal: string`

            The refusal explanation from the model.

          - `type: "refusal"`

            The type of the refusal. Always `refusal`.

            - `"refusal"`

      - `role: "assistant"`

        The role of the output message. Always `assistant`.

        - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "message"`

        The type of the output message. Always `message`.

        - `"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" | "final_answer" | 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.

        - `"commentary"`

        - `"final_answer"`

    - `BetaResponseFileSearchToolCall`

      The results of a file search tool call. See the
      [file search guide](/api/docs/guides/tools-file-search) 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`,

        - `"in_progress"`

        - `"searching"`

        - `"completed"`

        - `"incomplete"`

        - `"failed"`

      - `type: "file_search_call"`

        The type of the file search tool call. Always `file_search_call`.

        - `"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.

          - `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.

          `format: float`

        - `text?: string`

          The text that was retrieved from the file.

    - `BetaResponseComputerToolCall`

      A tool call to a computer use tool. See the
      [computer use guide](/api/docs/guides/tools-computer-use) 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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "computer_call"`

        The type of the computer call. Always `computer_call`.

        - `"computer_call"`

      - `action?: BetaComputerAction`

        A click action.

        - `Click`

          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`.

            - `"left"`

            - `"right"`

            - `"wheel"`

            - `"back"`

            - `"forward"`

          - `type: "click"`

            Specifies the event type. For a click action, this property is always `click`.

            - `"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`

          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`.

            - `"double_click"`

          - `x: number`

            The x-coordinate where the double click occurred.

          - `y: number`

            The y-coordinate where the double click occurred.

        - `Drag`

          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`.

            - `"drag"`

          - `keys?: Array<string> | null`

            The keys being held while dragging the mouse.

        - `Keypress`

          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`.

            - `"keypress"`

        - `Move`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"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`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll`

          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`.

            - `"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`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions?: BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click`

          A click action.

        - `DoubleClick`

          A double click action.

        - `Drag`

          A drag action.

        - `Keypress`

          A collection of keypresses the model would like to perform.

        - `Move`

          A mouse move action.

        - `Screenshot`

          A screenshot action.

        - `Scroll`

          A scroll action.

        - `Type`

          An action to type in text.

        - `Wait`

          A wait action.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput`

      The output of a computer tool call.

      - `call_id: string`

        The ID of the computer tool call that produced the output.

        `minLength: 1`, `maxLength: 64`

      - `output: BetaResponseComputerToolCallOutputScreenshot`

        A computer screenshot image used with the computer use tool.

        - `type: "computer_screenshot"`

          Specifies the event type. For a computer screenshot, this property is
          always set to `computer_screenshot`.

          - `"computer_screenshot"`

        - `file_id?: string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url?: string`

          The URL of the screenshot image.

          `format: uri`

      - `type: "computer_call_output"`

        The type of the computer tool call output. Always `computer_call_output`.

        - `"computer_call_output"`

      - `id?: string | null`

        The ID of the computer tool call output.

      - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

        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.

      - `status?: "in_progress" | "completed" | "incomplete" | null`

        The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseFunctionWebSearch`

      The results of a web search tool call. See the
      [web search guide](/api/docs/guides/tools-web-search) for more information.

      - `id: string`

        The unique ID of the web search tool call.

      - `action: Search | OpenPage | FindInPage`

        An object describing the specific action taken in this web search call.
        Includes details on how the model used the web (search, open_page, find_in_page).

        - `Search`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries?: Array<string>`

            The search queries.

          - `query?: string`

            The search query.

          - `sources?: Array<Source>`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

              `format: uri`

        - `OpenPage`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url?: string | null`

            The URL opened by the model.

            `format: uri`

        - `FindInPage`

          Action type "find_in_page": Searches for a pattern within a loaded page.

          - `pattern: string`

            The pattern or text to search for within the page.

          - `type: "find_in_page"`

            The action type.

            - `"find_in_page"`

          - `url: string`

            The URL of the page searched for the pattern.

            `format: uri`

      - `status: "in_progress" | "searching" | "completed" | 2 more`

        The status of the web search tool call.

        - `"in_progress"`

        - `"searching"`

        - `"completed"`

        - `"failed"`

        - `"incomplete"`

      - `type: "web_search_call"`

        The type of the web search tool call. Always `web_search_call`.

        - `"web_search_call"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseFunctionToolCall`

      A tool call to run a function. See the
      [function calling guide](/api/docs/guides/function-calling) 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`.

        - `"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.

      - `async?: boolean`

        Whether the function tool call runs asynchronously.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `FunctionCallOutput`

      The output of a function tool call.

      - `output: string | BetaResponseFunctionCallOutputItemList`

        Text, image, or file output of the function tool call.

        - `string`

        - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

          An array of content outputs (text, image, file) for the function tool call.

          - `BetaResponseInputTextContent`

            A text input to the model.

            - `text: string`

              The text input to the model.

              `maxLength: 10485760`

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputImageContent`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `type: "input_image"`

              The type of the input item. Always `input_image`.

              - `"input_image"`

            - `detail?: BetaImageDetail | null`

              The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

            - `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.

              `maxLength: 20971520`, `format: uri`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFileContent`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"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`.

              - `"auto"`

              - `"low"`

              - `"high"`

            - `file_data?: string | null`

              The base64-encoded data of the file to be sent to the model.

              `maxLength: 73400320`

            - `file_id?: string | null`

              The ID of the file to be sent to the model.

            - `file_url?: string | null`

              The URL of the file to be sent to the model.

              `format: uri`

            - `filename?: string | null`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

      - `type: "function_call_output"`

        The type of the function tool call output. Always `function_call_output`.

        - `"function_call_output"`

      - `id?: string | null`

        The unique ID of the function tool call output. Populated when this item is returned via API.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id?: string | null`

        The unique ID of the function tool call generated by the model.

        `minLength: 1`, `maxLength: 64`

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `name?: string | null`

        The name of the tool that produced the output.

        `minLength: 1`, `maxLength: 128`

      - `namespace?: string | null`

        The namespace of the tool that produced the output.

        `minLength: 1`, `maxLength: 128`

      - `status?: "in_progress" | "completed" | "incomplete" | null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `AgentMessage`

      A message routed between agents.

      - `author: string`

        The sending agent identity.

      - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

        Plaintext, image, or encrypted content sent between agents.

        - `BetaResponseInputTextContent`

          A text input to the model.

        - `BetaResponseInputImageContent`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

        - `EncryptedContent`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

            `maxLength: 10485760`

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The item type. Always `agent_message`.

        - `"agent_message"`

      - `id?: string | null`

        The unique ID of this agent message item.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall`

      - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

        The multi-agent action that was executed.

        - `"spawn_agent"`

        - `"interrupt_agent"`

        - `"list_agents"`

        - `"send_message"`

        - `"followup_task"`

        - `"wait_agent"`

      - `arguments: string`

        The action arguments as a JSON string.

      - `call_id: string`

        The unique ID linking this call to its output.

        `minLength: 1`, `maxLength: 64`

      - `type: "multi_agent_call"`

        The item type. Always `multi_agent_call`.

        - `"multi_agent_call"`

      - `id?: string | null`

        The unique ID of this multi-agent call.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput`

      - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

        The multi-agent action that produced this result.

        - `"spawn_agent"`

        - `"interrupt_agent"`

        - `"list_agents"`

        - `"send_message"`

        - `"followup_task"`

        - `"wait_agent"`

      - `call_id: string`

        The unique ID of the multi-agent call.

        `minLength: 1`, `maxLength: 64`

      - `output: Array<Output>`

        Text output returned by the multi-agent action.

        - `text: string`

          The text content.

          `maxLength: 10485760`

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

        - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

          Citations associated with the text content.

          - `FileCitation`

            - `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.

              `minimum: 0`

            - `type: "file_citation"`

              The citation type. Always `file_citation`.

              - `"file_citation"`

          - `URLCitation`

            - `end_index: number`

              The index of the last character of the citation in the message.

              `minimum: 0`

            - `start_index: number`

              The index of the first character of the citation in the message.

              `minimum: 0`

            - `title: string`

              The title of the cited resource.

            - `type: "url_citation"`

              The citation type. Always `url_citation`.

              - `"url_citation"`

            - `url: string`

              The URL of the cited resource.

              `format: uri`

          - `ContainerFileCitation`

            - `container_id: string`

              The ID of the container.

            - `end_index: number`

              The index of the last character of the citation in the message.

              `minimum: 0`

            - `file_id: string`

              The ID of the container file.

            - `filename: string`

              The filename of the container file cited.

            - `start_index: number`

              The index of the first character of the citation in the message.

              `minimum: 0`

            - `type: "container_file_citation"`

              The citation type. Always `container_file_citation`.

              - `"container_file_citation"`

      - `type: "multi_agent_call_output"`

        The item type. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `id?: string | null`

        The unique ID of this multi-agent call output.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall`

      - `arguments: unknown`

        The arguments supplied to the tool search call.

      - `type: "tool_search_call"`

        The item type. Always `tool_search_call`.

        - `"tool_search_call"`

      - `id?: string | null`

        The unique ID of this tool search call.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id?: string | null`

        The unique ID of the tool search call generated by the model.

        `minLength: 1`, `maxLength: 64`

      - `execution?: "server" | "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status?: "in_progress" | "completed" | "incomplete" | null`

        The status of the tool search call.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseToolSearchOutputItemParam`

      - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

        The loaded tool definitions returned by the tool search output.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

            - `"function"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async?: boolean`

          - `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`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `type: "file_search"`

            The type of the file search tool. Always `file_search`.

            - `"file_search"`

          - `vector_store_ids: Array<string>`

            The IDs of the vector stores to search.

          - `filters?: ComparisonFilter | CompoundFilter | null`

            A filter to apply.

            - `ComparisonFilter`

              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

                - `"eq"`

                - `"ne"`

                - `"gt"`

                - `"gte"`

                - `"lt"`

                - `"lte"`

                - `"in"`

                - `"nin"`

              - `value: string | number | boolean | Array<string | number>`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `Array<string | number>`

                  - `string`

                  - `number`

            - `CompoundFilter`

              Combine multiple filters using `and` or `or`.

              - `filters: Array<ComparisonFilter | unknown>`

                Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

                - `ComparisonFilter`

                  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

                    - `"eq"`

                    - `"ne"`

                    - `"gt"`

                    - `"gte"`

                    - `"lt"`

                    - `"lte"`

                    - `"in"`

                    - `"nin"`

                  - `value: string | number | boolean | Array<string | number>`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `Array<string | number>`

                      - `string`

                      - `number`

                - `unknown`

              - `type: "and" | "or"`

                Type of operation: `and` or `or`.

                - `"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`

            Ranking options for search.

            - `hybrid_search?: HybridSearch`

              Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

              - `embedding_weight: number`

                The weight of the embedding in the reciprocal ranking fusion.

              - `text_weight: number`

                The weight of the text in the reciprocal ranking fusion.

            - `ranker?: "auto" | "default-2024-11-15"`

              The ranker to use for the file search.

              - `"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`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `type: "computer"`

            The type of the computer tool. Always `computer`.

            - `"computer"`

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `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.

            - `"windows"`

            - `"mac"`

            - `"linux"`

            - `"ubuntu"`

            - `"browser"`

          - `type: "computer_use_preview"`

            The type of the computer use tool. Always `computer_use_preview`.

            - `"computer_use_preview"`

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

          - `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`.

            - `"web_search"`

            - `"web_search_2025_08_26"`

          - `external_web_access?: boolean`

            Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

          - `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.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `user_location?: UserLocation | null`

            The approximate location of the user. If omitted or null, defaults to the
            United States. To avoid this fallback, pass `{"type": "approximate"}` without
            location fields. To localize results, provide the relevant location fields.

            - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type?: "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

            - `"mcp"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools?: Array<string> | McpToolFilter | null`

            List of allowed tool names or a filter object.

            - `Array<string>`

            - `McpToolFilter`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

            This field is deprecated for models released after September 1, 2026.
            Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
            connect through a Secure MCP Tunnel.

            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`

            - `"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" | null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter`

              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`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                  it will match this filter.

                - `tool_names?: Array<string>`

                  List of allowed tool names.

              - `never?: Never`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

            `format: uri`

          - `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`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string | CodeInterpreterToolAuto`

            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.

            - `string`

            - `CodeInterpreterToolAuto`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids?: Array<string>`

                An optional list of uploaded files to make available to your code.

                `maxItems: 50`

              - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist`

                  - `allowed_domains: Array<string>`

                    A list of allowed domains when type is `allowlist`.

                    `minItems: 1`

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                    Optional domain-scoped secrets for allowlisted domains.

                    `minItems: 1`

                    - `domain: string`

                      The domain associated with the secret.

                      `minLength: 1`

                    - `name: string`

                      The name of the secret to inject for the domain.

                      `minLength: 1`

                    - `value: string`

                      The secret value to inject for the domain.

                      `minLength: 1`, `maxLength: 10485760`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action?: "generate" | "edit" | "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background?: "transparent" | "opaque" | "auto"`

            Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
            `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
            Transparent backgrounds are available for supported GPT Image models. For
            `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
            using `transparent`, set the output format to `png` or `webp`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `complexity?: "low" | "medium" | "high"`

            Computation spent planning the image, independently of rendering quality.
            Overrides the outer response's `reasoning.effort` for image generation.
            When omitted, inherits a supported outer reasoning effort or uses the
            image model's configured default.
            For SVG output, controls the reference image, not the SVG author's
            reasoning.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `frame_count?: number`

            Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

            `minimum: 2`, `maximum: 16`

          - `frame_duration_ms?: number`

            Duration of each GIF frame in milliseconds, rounded to 10 ms.
            Requires `output_format` to be `gif`. Default: 200.

            `minimum: 20`, `maximum: 2000`

          - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

            - `"high"`

            - `"low"`

          - `input_image_mask?: InputImageMask`

            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" | 9 more`

            The image generation model to use. One of `gpt-image-1-mini`,
            `gpt-image-1.5`, `gpt-image-2`,
            `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
            `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
            `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
            `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
            `gpt-image-2`.

            `gpt-image-1` was shut down on October 23, 2026. Use
            `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

            Deprecated values:

            - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

            - `(string & {})`

            - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              - `"gpt-image-1"`

              - `"gpt-image-1-mini"`

              - `"gpt-image-2"`

              - `"gpt-image-2-2026-04-21"`

              - `"gpt-image-2.5-sunburst"`

              - `"gpt-image-2.5-sunburst-2026-09-08"`

              - `"gpt-image-2.5-flare"`

              - `"gpt-image-2.5-flare-2026-09-08"`

              - `"gpt-image-2.6-sunburst"`

              - `"gpt-image-2.6-flare"`

              - `"gpt-image-1.5"`

              - `"chatgpt-image-latest"`

          - `moderation?: "auto" | "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression?: number`

            Compression level for the output image. Default: 100.

            `minimum: 0`, `maximum: 100`

          - `output_format?: "png" | "webp" | "jpeg" | 2 more`

            The output format of the generated image. One of `png`, `webp`, `jpeg`,
            `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
            that supports the selected format. GIF output does not support
            partial image streaming (`partial_images` greater than `0`),
            `input_image_mask`, or custom `output_compression`.
            Responses lifecycle events can still be streamed for GIF output.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

            - `"gif"`

            - `"svg"`

          - `partial_images?: number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            `minimum: 0`, `maximum: 3`

          - `quality?: "low" | "medium" | "high" | 3 more`

            The quality of the generated image. The GPT image models support `low`,
            `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
            including their `2026-09-08` snapshots, also support `xhigh` and `max`.
            Default: `auto`.

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

            - `"auto"`

          - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

            The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

            - `(string & {})`

            - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

          - `svg?: Svg`

            SVG author model settings. Requires `output_format` to be `svg`.
            When SVG model selection is enabled, omitting this object uses the
            outer response model. Otherwise, the default SVG author is used and
            explicit model overrides are unavailable.

            - `model?: string`

              `minLength: 1`

            - `reasoning?: Reasoning | null`

              Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

              - `effort?: "none" | "minimal" | "low" | 4 more`

                Controls how much effort the model should spend on reasoning for this request.

                - `"none"`

                - `"minimal"`

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

        - `LocalShell`

          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`.

            - `"local_shell"`

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

            - `BetaContainerAuto`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids?: Array<string>`

                An optional list of uploaded files to make available to your code.

                `maxItems: 50`

              - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled`

                - `BetaContainerNetworkPolicyAllowlist`

              - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

                An optional list of skills referenced by id or inline data.

                `maxItems: 200`

                - `BetaSkillReference`

                  - `skill_id: string`

                    The ID of the referenced skill.

                    `minLength: 1`, `maxLength: 64`

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version?: string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill`

                  - `description: string`

                    The description of the skill.

                  - `name: string`

                    The name of the skill.

                  - `source: BetaInlineSkillSource`

                    Inline skill payload

                    - `data: string`

                      Base64-encoded skill zip bundle.

                      `minLength: 1`, `maxLength: 70254592`

                    - `media_type: "application/zip"`

                      The media type of the inline skill payload. Must be `application/zip`.

                      - `"application/zip"`

                    - `type: "base64"`

                      The type of the inline skill source. Must be `base64`.

                      - `"base64"`

                  - `type: "inline"`

                    Defines an inline skill for this request.

                    - `"inline"`

            - `BetaLocalEnvironment`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills?: Array<BetaLocalSkill>`

                An optional list of skills.

                `maxItems: 200`

                - `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: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

            - `"custom"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `async?: boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `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 | Grammar`

            The input format for the custom tool. Default is unconstrained text.

            - `Text`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar`

              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`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `BetaToolSearchOutputNamespaceTool`

          Groups function/custom tools under a shared namespace.

          - `description: string`

            A description of the namespace shown to the model.

          - `name: string`

            The namespace name used in tool calls (for example, `crm`).

            `minLength: 1`

          - `tools: Array<Function | BetaCustomTool>`

            The function/custom tools loaded inside this namespace.

            `minItems: 1`

            - `Function`

              - `name: string`

                The name of the loaded function tool.

                `minLength: 1`, `maxLength: 128`

              - `type: "function"`

                - `"function"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `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`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `type: "namespace"`

            The type of the tool. Always `namespace`.

            - `"namespace"`

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"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.

            - `"server"`

            - `"client"`

          - `parameters?: unknown`

            Parameter schema for a client-executed tool search tool.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `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`.

            - `"web_search_preview"`

            - `"web_search_preview_2025_03_11"`

          - `search_content_types?: Array<"text" | "image">`

            - `"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.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `user_location?: UserLocation | null`

            The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

            - `type: "approximate"`

              The type of location approximation. Always `approximate`.

              - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `BetaApplyPatchTool`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The item type. Always `tool_search_output`.

        - `"tool_search_output"`

      - `id?: string | null`

        The unique ID of this tool search output.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id?: string | null`

        The unique ID of the tool search call generated by the model.

        `minLength: 1`, `maxLength: 64`

      - `execution?: "server" | "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status?: "in_progress" | "completed" | "incomplete" | null`

        The status of the tool search output.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `AdditionalTools`

      - `role: "developer"`

        The role that provided the additional tools. Only `developer` is supported.

        - `"developer"`

      - `tools: Array<BetaTool>`

        A list of additional tools made available at this item.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

        - `BetaFileSearchTool`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `BetaComputerTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

            - `"mcp"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools?: Array<string> | McpToolFilter | null`

            List of allowed tool names or a filter object.

            - `Array<string>`

            - `McpToolFilter`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

            This field is deprecated for models released after September 1, 2026.
            Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
            connect through a Secure MCP Tunnel.

            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`

            - `"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" | null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter`

              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`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                  it will match this filter.

                - `tool_names?: Array<string>`

                  List of allowed tool names.

              - `never?: Never`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

            `format: uri`

          - `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`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string | CodeInterpreterToolAuto`

            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.

            - `string`

            - `CodeInterpreterToolAuto`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids?: Array<string>`

                An optional list of uploaded files to make available to your code.

                `maxItems: 50`

              - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled`

                - `BetaContainerNetworkPolicyAllowlist`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action?: "generate" | "edit" | "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background?: "transparent" | "opaque" | "auto"`

            Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
            `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
            Transparent backgrounds are available for supported GPT Image models. For
            `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
            using `transparent`, set the output format to `png` or `webp`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `complexity?: "low" | "medium" | "high"`

            Computation spent planning the image, independently of rendering quality.
            Overrides the outer response's `reasoning.effort` for image generation.
            When omitted, inherits a supported outer reasoning effort or uses the
            image model's configured default.
            For SVG output, controls the reference image, not the SVG author's
            reasoning.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `frame_count?: number`

            Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

            `minimum: 2`, `maximum: 16`

          - `frame_duration_ms?: number`

            Duration of each GIF frame in milliseconds, rounded to 10 ms.
            Requires `output_format` to be `gif`. Default: 200.

            `minimum: 20`, `maximum: 2000`

          - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

            - `"high"`

            - `"low"`

          - `input_image_mask?: InputImageMask`

            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" | 9 more`

            The image generation model to use. One of `gpt-image-1-mini`,
            `gpt-image-1.5`, `gpt-image-2`,
            `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
            `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
            `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
            `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
            `gpt-image-2`.

            `gpt-image-1` was shut down on October 23, 2026. Use
            `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

            Deprecated values:

            - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

            - `(string & {})`

            - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              - `"gpt-image-1"`

              - `"gpt-image-1-mini"`

              - `"gpt-image-2"`

              - `"gpt-image-2-2026-04-21"`

              - `"gpt-image-2.5-sunburst"`

              - `"gpt-image-2.5-sunburst-2026-09-08"`

              - `"gpt-image-2.5-flare"`

              - `"gpt-image-2.5-flare-2026-09-08"`

              - `"gpt-image-2.6-sunburst"`

              - `"gpt-image-2.6-flare"`

              - `"gpt-image-1.5"`

              - `"chatgpt-image-latest"`

          - `moderation?: "auto" | "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression?: number`

            Compression level for the output image. Default: 100.

            `minimum: 0`, `maximum: 100`

          - `output_format?: "png" | "webp" | "jpeg" | 2 more`

            The output format of the generated image. One of `png`, `webp`, `jpeg`,
            `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
            that supports the selected format. GIF output does not support
            partial image streaming (`partial_images` greater than `0`),
            `input_image_mask`, or custom `output_compression`.
            Responses lifecycle events can still be streamed for GIF output.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

            - `"gif"`

            - `"svg"`

          - `partial_images?: number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            `minimum: 0`, `maximum: 3`

          - `quality?: "low" | "medium" | "high" | 3 more`

            The quality of the generated image. The GPT image models support `low`,
            `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
            including their `2026-09-08` snapshots, also support `xhigh` and `max`.
            Default: `auto`.

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

            - `"auto"`

          - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

            The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

            - `(string & {})`

            - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

          - `svg?: Svg`

            SVG author model settings. Requires `output_format` to be `svg`.
            When SVG model selection is enabled, omitting this object uses the
            outer response model. Otherwise, the default SVG author is used and
            explicit model overrides are unavailable.

            - `model?: string`

              `minLength: 1`

            - `reasoning?: Reasoning | null`

              Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

              - `effort?: "none" | "minimal" | "low" | 4 more`

                Controls how much effort the model should spend on reasoning for this request.

                - `"none"`

                - `"minimal"`

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

        - `LocalShell`

          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`.

            - `"local_shell"`

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

          - `description: string`

            A description of the namespace shown to the model.

          - `name: string`

            The namespace name used in tool calls (for example, `crm`).

            `minLength: 1`

          - `tools: Array<Function | BetaCustomTool>`

            The function/custom tools available inside this namespace.

            `minItems: 1`

            - `Function`

              - `name: string`

                `minLength: 1`, `maxLength: 128`

              - `type: "function"`

                - `"function"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `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`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `type: "namespace"`

            The type of the tool. Always `namespace`.

            - `"namespace"`

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `BetaApplyPatchTool`

          Allows the assistant to create, delete, or update files using unified diffs.

      - `type: "additional_tools"`

        The item type. Always `additional_tools`.

        - `"additional_tools"`

      - `id?: string | null`

        The unique ID of this additional tools item.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseConfigurationUpdateItemParam`

      An update to the conversation's response configuration. Supply reasoning,
      text, or both. Each setting stays in effect until a later update replaces it.

      - `type: "configuration_update"`

        The item type. Always `configuration_update`.

        - `"configuration_update"`

      - `id?: string | null`

        The unique ID of the configuration update item.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reasoning?: Reasoning`

        Updates to reasoning configuration. Only effort is supported.

        - `effort?: "none" | "minimal" | "low" | 4 more | null`

          The reasoning effort to use for subsequent responses until another
          configuration update replaces it.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

      - `text?: Text`

        The text output configuration for subsequent responses.

        - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

          Use a JSON schema for structured output or text to return to plain text.

          - `Text`

            Default response format. Used to generate text responses.

            - `type: "text"`

              The type of response format being defined. Always `text`.

              - `"text"`

          - `BetaResponseFormatTextJSONSchemaConfig`

            JSON Schema response format. Used to generate structured JSON responses.
            Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

            - `name: string`

              The name of the response format. Must be a-z, A-Z, 0-9, or contain
              underscores and dashes, with a maximum length of 64.

            - `schema: Record<string, unknown>`

              The schema for the response format, described as a JSON Schema object.
              Learn how to build JSON schemas [here](https://json-schema.org/).

            - `type: "json_schema"`

              The type of response format being defined. Always `json_schema`.

              - `"json_schema"`

            - `description?: string`

              A description of what the response format is for, used by the model to
              determine how to respond in the format.

            - `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](/api/docs/guides/structured-outputs).

    - `BetaResponseReasoningItem`

      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](/api/docs/guides/conversation-state).

      - `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`.

          - `"summary_text"`

      - `type: "reasoning"`

        The type of the object. Always `reasoning`.

        - `"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`.

          - `"reasoning_text"`

      - `encrypted_content?: string | null`

        The encrypted content of the reasoning item. This is populated by default
        for reasoning items returned by `POST /v1/responses` and WebSocket
        `response.create` requests.

        When streaming, use the completed reasoning item and its
        `encrypted_content` from the `response.output_item.done` event in
        subsequent requests. The `encrypted_content` in
        `response.output_item.added` may be incomplete. This is especially
        important when `store` is `false` or when using Zero Data Retention.

      - `status?: "in_progress" | "completed" | "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseCompactionItemParam`

      A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

      - `encrypted_content: string`

        The encrypted content of the compaction summary.

        `maxLength: 104857600`

      - `type: "compaction"`

        The type of the item. Always `compaction`.

        - `"compaction"`

      - `id?: string | null`

        The ID of the compaction item.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ImageGenerationCall`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"generating"`

        - `"failed"`

      - `type: "image_generation_call"`

        The type of the image generation call. Always `image_generation_call`.

        - `"image_generation_call"`

      - `action?: "generate" | "edit" | "auto" | null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background?: "transparent" | "opaque" | "auto" | null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error?: Error`

        Details of a moderation failure, when available.

        - `code: string | null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string | null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details?: ModerationDetails`

          Public details for a `moderation_blocked` error, when available.

          - `categories: Array<string>`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" | "output" | "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

        - `"gif"`

        - `"svg"`

      - `quality?: "low" | "medium" | "high" | 3 more | null`

        The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

        - `"auto"`

      - `revised_prompt?: string | null`

        The prompt that was used after any model prompt rewriting.

      - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `(string & {})`

        - `"1024x1024" | "1024x1536" | "1536x1024"`

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

      - `svg_usage?: SvgUsage`

        - `input_tokens: number`

        - `model: string`

        - `output_tokens: number`

        - `reasoning_tokens: number`

        - `total_tokens: number`

    - `BetaResponseCodeInterpreterToolCall`

      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 | Image> | null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs`

          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`.

            - `"logs"`

        - `Image`

          The image output from the code interpreter.

          - `type: "image"`

            The type of the output. Always `image`.

            - `"image"`

          - `url: string`

            The URL of the image output from the code interpreter.

            `format: uri`

      - `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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"interpreting"`

        - `"failed"`

      - `type: "code_interpreter_call"`

        The type of the code interpreter tool call. Always `code_interpreter_call`.

        - `"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`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: Action`

        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`.

          - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "local_shell_call"`

        The type of the local shell call. Always `local_shell_call`.

        - `"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`

      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`.

        - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall`

      A tool representing a request to execute one or more shell commands.

      - `action: Action`

        The shell commands and limits that describe how to run the tool call.

        - `commands: Array<string>`

          Ordered shell commands for the execution environment to run.

        - `max_output_length?: number | null`

          Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

        - `timeout_ms?: number | null`

          Maximum wall-clock time in milliseconds to allow the shell commands to run.

      - `call_id: string`

        The unique ID of the shell tool call generated by the model.

        `minLength: 1`, `maxLength: 64`

      - `type: "shell_call"`

        The type of the item. Always `shell_call`.

        - `"shell_call"`

      - `id?: string | null`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

        The environment to execute the shell commands in.

        - `BetaLocalEnvironment`

        - `BetaContainerReference`

      - `status?: "in_progress" | "completed" | "incomplete" | null`

        The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCallOutput`

      The streamed output items emitted by a shell tool call.

      - `call_id: string`

        The unique ID of the shell tool call generated by the model.

        `minLength: 1`, `maxLength: 64`

      - `output: Array<BetaResponseFunctionShellCallOutputContent>`

        Captured chunks of stdout and stderr output, along with their associated outcomes.

        - `outcome: Timeout | Exit`

          The exit or timeout outcome associated with this shell call.

          - `Timeout`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit`

            Indicates that the shell commands finished and returned an exit code.

            - `exit_code: number`

              The exit code returned by the shell process.

            - `type: "exit"`

              The outcome type. Always `exit`.

              - `"exit"`

        - `stderr: string`

          Captured stderr output for the shell call.

          `maxLength: 10485760`

        - `stdout: string`

          Captured stdout output for the shell call.

          `maxLength: 10485760`

      - `type: "shell_call_output"`

        The type of the item. Always `shell_call_output`.

        - `"shell_call_output"`

      - `id?: string | null`

        The unique ID of the shell tool call output. Populated when this item is returned via API.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `max_output_length?: number | null`

        The maximum number of UTF-8 characters captured for this shell call's combined output.

      - `status?: "in_progress" | "completed" | "incomplete" | null`

        The status of the shell call output.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ApplyPatchCall`

      A tool call representing a request to create, delete, or update files using diff patches.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

        `minLength: 1`, `maxLength: 64`

      - `operation: CreateFile | DeleteFile | UpdateFile`

        The specific create, delete, or update instruction for the apply_patch tool call.

        - `CreateFile`

          Instruction for creating a new file via the apply_patch tool.

          - `diff: string`

            Unified diff content to apply when creating the file.

            `maxLength: 10485760`

          - `path: string`

            Path of the file to create relative to the workspace root.

            `minLength: 1`

          - `type: "create_file"`

            The operation type. Always `create_file`.

            - `"create_file"`

        - `DeleteFile`

          Instruction for deleting an existing file via the apply_patch tool.

          - `path: string`

            Path of the file to delete relative to the workspace root.

            `minLength: 1`

          - `type: "delete_file"`

            The operation type. Always `delete_file`.

            - `"delete_file"`

        - `UpdateFile`

          Instruction for updating an existing file via the apply_patch tool.

          - `diff: string`

            Unified diff content to apply to the existing file.

            `maxLength: 10485760`

          - `path: string`

            Path of the file to update relative to the workspace root.

            `minLength: 1`

          - `type: "update_file"`

            The operation type. Always `update_file`.

            - `"update_file"`

      - `status: "in_progress" | "completed"`

        The status of the apply patch tool call. One of `in_progress` or `completed`.

        - `"in_progress"`

        - `"completed"`

      - `type: "apply_patch_call"`

        The type of the item. Always `apply_patch_call`.

        - `"apply_patch_call"`

      - `id?: string | null`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

    - `ApplyPatchCallOutput`

      The streamed output emitted by an apply patch tool call.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

        `minLength: 1`, `maxLength: 64`

      - `status: "completed" | "failed"`

        The status of the apply patch tool call output. One of `completed` or `failed`.

        - `"completed"`

        - `"failed"`

      - `type: "apply_patch_call_output"`

        The type of the item. Always `apply_patch_call_output`.

        - `"apply_patch_call_output"`

      - `id?: string | null`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `output?: string | null`

        Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

        `maxLength: 10485760`

    - `McpListTools`

      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`.

        - `"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`

      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`.

        - `"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`

      A response to an MCP approval request.

      - `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`.

        - `"mcp_approval_response"`

      - `id?: string | null`

        The unique ID of the 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.

    - `McpCall`

      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`.

        - `"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?: BetaMcpToolCallError | null`

        The error from the tool call, if any.

        - `McpProtocolError`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `BetaResponseCustomToolCallOutput`

      The output of a custom tool call from your code, being sent back to the model.

      - `call_id: string`

        The call ID, used to map this custom tool call output to a custom tool call.

      - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `string`

        - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          - `BetaResponseInputText`

            A text input to the model.

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile`

            A file input to the model.

      - `type: "custom_tool_call_output"`

        The type of the custom tool call output. Always `custom_tool_call_output`.

        - `"custom_tool_call_output"`

      - `id?: string`

        The unique ID of the custom tool call output 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 | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

    - `BetaResponseCustomToolCall`

      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`.

        - `"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.

      - `async?: boolean`

        Whether the custom tool call runs asynchronously.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace?: string`

        The namespace of the custom tool being called.

    - `CompactionTrigger`

      Compacts the current context. Must be the final input item.

      - `type: "compaction_trigger"`

        The type of the item. Always `compaction_trigger`.

        - `"compaction_trigger"`

      - `id?: string | null`

        The unique ID of this compaction trigger.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ItemReference`

      An internal identifier for an item to reference.

      - `id: string`

        The ID of the item to reference.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `type?: "item_reference" | null`

        The type of item to reference. Always `item_reference`.

        - `"item_reference"`

    - `Program`

      - `id: string`

        The unique ID of this program item.

      - `call_id: string`

        The stable call ID of the program item.

        `minLength: 1`, `maxLength: 64`

      - `code: string`

        The JavaScript source executed by programmatic tool calling.

        `maxLength: 10485760`

      - `fingerprint: string`

        Opaque program replay fingerprint that must be round-tripped.

        `maxLength: 10485760`

      - `type: "program"`

        The item type. Always `program`.

        - `"program"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput`

      - `id: string`

        The unique ID of this program output item.

      - `call_id: string`

        The call ID of the program item.

        `minLength: 1`, `maxLength: 64`

      - `result: string`

        The result produced by the program item.

        `maxLength: 10485760`

      - `status: "completed" | "incomplete"`

        The terminal status of the program output.

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The item type. Always `program_output`.

        - `"program_output"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

  - `response_id: string`

    The ID of the response that rejected the input.

  - `sequence_number: number`

    The sequence number for this event.

  - `type: "response.inject.failed"`

    The event discriminator. Always `response.inject.failed`.

    - `"response.inject.failed"`

  - `stream_id?: string`

    The multiplexed WebSocket stream that emitted the event. This field is
    present only when WebSocket multiplexing is enabled separately.

### Beta Response Input

- `BetaResponseInput = Array<BetaResponseInputItem>`

  A list of one or many input items to the model, containing
  different content types.

  - `BetaEasyInputMessage`

    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.

      - `string`

      - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

        A list of one or many input items to the model, containing different content
        types.

        - `BetaResponseInputText`

          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`.

            - `"input_text"`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `detail: BetaImageDetail`

            The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

            - `"low"`

            - `"high"`

            - `"auto"`

            - `"original"`

          - `type: "input_image"`

            The type of the input item. Always `input_image`.

            - `"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.

            `format: uri`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputFile`

          A file input to the model.

          - `type: "input_file"`

            The type of the input item. Always `input_file`.

            - `"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`.

            - `"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.

            `format: uri`

          - `filename?: string`

            The name of the file to be sent to the model.

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

    - `role: "user" | "assistant" | "system" | "developer"`

      The role of the message input. One of `user`, `assistant`, `system`, or
      `developer`.

      - `"user"`

      - `"assistant"`

      - `"system"`

      - `"developer"`

    - `phase?: "commentary" | "final_answer" | 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.

      - `"commentary"`

      - `"final_answer"`

    - `type?: "message"`

      The type of the message input. Always `message`.

      - `"message"`

  - `Message`

    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.

    - `content: BetaResponseInputMessageContentList`

      A list of one or many input items to the model, containing different content
      types.

    - `role: "user" | "system" | "developer"`

      The role of the message input. One of `user`, `system`, or `developer`.

      - `"user"`

      - `"system"`

      - `"developer"`

    - `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"`

      The status of item. One of `in_progress`, `completed`, or
      `incomplete`. Populated when items are returned via API.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type?: "message"`

      The type of the message input. Always set to `message`.

      - `"message"`

  - `BetaResponseOutputMessage`

    An output message from the model.

    - `id: string`

      The unique ID of the output message.

    - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

      The content of the output message.

      - `BetaResponseOutputText`

        A text output from the model.

        - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

          The annotations of the text output.

          - `FileCitation`

            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 in the output text at which to insert the file citation.

            - `type: "file_citation"`

              The type of the file citation. Always `file_citation`.

              - `"file_citation"`

          - `URLCitation`

            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_citation"`

            - `url: string`

              The URL of the web resource.

              `format: uri`

          - `ContainerFileCitation`

            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`.

              - `"container_file_citation"`

          - `FilePath`

            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`.

              - `"file_path"`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

          - `"output_text"`

        - `logprobs?: Array<Logprob>`

          - `token: string`

          - `bytes: Array<number>`

          - `logprob: number`

          - `top_logprobs: Array<TopLogprob>`

            - `token: string`

            - `bytes: Array<number>`

            - `logprob: number`

      - `BetaResponseOutputRefusal`

        A refusal from the model.

        - `refusal: string`

          The refusal explanation from the model.

        - `type: "refusal"`

          The type of the refusal. Always `refusal`.

          - `"refusal"`

    - `role: "assistant"`

      The role of the output message. Always `assistant`.

      - `"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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "message"`

      The type of the output message. Always `message`.

      - `"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" | "final_answer" | 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.

      - `"commentary"`

      - `"final_answer"`

  - `BetaResponseFileSearchToolCall`

    The results of a file search tool call. See the
    [file search guide](/api/docs/guides/tools-file-search) 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`,

      - `"in_progress"`

      - `"searching"`

      - `"completed"`

      - `"incomplete"`

      - `"failed"`

    - `type: "file_search_call"`

      The type of the file search tool call. Always `file_search_call`.

      - `"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.

        - `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.

        `format: float`

      - `text?: string`

        The text that was retrieved from the file.

  - `BetaResponseComputerToolCall`

    A tool call to a computer use tool. See the
    [computer use guide](/api/docs/guides/tools-computer-use) 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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "computer_call"`

      The type of the computer call. Always `computer_call`.

      - `"computer_call"`

    - `action?: BetaComputerAction`

      A click action.

      - `Click`

        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`.

          - `"left"`

          - `"right"`

          - `"wheel"`

          - `"back"`

          - `"forward"`

        - `type: "click"`

          Specifies the event type. For a click action, this property is always `click`.

          - `"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`

        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`.

          - `"double_click"`

        - `x: number`

          The x-coordinate where the double click occurred.

        - `y: number`

          The y-coordinate where the double click occurred.

      - `Drag`

        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`.

          - `"drag"`

        - `keys?: Array<string> | null`

          The keys being held while dragging the mouse.

      - `Keypress`

        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`.

          - `"keypress"`

      - `Move`

        A mouse move action.

        - `type: "move"`

          Specifies the event type. For a move action, this property is always set to `move`.

          - `"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`

        A screenshot action.

        - `type: "screenshot"`

          Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

          - `"screenshot"`

      - `Scroll`

        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`.

          - `"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`

        An action to type in text.

        - `text: string`

          The text to type.

        - `type: "type"`

          Specifies the event type. For a type action, this property is always set to `type`.

          - `"type"`

      - `Wait`

        A wait action.

        - `type: "wait"`

          Specifies the event type. For a wait action, this property is always set to `wait`.

          - `"wait"`

    - `actions?: BetaComputerActionList`

      Flattened batched actions for `computer_use`. Each action includes an
      `type` discriminator and action-specific fields.

      - `Click`

        A click action.

      - `DoubleClick`

        A double click action.

      - `Drag`

        A drag action.

      - `Keypress`

        A collection of keypresses the model would like to perform.

      - `Move`

        A mouse move action.

      - `Screenshot`

        A screenshot action.

      - `Scroll`

        A scroll action.

      - `Type`

        An action to type in text.

      - `Wait`

        A wait action.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ComputerCallOutput`

    The output of a computer tool call.

    - `call_id: string`

      The ID of the computer tool call that produced the output.

      `minLength: 1`, `maxLength: 64`

    - `output: BetaResponseComputerToolCallOutputScreenshot`

      A computer screenshot image used with the computer use tool.

      - `type: "computer_screenshot"`

        Specifies the event type. For a computer screenshot, this property is
        always set to `computer_screenshot`.

        - `"computer_screenshot"`

      - `file_id?: string`

        The identifier of an uploaded file that contains the screenshot.

      - `image_url?: string`

        The URL of the screenshot image.

        `format: uri`

    - `type: "computer_call_output"`

      The type of the computer tool call output. Always `computer_call_output`.

      - `"computer_call_output"`

    - `id?: string | null`

      The ID of the computer tool call output.

    - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

      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.

    - `status?: "in_progress" | "completed" | "incomplete" | null`

      The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `BetaResponseFunctionWebSearch`

    The results of a web search tool call. See the
    [web search guide](/api/docs/guides/tools-web-search) for more information.

    - `id: string`

      The unique ID of the web search tool call.

    - `action: Search | OpenPage | FindInPage`

      An object describing the specific action taken in this web search call.
      Includes details on how the model used the web (search, open_page, find_in_page).

      - `Search`

        Action type "search" - Performs a web search query.

        - `type: "search"`

          The action type.

          - `"search"`

        - `queries?: Array<string>`

          The search queries.

        - `query?: string`

          The search query.

        - `sources?: Array<Source>`

          The sources used in the search.

          - `type: "url"`

            The type of source. Always `url`.

            - `"url"`

          - `url: string`

            The URL of the source.

            `format: uri`

      - `OpenPage`

        Action type "open_page" - Opens a specific URL from search results.

        - `type: "open_page"`

          The action type.

          - `"open_page"`

        - `url?: string | null`

          The URL opened by the model.

          `format: uri`

      - `FindInPage`

        Action type "find_in_page": Searches for a pattern within a loaded page.

        - `pattern: string`

          The pattern or text to search for within the page.

        - `type: "find_in_page"`

          The action type.

          - `"find_in_page"`

        - `url: string`

          The URL of the page searched for the pattern.

          `format: uri`

    - `status: "in_progress" | "searching" | "completed" | 2 more`

      The status of the web search tool call.

      - `"in_progress"`

      - `"searching"`

      - `"completed"`

      - `"failed"`

      - `"incomplete"`

    - `type: "web_search_call"`

      The type of the web search tool call. Always `web_search_call`.

      - `"web_search_call"`

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseFunctionToolCall`

    A tool call to run a function. See the
    [function calling guide](/api/docs/guides/function-calling) 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`.

      - `"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.

    - `async?: boolean`

      Whether the function tool call runs asynchronously.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `FunctionCallOutput`

    The output of a function tool call.

    - `output: string | BetaResponseFunctionCallOutputItemList`

      Text, image, or file output of the function tool call.

      - `string`

      - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

        An array of content outputs (text, image, file) for the function tool call.

        - `BetaResponseInputTextContent`

          A text input to the model.

          - `text: string`

            The text input to the model.

            `maxLength: 10485760`

          - `type: "input_text"`

            The type of the input item. Always `input_text`.

            - `"input_text"`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputImageContent`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

          - `type: "input_image"`

            The type of the input item. Always `input_image`.

            - `"input_image"`

          - `detail?: BetaImageDetail | null`

            The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

          - `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.

            `maxLength: 20971520`, `format: uri`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputFileContent`

          A file input to the model.

          - `type: "input_file"`

            The type of the input item. Always `input_file`.

            - `"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`.

            - `"auto"`

            - `"low"`

            - `"high"`

          - `file_data?: string | null`

            The base64-encoded data of the file to be sent to the model.

            `maxLength: 73400320`

          - `file_id?: string | null`

            The ID of the file to be sent to the model.

          - `file_url?: string | null`

            The URL of the file to be sent to the model.

            `format: uri`

          - `filename?: string | null`

            The name of the file to be sent to the model.

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

    - `type: "function_call_output"`

      The type of the function tool call output. Always `function_call_output`.

      - `"function_call_output"`

    - `id?: string | null`

      The unique ID of the function tool call output. Populated when this item is returned via API.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `call_id?: string | null`

      The unique ID of the function tool call generated by the model.

      `minLength: 1`, `maxLength: 64`

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

          `minLength: 1`, `maxLength: 64`

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

    - `name?: string | null`

      The name of the tool that produced the output.

      `minLength: 1`, `maxLength: 128`

    - `namespace?: string | null`

      The namespace of the tool that produced the output.

      `minLength: 1`, `maxLength: 128`

    - `status?: "in_progress" | "completed" | "incomplete" | null`

      The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `AgentMessage`

    A message routed between agents.

    - `author: string`

      The sending agent identity.

    - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

      Plaintext, image, or encrypted content sent between agents.

      - `BetaResponseInputTextContent`

        A text input to the model.

      - `BetaResponseInputImageContent`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

      - `EncryptedContent`

        Opaque encrypted content that Responses API decrypts inside trusted model execution.

        - `encrypted_content: string`

          Opaque encrypted content.

          `maxLength: 10485760`

        - `type: "encrypted_content"`

          The type of the input item. Always `encrypted_content`.

          - `"encrypted_content"`

    - `recipient: string`

      The destination agent identity.

    - `type: "agent_message"`

      The item type. Always `agent_message`.

      - `"agent_message"`

    - `id?: string | null`

      The unique ID of this agent message item.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `MultiAgentCall`

    - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

      The multi-agent action that was executed.

      - `"spawn_agent"`

      - `"interrupt_agent"`

      - `"list_agents"`

      - `"send_message"`

      - `"followup_task"`

      - `"wait_agent"`

    - `arguments: string`

      The action arguments as a JSON string.

    - `call_id: string`

      The unique ID linking this call to its output.

      `minLength: 1`, `maxLength: 64`

    - `type: "multi_agent_call"`

      The item type. Always `multi_agent_call`.

      - `"multi_agent_call"`

    - `id?: string | null`

      The unique ID of this multi-agent call.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `MultiAgentCallOutput`

    - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

      The multi-agent action that produced this result.

      - `"spawn_agent"`

      - `"interrupt_agent"`

      - `"list_agents"`

      - `"send_message"`

      - `"followup_task"`

      - `"wait_agent"`

    - `call_id: string`

      The unique ID of the multi-agent call.

      `minLength: 1`, `maxLength: 64`

    - `output: Array<Output>`

      Text output returned by the multi-agent action.

      - `text: string`

        The text content.

        `maxLength: 10485760`

      - `type: "output_text"`

        The content type. Always `output_text`.

        - `"output_text"`

      - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

        Citations associated with the text content.

        - `FileCitation`

          - `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.

            `minimum: 0`

          - `type: "file_citation"`

            The citation type. Always `file_citation`.

            - `"file_citation"`

        - `URLCitation`

          - `end_index: number`

            The index of the last character of the citation in the message.

            `minimum: 0`

          - `start_index: number`

            The index of the first character of the citation in the message.

            `minimum: 0`

          - `title: string`

            The title of the cited resource.

          - `type: "url_citation"`

            The citation type. Always `url_citation`.

            - `"url_citation"`

          - `url: string`

            The URL of the cited resource.

            `format: uri`

        - `ContainerFileCitation`

          - `container_id: string`

            The ID of the container.

          - `end_index: number`

            The index of the last character of the citation in the message.

            `minimum: 0`

          - `file_id: string`

            The ID of the container file.

          - `filename: string`

            The filename of the container file cited.

          - `start_index: number`

            The index of the first character of the citation in the message.

            `minimum: 0`

          - `type: "container_file_citation"`

            The citation type. Always `container_file_citation`.

            - `"container_file_citation"`

    - `type: "multi_agent_call_output"`

      The item type. Always `multi_agent_call_output`.

      - `"multi_agent_call_output"`

    - `id?: string | null`

      The unique ID of this multi-agent call output.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ToolSearchCall`

    - `arguments: unknown`

      The arguments supplied to the tool search call.

    - `type: "tool_search_call"`

      The item type. Always `tool_search_call`.

      - `"tool_search_call"`

    - `id?: string | null`

      The unique ID of this tool search call.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `call_id?: string | null`

      The unique ID of the tool search call generated by the model.

      `minLength: 1`, `maxLength: 64`

    - `execution?: "server" | "client"`

      Whether tool search was executed by the server or by the client.

      - `"server"`

      - `"client"`

    - `status?: "in_progress" | "completed" | "incomplete" | null`

      The status of the tool search call.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `BetaResponseToolSearchOutputItemParam`

    - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

      The loaded tool definitions returned by the tool search output.

      - `BetaFunctionTool`

        Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

          - `"function"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async?: boolean`

        - `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`

        A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `type: "file_search"`

          The type of the file search tool. Always `file_search`.

          - `"file_search"`

        - `vector_store_ids: Array<string>`

          The IDs of the vector stores to search.

        - `filters?: ComparisonFilter | CompoundFilter | null`

          A filter to apply.

          - `ComparisonFilter`

            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

              - `"eq"`

              - `"ne"`

              - `"gt"`

              - `"gte"`

              - `"lt"`

              - `"lte"`

              - `"in"`

              - `"nin"`

            - `value: string | number | boolean | Array<string | number>`

              The value to compare against the attribute key; supports string, number, or boolean types.

              - `string`

              - `number`

              - `boolean`

              - `Array<string | number>`

                - `string`

                - `number`

          - `CompoundFilter`

            Combine multiple filters using `and` or `or`.

            - `filters: Array<ComparisonFilter | unknown>`

              Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

              - `ComparisonFilter`

                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

                  - `"eq"`

                  - `"ne"`

                  - `"gt"`

                  - `"gte"`

                  - `"lt"`

                  - `"lte"`

                  - `"in"`

                  - `"nin"`

                - `value: string | number | boolean | Array<string | number>`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `Array<string | number>`

                    - `string`

                    - `number`

              - `unknown`

            - `type: "and" | "or"`

              Type of operation: `and` or `or`.

              - `"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`

          Ranking options for search.

          - `hybrid_search?: HybridSearch`

            Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

            - `embedding_weight: number`

              The weight of the embedding in the reciprocal ranking fusion.

            - `text_weight: number`

              The weight of the text in the reciprocal ranking fusion.

          - `ranker?: "auto" | "default-2024-11-15"`

            The ranker to use for the file search.

            - `"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`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `type: "computer"`

          The type of the computer tool. Always `computer`.

          - `"computer"`

      - `BetaComputerUsePreviewTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `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.

          - `"windows"`

          - `"mac"`

          - `"linux"`

          - `"ubuntu"`

          - `"browser"`

        - `type: "computer_use_preview"`

          The type of the computer use tool. Always `computer_use_preview`.

          - `"computer_use_preview"`

      - `BetaWebSearchTool`

        Search the Internet for sources related to the prompt. Learn more about the
        [web search tool](/api/docs/guides/tools-web-search).

        - `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`.

          - `"web_search"`

          - `"web_search_2025_08_26"`

        - `external_web_access?: boolean`

          Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

        - `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.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `user_location?: UserLocation | null`

          The approximate location of the user. If omitted or null, defaults to the
          United States. To avoid this fallback, pass `{"type": "approximate"}` without
          location fields. To localize results, provide the relevant location fields.

          - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `type?: "approximate"`

            The type of location approximation. Always `approximate`.

            - `"approximate"`

      - `Mcp`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

          - `"mcp"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools?: Array<string> | McpToolFilter | null`

          List of allowed tool names or a filter object.

          - `Array<string>`

          - `McpToolFilter`

            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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

          This field is deprecated for models released after September 1, 2026.
          Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
          connect through a Secure MCP Tunnel.

          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`

          - `"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" | null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter`

            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`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                it will match this filter.

              - `tool_names?: Array<string>`

                List of allowed tool names.

            - `never?: Never`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

          `format: uri`

        - `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`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string | CodeInterpreterToolAuto`

          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.

          - `string`

          - `CodeInterpreterToolAuto`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids?: Array<string>`

              An optional list of uploaded files to make available to your code.

              `maxItems: 50`

            - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled`

                - `type: "disabled"`

                  Disable outbound network access. Always `disabled`.

                  - `"disabled"`

              - `BetaContainerNetworkPolicyAllowlist`

                - `allowed_domains: Array<string>`

                  A list of allowed domains when type is `allowlist`.

                  `minItems: 1`

                - `type: "allowlist"`

                  Allow outbound network access only to specified domains. Always `allowlist`.

                  - `"allowlist"`

                - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                  Optional domain-scoped secrets for allowlisted domains.

                  `minItems: 1`

                  - `domain: string`

                    The domain associated with the secret.

                    `minLength: 1`

                  - `name: string`

                    The name of the secret to inject for the domain.

                    `minLength: 1`

                  - `value: string`

                    The secret value to inject for the domain.

                    `minLength: 1`, `maxLength: 10485760`

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action?: "generate" | "edit" | "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background?: "transparent" | "opaque" | "auto"`

          Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
          `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
          Transparent backgrounds are available for supported GPT Image models. For
          `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
          using `transparent`, set the output format to `png` or `webp`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `complexity?: "low" | "medium" | "high"`

          Computation spent planning the image, independently of rendering quality.
          Overrides the outer response's `reasoning.effort` for image generation.
          When omitted, inherits a supported outer reasoning effort or uses the
          image model's configured default.
          For SVG output, controls the reference image, not the SVG author's
          reasoning.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `frame_count?: number`

          Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

          `minimum: 2`, `maximum: 16`

        - `frame_duration_ms?: number`

          Duration of each GIF frame in milliseconds, rounded to 10 ms.
          Requires `output_format` to be `gif`. Default: 200.

          `minimum: 20`, `maximum: 2000`

        - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

          - `"high"`

          - `"low"`

        - `input_image_mask?: InputImageMask`

          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" | 9 more`

          The image generation model to use. One of `gpt-image-1-mini`,
          `gpt-image-1.5`, `gpt-image-2`,
          `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
          `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
          `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
          `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
          `gpt-image-2`.

          `gpt-image-1` was shut down on October 23, 2026. Use
          `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

          Deprecated values:

          - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

          - `(string & {})`

          - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

            The image generation model to use. One of `gpt-image-1-mini`,
            `gpt-image-1.5`, `gpt-image-2`,
            `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
            `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
            `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
            `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
            `gpt-image-2`.

            `gpt-image-1` was shut down on October 23, 2026. Use
            `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

            - `"gpt-image-1"`

            - `"gpt-image-1-mini"`

            - `"gpt-image-2"`

            - `"gpt-image-2-2026-04-21"`

            - `"gpt-image-2.5-sunburst"`

            - `"gpt-image-2.5-sunburst-2026-09-08"`

            - `"gpt-image-2.5-flare"`

            - `"gpt-image-2.5-flare-2026-09-08"`

            - `"gpt-image-2.6-sunburst"`

            - `"gpt-image-2.6-flare"`

            - `"gpt-image-1.5"`

            - `"chatgpt-image-latest"`

        - `moderation?: "auto" | "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression?: number`

          Compression level for the output image. Default: 100.

          `minimum: 0`, `maximum: 100`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more`

          The output format of the generated image. One of `png`, `webp`, `jpeg`,
          `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
          that supports the selected format. GIF output does not support
          partial image streaming (`partial_images` greater than `0`),
          `input_image_mask`, or custom `output_compression`.
          Responses lifecycle events can still be streamed for GIF output.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `partial_images?: number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          `minimum: 0`, `maximum: 3`

        - `quality?: "low" | "medium" | "high" | 3 more`

          The quality of the generated image. The GPT image models support `low`,
          `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
          including their `2026-09-08` snapshots, also support `xhigh` and `max`.
          Default: `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

          The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

        - `svg?: Svg`

          SVG author model settings. Requires `output_format` to be `svg`.
          When SVG model selection is enabled, omitting this object uses the
          outer response model. Otherwise, the default SVG author is used and
          explicit model overrides are unavailable.

          - `model?: string`

            `minLength: 1`

          - `reasoning?: Reasoning | null`

            Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

            - `effort?: "none" | "minimal" | "low" | 4 more`

              Controls how much effort the model should spend on reasoning for this request.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

      - `LocalShell`

        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`.

          - `"local_shell"`

      - `BetaFunctionShellTool`

        A tool that allows the model to execute shell commands.

        - `type: "shell"`

          The type of the shell tool. Always `shell`.

          - `"shell"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

        - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

          - `BetaContainerAuto`

            - `type: "container_auto"`

              Automatically creates a container for this request

              - `"container_auto"`

            - `file_ids?: Array<string>`

              An optional list of uploaded files to make available to your code.

              `maxItems: 50`

            - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

              The memory limit for the container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled`

              - `BetaContainerNetworkPolicyAllowlist`

            - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

              An optional list of skills referenced by id or inline data.

              `maxItems: 200`

              - `BetaSkillReference`

                - `skill_id: string`

                  The ID of the referenced skill.

                  `minLength: 1`, `maxLength: 64`

                - `type: "skill_reference"`

                  References a skill created with the /v1/skills endpoint.

                  - `"skill_reference"`

                - `version?: string`

                  Optional skill version. Use a positive integer or 'latest'. Omit for default.

              - `BetaInlineSkill`

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `source: BetaInlineSkillSource`

                  Inline skill payload

                  - `data: string`

                    Base64-encoded skill zip bundle.

                    `minLength: 1`, `maxLength: 70254592`

                  - `media_type: "application/zip"`

                    The media type of the inline skill payload. Must be `application/zip`.

                    - `"application/zip"`

                  - `type: "base64"`

                    The type of the inline skill source. Must be `base64`.

                    - `"base64"`

                - `type: "inline"`

                  Defines an inline skill for this request.

                  - `"inline"`

          - `BetaLocalEnvironment`

            - `type: "local"`

              Use a local computer environment.

              - `"local"`

            - `skills?: Array<BetaLocalSkill>`

              An optional list of skills.

              `maxItems: 200`

              - `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: string`

              The ID of the referenced container.

            - `type: "container_reference"`

              References a container created with the /v1/containers endpoint

              - `"container_reference"`

      - `BetaCustomTool`

        A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

          - `"custom"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

        - `async?: boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `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 | Grammar`

          The input format for the custom tool. Default is unconstrained text.

          - `Text`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar`

            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`.

              - `"lark"`

              - `"regex"`

            - `type: "grammar"`

              Grammar format. Always `grammar`.

              - `"grammar"`

      - `BetaToolSearchOutputNamespaceTool`

        Groups function/custom tools under a shared namespace.

        - `description: string`

          A description of the namespace shown to the model.

        - `name: string`

          The namespace name used in tool calls (for example, `crm`).

          `minLength: 1`

        - `tools: Array<Function | BetaCustomTool>`

          The function/custom tools loaded inside this namespace.

          `minItems: 1`

          - `Function`

            - `name: string`

              The name of the loaded function tool.

              `minLength: 1`, `maxLength: 128`

            - `type: "function"`

              - `"function"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `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`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `type: "namespace"`

          The type of the tool. Always `namespace`.

          - `"namespace"`

      - `BetaToolSearchTool`

        Hosted or BYOT tool search configuration for deferred tools.

        - `type: "tool_search"`

          The type of the tool. Always `tool_search`.

          - `"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.

          - `"server"`

          - `"client"`

        - `parameters?: unknown`

          Parameter schema for a client-executed tool search tool.

      - `BetaWebSearchPreviewTool`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `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`.

          - `"web_search_preview"`

          - `"web_search_preview_2025_03_11"`

        - `search_content_types?: Array<"text" | "image">`

          - `"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.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `user_location?: UserLocation | null`

          The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

          - `type: "approximate"`

            The type of location approximation. Always `approximate`.

            - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `BetaApplyPatchTool`

        Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "apply_patch"`

          The type of the tool. Always `apply_patch`.

          - `"apply_patch"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

    - `type: "tool_search_output"`

      The item type. Always `tool_search_output`.

      - `"tool_search_output"`

    - `id?: string | null`

      The unique ID of this tool search output.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `call_id?: string | null`

      The unique ID of the tool search call generated by the model.

      `minLength: 1`, `maxLength: 64`

    - `execution?: "server" | "client"`

      Whether tool search was executed by the server or by the client.

      - `"server"`

      - `"client"`

    - `status?: "in_progress" | "completed" | "incomplete" | null`

      The status of the tool search output.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `AdditionalTools`

    - `role: "developer"`

      The role that provided the additional tools. Only `developer` is supported.

      - `"developer"`

    - `tools: Array<BetaTool>`

      A list of additional tools made available at this item.

      - `BetaFunctionTool`

        Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

      - `BetaFileSearchTool`

        A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

      - `BetaComputerTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaComputerUsePreviewTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaWebSearchTool`

        Search the Internet for sources related to the prompt. Learn more about the
        [web search tool](/api/docs/guides/tools-web-search).

      - `Mcp`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

          - `"mcp"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools?: Array<string> | McpToolFilter | null`

          List of allowed tool names or a filter object.

          - `Array<string>`

          - `McpToolFilter`

            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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

          This field is deprecated for models released after September 1, 2026.
          Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
          connect through a Secure MCP Tunnel.

          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`

          - `"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" | null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter`

            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`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                it will match this filter.

              - `tool_names?: Array<string>`

                List of allowed tool names.

            - `never?: Never`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

          `format: uri`

        - `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`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string | CodeInterpreterToolAuto`

          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.

          - `string`

          - `CodeInterpreterToolAuto`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids?: Array<string>`

              An optional list of uploaded files to make available to your code.

              `maxItems: 50`

            - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled`

              - `BetaContainerNetworkPolicyAllowlist`

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action?: "generate" | "edit" | "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background?: "transparent" | "opaque" | "auto"`

          Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
          `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
          Transparent backgrounds are available for supported GPT Image models. For
          `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
          using `transparent`, set the output format to `png` or `webp`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `complexity?: "low" | "medium" | "high"`

          Computation spent planning the image, independently of rendering quality.
          Overrides the outer response's `reasoning.effort` for image generation.
          When omitted, inherits a supported outer reasoning effort or uses the
          image model's configured default.
          For SVG output, controls the reference image, not the SVG author's
          reasoning.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `frame_count?: number`

          Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

          `minimum: 2`, `maximum: 16`

        - `frame_duration_ms?: number`

          Duration of each GIF frame in milliseconds, rounded to 10 ms.
          Requires `output_format` to be `gif`. Default: 200.

          `minimum: 20`, `maximum: 2000`

        - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

          - `"high"`

          - `"low"`

        - `input_image_mask?: InputImageMask`

          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" | 9 more`

          The image generation model to use. One of `gpt-image-1-mini`,
          `gpt-image-1.5`, `gpt-image-2`,
          `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
          `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
          `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
          `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
          `gpt-image-2`.

          `gpt-image-1` was shut down on October 23, 2026. Use
          `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

          Deprecated values:

          - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

          - `(string & {})`

          - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

            The image generation model to use. One of `gpt-image-1-mini`,
            `gpt-image-1.5`, `gpt-image-2`,
            `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
            `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
            `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
            `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
            `gpt-image-2`.

            `gpt-image-1` was shut down on October 23, 2026. Use
            `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

            - `"gpt-image-1"`

            - `"gpt-image-1-mini"`

            - `"gpt-image-2"`

            - `"gpt-image-2-2026-04-21"`

            - `"gpt-image-2.5-sunburst"`

            - `"gpt-image-2.5-sunburst-2026-09-08"`

            - `"gpt-image-2.5-flare"`

            - `"gpt-image-2.5-flare-2026-09-08"`

            - `"gpt-image-2.6-sunburst"`

            - `"gpt-image-2.6-flare"`

            - `"gpt-image-1.5"`

            - `"chatgpt-image-latest"`

        - `moderation?: "auto" | "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression?: number`

          Compression level for the output image. Default: 100.

          `minimum: 0`, `maximum: 100`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more`

          The output format of the generated image. One of `png`, `webp`, `jpeg`,
          `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
          that supports the selected format. GIF output does not support
          partial image streaming (`partial_images` greater than `0`),
          `input_image_mask`, or custom `output_compression`.
          Responses lifecycle events can still be streamed for GIF output.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `partial_images?: number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          `minimum: 0`, `maximum: 3`

        - `quality?: "low" | "medium" | "high" | 3 more`

          The quality of the generated image. The GPT image models support `low`,
          `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
          including their `2026-09-08` snapshots, also support `xhigh` and `max`.
          Default: `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

          The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

        - `svg?: Svg`

          SVG author model settings. Requires `output_format` to be `svg`.
          When SVG model selection is enabled, omitting this object uses the
          outer response model. Otherwise, the default SVG author is used and
          explicit model overrides are unavailable.

          - `model?: string`

            `minLength: 1`

          - `reasoning?: Reasoning | null`

            Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

            - `effort?: "none" | "minimal" | "low" | 4 more`

              Controls how much effort the model should spend on reasoning for this request.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

      - `LocalShell`

        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`.

          - `"local_shell"`

      - `BetaFunctionShellTool`

        A tool that allows the model to execute shell commands.

      - `BetaCustomTool`

        A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

      - `BetaNamespaceTool`

        Groups function/custom tools under a shared namespace.

        - `description: string`

          A description of the namespace shown to the model.

        - `name: string`

          The namespace name used in tool calls (for example, `crm`).

          `minLength: 1`

        - `tools: Array<Function | BetaCustomTool>`

          The function/custom tools available inside this namespace.

          `minItems: 1`

          - `Function`

            - `name: string`

              `minLength: 1`, `maxLength: 128`

            - `type: "function"`

              - `"function"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `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`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `type: "namespace"`

          The type of the tool. Always `namespace`.

          - `"namespace"`

      - `BetaToolSearchTool`

        Hosted or BYOT tool search configuration for deferred tools.

      - `BetaWebSearchPreviewTool`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

      - `BetaApplyPatchTool`

        Allows the assistant to create, delete, or update files using unified diffs.

    - `type: "additional_tools"`

      The item type. Always `additional_tools`.

      - `"additional_tools"`

    - `id?: string | null`

      The unique ID of this additional tools item.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseConfigurationUpdateItemParam`

    An update to the conversation's response configuration. Supply reasoning,
    text, or both. Each setting stays in effect until a later update replaces it.

    - `type: "configuration_update"`

      The item type. Always `configuration_update`.

      - `"configuration_update"`

    - `id?: string | null`

      The unique ID of the configuration update item.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `reasoning?: Reasoning`

      Updates to reasoning configuration. Only effort is supported.

      - `effort?: "none" | "minimal" | "low" | 4 more | null`

        The reasoning effort to use for subsequent responses until another
        configuration update replaces it.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

    - `text?: Text`

      The text output configuration for subsequent responses.

      - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

        Use a JSON schema for structured output or text to return to plain text.

        - `Text`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig`

          JSON Schema response format. Used to generate structured JSON responses.
          Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

          - `name: string`

            The name of the response format. Must be a-z, A-Z, 0-9, or contain
            underscores and dashes, with a maximum length of 64.

          - `schema: Record<string, unknown>`

            The schema for the response format, described as a JSON Schema object.
            Learn how to build JSON schemas [here](https://json-schema.org/).

          - `type: "json_schema"`

            The type of response format being defined. Always `json_schema`.

            - `"json_schema"`

          - `description?: string`

            A description of what the response format is for, used by the model to
            determine how to respond in the format.

          - `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](/api/docs/guides/structured-outputs).

  - `BetaResponseReasoningItem`

    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](/api/docs/guides/conversation-state).

    - `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`.

        - `"summary_text"`

    - `type: "reasoning"`

      The type of the object. Always `reasoning`.

      - `"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`.

        - `"reasoning_text"`

    - `encrypted_content?: string | null`

      The encrypted content of the reasoning item. This is populated by default
      for reasoning items returned by `POST /v1/responses` and WebSocket
      `response.create` requests.

      When streaming, use the completed reasoning item and its
      `encrypted_content` from the `response.output_item.done` event in
      subsequent requests. The `encrypted_content` in
      `response.output_item.added` may be incomplete. This is especially
      important when `store` is `false` or when using Zero Data Retention.

    - `status?: "in_progress" | "completed" | "incomplete"`

      The status of the item. One of `in_progress`, `completed`, or
      `incomplete`. Populated when items are returned via API.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `BetaResponseCompactionItemParam`

    A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

    - `encrypted_content: string`

      The encrypted content of the compaction summary.

      `maxLength: 104857600`

    - `type: "compaction"`

      The type of the item. Always `compaction`.

      - `"compaction"`

    - `id?: string | null`

      The ID of the compaction item.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ImageGenerationCall`

    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.

      - `"in_progress"`

      - `"completed"`

      - `"generating"`

      - `"failed"`

    - `type: "image_generation_call"`

      The type of the image generation call. Always `image_generation_call`.

      - `"image_generation_call"`

    - `action?: "generate" | "edit" | "auto" | null`

      The action used for image generation.

      - `"generate"`

      - `"edit"`

      - `"auto"`

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `background?: "transparent" | "opaque" | "auto" | null`

      The background setting used for generation.

      - `"transparent"`

      - `"opaque"`

      - `"auto"`

    - `error?: Error`

      Details of a moderation failure, when available.

      - `code: string | null`

        The error code.

      - `message: string`

        A description of the error.

      - `param: string | null`

        The related request parameter.

      - `type: string`

        The error type.

      - `moderation_details?: ModerationDetails`

        Public details for a `moderation_blocked` error, when available.

        - `categories: Array<string>`

          Public moderation categories. New category values may be added over time.

        - `moderation_stage: "input" | "output" | "unknown"`

          The stage where moderation blocked the image generation call.

          - `"input"`

          - `"output"`

          - `"unknown"`

    - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

      The output format used for generation.

      - `"png"`

      - `"webp"`

      - `"jpeg"`

      - `"gif"`

      - `"svg"`

    - `quality?: "low" | "medium" | "high" | 3 more | null`

      The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

      - `"auto"`

    - `revised_prompt?: string | null`

      The prompt that was used after any model prompt rewriting.

    - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

      The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

      - `(string & {})`

      - `"1024x1024" | "1024x1536" | "1536x1024"`

        - `"1024x1024"`

        - `"1024x1536"`

        - `"1536x1024"`

    - `svg_usage?: SvgUsage`

      - `input_tokens: number`

      - `model: string`

      - `output_tokens: number`

      - `reasoning_tokens: number`

      - `total_tokens: number`

  - `BetaResponseCodeInterpreterToolCall`

    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 | Image> | null`

      The outputs generated by the code interpreter, such as logs or images.
      Can be null if no outputs are available.

      - `Logs`

        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`.

          - `"logs"`

      - `Image`

        The image output from the code interpreter.

        - `type: "image"`

          The type of the output. Always `image`.

          - `"image"`

        - `url: string`

          The URL of the image output from the code interpreter.

          `format: uri`

    - `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`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

      - `"interpreting"`

      - `"failed"`

    - `type: "code_interpreter_call"`

      The type of the code interpreter tool call. Always `code_interpreter_call`.

      - `"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`

    A tool call to run a command on the local shell.

    - `id: string`

      The unique ID of the local shell call.

    - `action: Action`

      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`.

        - `"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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "local_shell_call"`

      The type of the local shell call. Always `local_shell_call`.

      - `"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`

    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`.

      - `"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`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `ShellCall`

    A tool representing a request to execute one or more shell commands.

    - `action: Action`

      The shell commands and limits that describe how to run the tool call.

      - `commands: Array<string>`

        Ordered shell commands for the execution environment to run.

      - `max_output_length?: number | null`

        Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

      - `timeout_ms?: number | null`

        Maximum wall-clock time in milliseconds to allow the shell commands to run.

    - `call_id: string`

      The unique ID of the shell tool call generated by the model.

      `minLength: 1`, `maxLength: 64`

    - `type: "shell_call"`

      The type of the item. Always `shell_call`.

      - `"shell_call"`

    - `id?: string | null`

      The unique ID of the shell tool call. Populated when this item is returned via API.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

          `minLength: 1`, `maxLength: 64`

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

    - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

      The environment to execute the shell commands in.

      - `BetaLocalEnvironment`

      - `BetaContainerReference`

    - `status?: "in_progress" | "completed" | "incomplete" | null`

      The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `ShellCallOutput`

    The streamed output items emitted by a shell tool call.

    - `call_id: string`

      The unique ID of the shell tool call generated by the model.

      `minLength: 1`, `maxLength: 64`

    - `output: Array<BetaResponseFunctionShellCallOutputContent>`

      Captured chunks of stdout and stderr output, along with their associated outcomes.

      - `outcome: Timeout | Exit`

        The exit or timeout outcome associated with this shell call.

        - `Timeout`

          Indicates that the shell call exceeded its configured time limit.

          - `type: "timeout"`

            The outcome type. Always `timeout`.

            - `"timeout"`

        - `Exit`

          Indicates that the shell commands finished and returned an exit code.

          - `exit_code: number`

            The exit code returned by the shell process.

          - `type: "exit"`

            The outcome type. Always `exit`.

            - `"exit"`

      - `stderr: string`

        Captured stderr output for the shell call.

        `maxLength: 10485760`

      - `stdout: string`

        Captured stdout output for the shell call.

        `maxLength: 10485760`

    - `type: "shell_call_output"`

      The type of the item. Always `shell_call_output`.

      - `"shell_call_output"`

    - `id?: string | null`

      The unique ID of the shell tool call output. Populated when this item is returned via API.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

          `minLength: 1`, `maxLength: 64`

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

    - `max_output_length?: number | null`

      The maximum number of UTF-8 characters captured for this shell call's combined output.

    - `status?: "in_progress" | "completed" | "incomplete" | null`

      The status of the shell call output.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `ApplyPatchCall`

    A tool call representing a request to create, delete, or update files using diff patches.

    - `call_id: string`

      The unique ID of the apply patch tool call generated by the model.

      `minLength: 1`, `maxLength: 64`

    - `operation: CreateFile | DeleteFile | UpdateFile`

      The specific create, delete, or update instruction for the apply_patch tool call.

      - `CreateFile`

        Instruction for creating a new file via the apply_patch tool.

        - `diff: string`

          Unified diff content to apply when creating the file.

          `maxLength: 10485760`

        - `path: string`

          Path of the file to create relative to the workspace root.

          `minLength: 1`

        - `type: "create_file"`

          The operation type. Always `create_file`.

          - `"create_file"`

      - `DeleteFile`

        Instruction for deleting an existing file via the apply_patch tool.

        - `path: string`

          Path of the file to delete relative to the workspace root.

          `minLength: 1`

        - `type: "delete_file"`

          The operation type. Always `delete_file`.

          - `"delete_file"`

      - `UpdateFile`

        Instruction for updating an existing file via the apply_patch tool.

        - `diff: string`

          Unified diff content to apply to the existing file.

          `maxLength: 10485760`

        - `path: string`

          Path of the file to update relative to the workspace root.

          `minLength: 1`

        - `type: "update_file"`

          The operation type. Always `update_file`.

          - `"update_file"`

    - `status: "in_progress" | "completed"`

      The status of the apply patch tool call. One of `in_progress` or `completed`.

      - `"in_progress"`

      - `"completed"`

    - `type: "apply_patch_call"`

      The type of the item. Always `apply_patch_call`.

      - `"apply_patch_call"`

    - `id?: string | null`

      The unique ID of the apply patch tool call. Populated when this item is returned via API.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

          `minLength: 1`, `maxLength: 64`

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

  - `ApplyPatchCallOutput`

    The streamed output emitted by an apply patch tool call.

    - `call_id: string`

      The unique ID of the apply patch tool call generated by the model.

      `minLength: 1`, `maxLength: 64`

    - `status: "completed" | "failed"`

      The status of the apply patch tool call output. One of `completed` or `failed`.

      - `"completed"`

      - `"failed"`

    - `type: "apply_patch_call_output"`

      The type of the item. Always `apply_patch_call_output`.

      - `"apply_patch_call_output"`

    - `id?: string | null`

      The unique ID of the apply patch tool call output. Populated when this item is returned via API.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

          `minLength: 1`, `maxLength: 64`

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

    - `output?: string | null`

      Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

      `maxLength: 10485760`

  - `McpListTools`

    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`.

      - `"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`

    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`.

      - `"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`

    A response to an MCP approval request.

    - `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`.

      - `"mcp_approval_response"`

    - `id?: string | null`

      The unique ID of the 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.

  - `McpCall`

    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`.

      - `"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?: BetaMcpToolCallError | null`

      The error from the tool call, if any.

      - `McpProtocolError`

        - `code: number`

        - `message: string`

        - `type: "mcp_protocol_error"`

          - `"mcp_protocol_error"`

      - `McpToolExecutionError`

        - `content: unknown`

        - `type: "mcp_tool_execution_error"`

          - `"mcp_tool_execution_error"`

      - `HTTPError`

        - `code: number`

        - `message: string`

        - `type: "http_error"`

          - `"http_error"`

    - `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`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

      - `"calling"`

      - `"failed"`

  - `BetaResponseCustomToolCallOutput`

    The output of a custom tool call from your code, being sent back to the model.

    - `call_id: string`

      The call ID, used to map this custom tool call output to a custom tool call.

    - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

      The output from the custom tool call generated by your code.
      Can be a string or an list of output content.

      - `string`

      - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile`

          A file input to the model.

    - `type: "custom_tool_call_output"`

      The type of the custom tool call output. Always `custom_tool_call_output`.

      - `"custom_tool_call_output"`

    - `id?: string`

      The unique ID of the custom tool call output 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 | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

          `minLength: 1`, `maxLength: 64`

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

  - `BetaResponseCustomToolCall`

    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`.

      - `"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.

    - `async?: boolean`

      Whether the custom tool call runs asynchronously.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `namespace?: string`

      The namespace of the custom tool being called.

  - `CompactionTrigger`

    Compacts the current context. Must be the final input item.

    - `type: "compaction_trigger"`

      The type of the item. Always `compaction_trigger`.

      - `"compaction_trigger"`

    - `id?: string | null`

      The unique ID of this compaction trigger.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ItemReference`

    An internal identifier for an item to reference.

    - `id: string`

      The ID of the item to reference.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `type?: "item_reference" | null`

      The type of item to reference. Always `item_reference`.

      - `"item_reference"`

  - `Program`

    - `id: string`

      The unique ID of this program item.

    - `call_id: string`

      The stable call ID of the program item.

      `minLength: 1`, `maxLength: 64`

    - `code: string`

      The JavaScript source executed by programmatic tool calling.

      `maxLength: 10485760`

    - `fingerprint: string`

      Opaque program replay fingerprint that must be round-tripped.

      `maxLength: 10485760`

    - `type: "program"`

      The item type. Always `program`.

      - `"program"`

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ProgramOutput`

    - `id: string`

      The unique ID of this program output item.

    - `call_id: string`

      The call ID of the program item.

      `minLength: 1`, `maxLength: 64`

    - `result: string`

      The result produced by the program item.

      `maxLength: 10485760`

    - `status: "completed" | "incomplete"`

      The terminal status of the program output.

      - `"completed"`

      - `"incomplete"`

    - `type: "program_output"`

      The item type. Always `program_output`.

      - `"program_output"`

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

### Beta Response Input Audio

- `BetaResponseInputAudio`

  An audio input to the model.

  - `input_audio: InputAudio`

    - `data: string`

      Base64-encoded audio data.

    - `format: "mp3" | "wav"`

      The format of the audio data. Currently supported formats are `mp3` and
      `wav`.

      - `"mp3"`

      - `"wav"`

  - `type: "input_audio"`

    The type of the input item. Always `input_audio`.

    - `"input_audio"`

### Beta Response Input Content

- `BetaResponseInputContent = BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile`

  A text input to the model.

  - `BetaResponseInputText`

    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`.

      - `"input_text"`

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

  - `BetaResponseInputImage`

    An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

    - `detail: BetaImageDetail`

      The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

      - `"low"`

      - `"high"`

      - `"auto"`

      - `"original"`

    - `type: "input_image"`

      The type of the input item. Always `input_image`.

      - `"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.

      `format: uri`

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

  - `BetaResponseInputFile`

    A file input to the model.

    - `type: "input_file"`

      The type of the input item. Always `input_file`.

      - `"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`.

      - `"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.

      `format: uri`

    - `filename?: string`

      The name of the file to be sent to the model.

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

### Beta Response Input File

- `BetaResponseInputFile`

  A file input to the model.

  - `type: "input_file"`

    The type of the input item. Always `input_file`.

    - `"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`.

    - `"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.

    `format: uri`

  - `filename?: string`

    The name of the file to be sent to the model.

  - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

    Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

    - `mode: "explicit"`

      The breakpoint mode. Always `explicit`.

      - `"explicit"`

    - `ttl?: "30m" | "12h"`

      The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

      - `"30m"`

      - `"12h"`

### Beta Response Input File Content

- `BetaResponseInputFileContent`

  A file input to the model.

  - `type: "input_file"`

    The type of the input item. Always `input_file`.

    - `"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`.

    - `"auto"`

    - `"low"`

    - `"high"`

  - `file_data?: string | null`

    The base64-encoded data of the file to be sent to the model.

    `maxLength: 73400320`

  - `file_id?: string | null`

    The ID of the file to be sent to the model.

  - `file_url?: string | null`

    The URL of the file to be sent to the model.

    `format: uri`

  - `filename?: string | null`

    The name of the file to be sent to the model.

  - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

    Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

    - `mode: "explicit"`

      The breakpoint mode. Always `explicit`.

      - `"explicit"`

    - `ttl?: "30m" | "12h"`

      The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

      - `"30m"`

      - `"12h"`

### Beta Response Input Image

- `BetaResponseInputImage`

  An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

  - `detail: BetaImageDetail`

    The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

    - `"low"`

    - `"high"`

    - `"auto"`

    - `"original"`

  - `type: "input_image"`

    The type of the input item. Always `input_image`.

    - `"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.

    `format: uri`

  - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

    Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

    - `mode: "explicit"`

      The breakpoint mode. Always `explicit`.

      - `"explicit"`

    - `ttl?: "30m" | "12h"`

      The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

      - `"30m"`

      - `"12h"`

### Beta Response Input Image Content

- `BetaResponseInputImageContent`

  An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

  - `type: "input_image"`

    The type of the input item. Always `input_image`.

    - `"input_image"`

  - `detail?: BetaImageDetail | null`

    The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

    - `"low"`

    - `"high"`

    - `"auto"`

    - `"original"`

  - `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.

    `maxLength: 20971520`, `format: uri`

  - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

    Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

    - `mode: "explicit"`

      The breakpoint mode. Always `explicit`.

      - `"explicit"`

    - `ttl?: "30m" | "12h"`

      The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

      - `"30m"`

      - `"12h"`

### Beta Response Input Item

- `BetaResponseInputItem = BetaEasyInputMessage | Message | BetaResponseOutputMessage | 33 more`

  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.

  - `BetaEasyInputMessage`

    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.

      - `string`

      - `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

        A list of one or many input items to the model, containing different content
        types.

        - `BetaResponseInputText`

          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`.

            - `"input_text"`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `detail: BetaImageDetail`

            The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

            - `"low"`

            - `"high"`

            - `"auto"`

            - `"original"`

          - `type: "input_image"`

            The type of the input item. Always `input_image`.

            - `"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.

            `format: uri`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputFile`

          A file input to the model.

          - `type: "input_file"`

            The type of the input item. Always `input_file`.

            - `"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`.

            - `"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.

            `format: uri`

          - `filename?: string`

            The name of the file to be sent to the model.

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

    - `role: "user" | "assistant" | "system" | "developer"`

      The role of the message input. One of `user`, `assistant`, `system`, or
      `developer`.

      - `"user"`

      - `"assistant"`

      - `"system"`

      - `"developer"`

    - `phase?: "commentary" | "final_answer" | 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.

      - `"commentary"`

      - `"final_answer"`

    - `type?: "message"`

      The type of the message input. Always `message`.

      - `"message"`

  - `Message`

    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.

    - `content: BetaResponseInputMessageContentList`

      A list of one or many input items to the model, containing different content
      types.

    - `role: "user" | "system" | "developer"`

      The role of the message input. One of `user`, `system`, or `developer`.

      - `"user"`

      - `"system"`

      - `"developer"`

    - `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"`

      The status of item. One of `in_progress`, `completed`, or
      `incomplete`. Populated when items are returned via API.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type?: "message"`

      The type of the message input. Always set to `message`.

      - `"message"`

  - `BetaResponseOutputMessage`

    An output message from the model.

    - `id: string`

      The unique ID of the output message.

    - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

      The content of the output message.

      - `BetaResponseOutputText`

        A text output from the model.

        - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

          The annotations of the text output.

          - `FileCitation`

            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 in the output text at which to insert the file citation.

            - `type: "file_citation"`

              The type of the file citation. Always `file_citation`.

              - `"file_citation"`

          - `URLCitation`

            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_citation"`

            - `url: string`

              The URL of the web resource.

              `format: uri`

          - `ContainerFileCitation`

            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`.

              - `"container_file_citation"`

          - `FilePath`

            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`.

              - `"file_path"`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

          - `"output_text"`

        - `logprobs?: Array<Logprob>`

          - `token: string`

          - `bytes: Array<number>`

          - `logprob: number`

          - `top_logprobs: Array<TopLogprob>`

            - `token: string`

            - `bytes: Array<number>`

            - `logprob: number`

      - `BetaResponseOutputRefusal`

        A refusal from the model.

        - `refusal: string`

          The refusal explanation from the model.

        - `type: "refusal"`

          The type of the refusal. Always `refusal`.

          - `"refusal"`

    - `role: "assistant"`

      The role of the output message. Always `assistant`.

      - `"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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "message"`

      The type of the output message. Always `message`.

      - `"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" | "final_answer" | 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.

      - `"commentary"`

      - `"final_answer"`

  - `BetaResponseFileSearchToolCall`

    The results of a file search tool call. See the
    [file search guide](/api/docs/guides/tools-file-search) 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`,

      - `"in_progress"`

      - `"searching"`

      - `"completed"`

      - `"incomplete"`

      - `"failed"`

    - `type: "file_search_call"`

      The type of the file search tool call. Always `file_search_call`.

      - `"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.

        - `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.

        `format: float`

      - `text?: string`

        The text that was retrieved from the file.

  - `BetaResponseComputerToolCall`

    A tool call to a computer use tool. See the
    [computer use guide](/api/docs/guides/tools-computer-use) 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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "computer_call"`

      The type of the computer call. Always `computer_call`.

      - `"computer_call"`

    - `action?: BetaComputerAction`

      A click action.

      - `Click`

        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`.

          - `"left"`

          - `"right"`

          - `"wheel"`

          - `"back"`

          - `"forward"`

        - `type: "click"`

          Specifies the event type. For a click action, this property is always `click`.

          - `"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`

        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`.

          - `"double_click"`

        - `x: number`

          The x-coordinate where the double click occurred.

        - `y: number`

          The y-coordinate where the double click occurred.

      - `Drag`

        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`.

          - `"drag"`

        - `keys?: Array<string> | null`

          The keys being held while dragging the mouse.

      - `Keypress`

        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`.

          - `"keypress"`

      - `Move`

        A mouse move action.

        - `type: "move"`

          Specifies the event type. For a move action, this property is always set to `move`.

          - `"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`

        A screenshot action.

        - `type: "screenshot"`

          Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

          - `"screenshot"`

      - `Scroll`

        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`.

          - `"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`

        An action to type in text.

        - `text: string`

          The text to type.

        - `type: "type"`

          Specifies the event type. For a type action, this property is always set to `type`.

          - `"type"`

      - `Wait`

        A wait action.

        - `type: "wait"`

          Specifies the event type. For a wait action, this property is always set to `wait`.

          - `"wait"`

    - `actions?: BetaComputerActionList`

      Flattened batched actions for `computer_use`. Each action includes an
      `type` discriminator and action-specific fields.

      - `Click`

        A click action.

      - `DoubleClick`

        A double click action.

      - `Drag`

        A drag action.

      - `Keypress`

        A collection of keypresses the model would like to perform.

      - `Move`

        A mouse move action.

      - `Screenshot`

        A screenshot action.

      - `Scroll`

        A scroll action.

      - `Type`

        An action to type in text.

      - `Wait`

        A wait action.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ComputerCallOutput`

    The output of a computer tool call.

    - `call_id: string`

      The ID of the computer tool call that produced the output.

      `minLength: 1`, `maxLength: 64`

    - `output: BetaResponseComputerToolCallOutputScreenshot`

      A computer screenshot image used with the computer use tool.

      - `type: "computer_screenshot"`

        Specifies the event type. For a computer screenshot, this property is
        always set to `computer_screenshot`.

        - `"computer_screenshot"`

      - `file_id?: string`

        The identifier of an uploaded file that contains the screenshot.

      - `image_url?: string`

        The URL of the screenshot image.

        `format: uri`

    - `type: "computer_call_output"`

      The type of the computer tool call output. Always `computer_call_output`.

      - `"computer_call_output"`

    - `id?: string | null`

      The ID of the computer tool call output.

    - `acknowledged_safety_checks?: Array<AcknowledgedSafetyCheck> | null`

      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.

    - `status?: "in_progress" | "completed" | "incomplete" | null`

      The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `BetaResponseFunctionWebSearch`

    The results of a web search tool call. See the
    [web search guide](/api/docs/guides/tools-web-search) for more information.

    - `id: string`

      The unique ID of the web search tool call.

    - `action: Search | OpenPage | FindInPage`

      An object describing the specific action taken in this web search call.
      Includes details on how the model used the web (search, open_page, find_in_page).

      - `Search`

        Action type "search" - Performs a web search query.

        - `type: "search"`

          The action type.

          - `"search"`

        - `queries?: Array<string>`

          The search queries.

        - `query?: string`

          The search query.

        - `sources?: Array<Source>`

          The sources used in the search.

          - `type: "url"`

            The type of source. Always `url`.

            - `"url"`

          - `url: string`

            The URL of the source.

            `format: uri`

      - `OpenPage`

        Action type "open_page" - Opens a specific URL from search results.

        - `type: "open_page"`

          The action type.

          - `"open_page"`

        - `url?: string | null`

          The URL opened by the model.

          `format: uri`

      - `FindInPage`

        Action type "find_in_page": Searches for a pattern within a loaded page.

        - `pattern: string`

          The pattern or text to search for within the page.

        - `type: "find_in_page"`

          The action type.

          - `"find_in_page"`

        - `url: string`

          The URL of the page searched for the pattern.

          `format: uri`

    - `status: "in_progress" | "searching" | "completed" | 2 more`

      The status of the web search tool call.

      - `"in_progress"`

      - `"searching"`

      - `"completed"`

      - `"failed"`

      - `"incomplete"`

    - `type: "web_search_call"`

      The type of the web search tool call. Always `web_search_call`.

      - `"web_search_call"`

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseFunctionToolCall`

    A tool call to run a function. See the
    [function calling guide](/api/docs/guides/function-calling) 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`.

      - `"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.

    - `async?: boolean`

      Whether the function tool call runs asynchronously.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `FunctionCallOutput`

    The output of a function tool call.

    - `output: string | BetaResponseFunctionCallOutputItemList`

      Text, image, or file output of the function tool call.

      - `string`

      - `BetaResponseFunctionCallOutputItemList = Array<BetaResponseFunctionCallOutputItem>`

        An array of content outputs (text, image, file) for the function tool call.

        - `BetaResponseInputTextContent`

          A text input to the model.

          - `text: string`

            The text input to the model.

            `maxLength: 10485760`

          - `type: "input_text"`

            The type of the input item. Always `input_text`.

            - `"input_text"`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputImageContent`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

          - `type: "input_image"`

            The type of the input item. Always `input_image`.

            - `"input_image"`

          - `detail?: BetaImageDetail | null`

            The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

          - `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.

            `maxLength: 20971520`, `format: uri`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputFileContent`

          A file input to the model.

          - `type: "input_file"`

            The type of the input item. Always `input_file`.

            - `"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`.

            - `"auto"`

            - `"low"`

            - `"high"`

          - `file_data?: string | null`

            The base64-encoded data of the file to be sent to the model.

            `maxLength: 73400320`

          - `file_id?: string | null`

            The ID of the file to be sent to the model.

          - `file_url?: string | null`

            The URL of the file to be sent to the model.

            `format: uri`

          - `filename?: string | null`

            The name of the file to be sent to the model.

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

    - `type: "function_call_output"`

      The type of the function tool call output. Always `function_call_output`.

      - `"function_call_output"`

    - `id?: string | null`

      The unique ID of the function tool call output. Populated when this item is returned via API.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `call_id?: string | null`

      The unique ID of the function tool call generated by the model.

      `minLength: 1`, `maxLength: 64`

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

          `minLength: 1`, `maxLength: 64`

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

    - `name?: string | null`

      The name of the tool that produced the output.

      `minLength: 1`, `maxLength: 128`

    - `namespace?: string | null`

      The namespace of the tool that produced the output.

      `minLength: 1`, `maxLength: 128`

    - `status?: "in_progress" | "completed" | "incomplete" | null`

      The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `AgentMessage`

    A message routed between agents.

    - `author: string`

      The sending agent identity.

    - `content: Array<BetaResponseInputTextContent | BetaResponseInputImageContent | EncryptedContent>`

      Plaintext, image, or encrypted content sent between agents.

      - `BetaResponseInputTextContent`

        A text input to the model.

      - `BetaResponseInputImageContent`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

      - `EncryptedContent`

        Opaque encrypted content that Responses API decrypts inside trusted model execution.

        - `encrypted_content: string`

          Opaque encrypted content.

          `maxLength: 10485760`

        - `type: "encrypted_content"`

          The type of the input item. Always `encrypted_content`.

          - `"encrypted_content"`

    - `recipient: string`

      The destination agent identity.

    - `type: "agent_message"`

      The item type. Always `agent_message`.

      - `"agent_message"`

    - `id?: string | null`

      The unique ID of this agent message item.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `MultiAgentCall`

    - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

      The multi-agent action that was executed.

      - `"spawn_agent"`

      - `"interrupt_agent"`

      - `"list_agents"`

      - `"send_message"`

      - `"followup_task"`

      - `"wait_agent"`

    - `arguments: string`

      The action arguments as a JSON string.

    - `call_id: string`

      The unique ID linking this call to its output.

      `minLength: 1`, `maxLength: 64`

    - `type: "multi_agent_call"`

      The item type. Always `multi_agent_call`.

      - `"multi_agent_call"`

    - `id?: string | null`

      The unique ID of this multi-agent call.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `MultiAgentCallOutput`

    - `action: "spawn_agent" | "interrupt_agent" | "list_agents" | 3 more`

      The multi-agent action that produced this result.

      - `"spawn_agent"`

      - `"interrupt_agent"`

      - `"list_agents"`

      - `"send_message"`

      - `"followup_task"`

      - `"wait_agent"`

    - `call_id: string`

      The unique ID of the multi-agent call.

      `minLength: 1`, `maxLength: 64`

    - `output: Array<Output>`

      Text output returned by the multi-agent action.

      - `text: string`

        The text content.

        `maxLength: 10485760`

      - `type: "output_text"`

        The content type. Always `output_text`.

        - `"output_text"`

      - `annotations?: Array<FileCitation | URLCitation | ContainerFileCitation>`

        Citations associated with the text content.

        - `FileCitation`

          - `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.

            `minimum: 0`

          - `type: "file_citation"`

            The citation type. Always `file_citation`.

            - `"file_citation"`

        - `URLCitation`

          - `end_index: number`

            The index of the last character of the citation in the message.

            `minimum: 0`

          - `start_index: number`

            The index of the first character of the citation in the message.

            `minimum: 0`

          - `title: string`

            The title of the cited resource.

          - `type: "url_citation"`

            The citation type. Always `url_citation`.

            - `"url_citation"`

          - `url: string`

            The URL of the cited resource.

            `format: uri`

        - `ContainerFileCitation`

          - `container_id: string`

            The ID of the container.

          - `end_index: number`

            The index of the last character of the citation in the message.

            `minimum: 0`

          - `file_id: string`

            The ID of the container file.

          - `filename: string`

            The filename of the container file cited.

          - `start_index: number`

            The index of the first character of the citation in the message.

            `minimum: 0`

          - `type: "container_file_citation"`

            The citation type. Always `container_file_citation`.

            - `"container_file_citation"`

    - `type: "multi_agent_call_output"`

      The item type. Always `multi_agent_call_output`.

      - `"multi_agent_call_output"`

    - `id?: string | null`

      The unique ID of this multi-agent call output.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ToolSearchCall`

    - `arguments: unknown`

      The arguments supplied to the tool search call.

    - `type: "tool_search_call"`

      The item type. Always `tool_search_call`.

      - `"tool_search_call"`

    - `id?: string | null`

      The unique ID of this tool search call.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `call_id?: string | null`

      The unique ID of the tool search call generated by the model.

      `minLength: 1`, `maxLength: 64`

    - `execution?: "server" | "client"`

      Whether tool search was executed by the server or by the client.

      - `"server"`

      - `"client"`

    - `status?: "in_progress" | "completed" | "incomplete" | null`

      The status of the tool search call.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `BetaResponseToolSearchOutputItemParam`

    - `tools: Array<BetaFunctionTool | BetaFileSearchTool | BetaComputerTool | 13 more>`

      The loaded tool definitions returned by the tool search output.

      - `BetaFunctionTool`

        Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

          - `"function"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async?: boolean`

        - `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`

        A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `type: "file_search"`

          The type of the file search tool. Always `file_search`.

          - `"file_search"`

        - `vector_store_ids: Array<string>`

          The IDs of the vector stores to search.

        - `filters?: ComparisonFilter | CompoundFilter | null`

          A filter to apply.

          - `ComparisonFilter`

            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

              - `"eq"`

              - `"ne"`

              - `"gt"`

              - `"gte"`

              - `"lt"`

              - `"lte"`

              - `"in"`

              - `"nin"`

            - `value: string | number | boolean | Array<string | number>`

              The value to compare against the attribute key; supports string, number, or boolean types.

              - `string`

              - `number`

              - `boolean`

              - `Array<string | number>`

                - `string`

                - `number`

          - `CompoundFilter`

            Combine multiple filters using `and` or `or`.

            - `filters: Array<ComparisonFilter | unknown>`

              Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

              - `ComparisonFilter`

                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

                  - `"eq"`

                  - `"ne"`

                  - `"gt"`

                  - `"gte"`

                  - `"lt"`

                  - `"lte"`

                  - `"in"`

                  - `"nin"`

                - `value: string | number | boolean | Array<string | number>`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `Array<string | number>`

                    - `string`

                    - `number`

              - `unknown`

            - `type: "and" | "or"`

              Type of operation: `and` or `or`.

              - `"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`

          Ranking options for search.

          - `hybrid_search?: HybridSearch`

            Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

            - `embedding_weight: number`

              The weight of the embedding in the reciprocal ranking fusion.

            - `text_weight: number`

              The weight of the text in the reciprocal ranking fusion.

          - `ranker?: "auto" | "default-2024-11-15"`

            The ranker to use for the file search.

            - `"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`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `type: "computer"`

          The type of the computer tool. Always `computer`.

          - `"computer"`

      - `BetaComputerUsePreviewTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `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.

          - `"windows"`

          - `"mac"`

          - `"linux"`

          - `"ubuntu"`

          - `"browser"`

        - `type: "computer_use_preview"`

          The type of the computer use tool. Always `computer_use_preview`.

          - `"computer_use_preview"`

      - `BetaWebSearchTool`

        Search the Internet for sources related to the prompt. Learn more about the
        [web search tool](/api/docs/guides/tools-web-search).

        - `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`.

          - `"web_search"`

          - `"web_search_2025_08_26"`

        - `external_web_access?: boolean`

          Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

        - `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.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `user_location?: UserLocation | null`

          The approximate location of the user. If omitted or null, defaults to the
          United States. To avoid this fallback, pass `{"type": "approximate"}` without
          location fields. To localize results, provide the relevant location fields.

          - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `type?: "approximate"`

            The type of location approximation. Always `approximate`.

            - `"approximate"`

      - `Mcp`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

          - `"mcp"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools?: Array<string> | McpToolFilter | null`

          List of allowed tool names or a filter object.

          - `Array<string>`

          - `McpToolFilter`

            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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

          This field is deprecated for models released after September 1, 2026.
          Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
          connect through a Secure MCP Tunnel.

          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`

          - `"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" | null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter`

            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`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                it will match this filter.

              - `tool_names?: Array<string>`

                List of allowed tool names.

            - `never?: Never`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

          `format: uri`

        - `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`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string | CodeInterpreterToolAuto`

          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.

          - `string`

          - `CodeInterpreterToolAuto`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids?: Array<string>`

              An optional list of uploaded files to make available to your code.

              `maxItems: 50`

            - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled`

                - `type: "disabled"`

                  Disable outbound network access. Always `disabled`.

                  - `"disabled"`

              - `BetaContainerNetworkPolicyAllowlist`

                - `allowed_domains: Array<string>`

                  A list of allowed domains when type is `allowlist`.

                  `minItems: 1`

                - `type: "allowlist"`

                  Allow outbound network access only to specified domains. Always `allowlist`.

                  - `"allowlist"`

                - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                  Optional domain-scoped secrets for allowlisted domains.

                  `minItems: 1`

                  - `domain: string`

                    The domain associated with the secret.

                    `minLength: 1`

                  - `name: string`

                    The name of the secret to inject for the domain.

                    `minLength: 1`

                  - `value: string`

                    The secret value to inject for the domain.

                    `minLength: 1`, `maxLength: 10485760`

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action?: "generate" | "edit" | "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background?: "transparent" | "opaque" | "auto"`

          Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
          `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
          Transparent backgrounds are available for supported GPT Image models. For
          `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
          using `transparent`, set the output format to `png` or `webp`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `complexity?: "low" | "medium" | "high"`

          Computation spent planning the image, independently of rendering quality.
          Overrides the outer response's `reasoning.effort` for image generation.
          When omitted, inherits a supported outer reasoning effort or uses the
          image model's configured default.
          For SVG output, controls the reference image, not the SVG author's
          reasoning.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `frame_count?: number`

          Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

          `minimum: 2`, `maximum: 16`

        - `frame_duration_ms?: number`

          Duration of each GIF frame in milliseconds, rounded to 10 ms.
          Requires `output_format` to be `gif`. Default: 200.

          `minimum: 20`, `maximum: 2000`

        - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

          - `"high"`

          - `"low"`

        - `input_image_mask?: InputImageMask`

          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" | 9 more`

          The image generation model to use. One of `gpt-image-1-mini`,
          `gpt-image-1.5`, `gpt-image-2`,
          `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
          `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
          `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
          `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
          `gpt-image-2`.

          `gpt-image-1` was shut down on October 23, 2026. Use
          `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

          Deprecated values:

          - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

          - `(string & {})`

          - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

            The image generation model to use. One of `gpt-image-1-mini`,
            `gpt-image-1.5`, `gpt-image-2`,
            `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
            `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
            `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
            `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
            `gpt-image-2`.

            `gpt-image-1` was shut down on October 23, 2026. Use
            `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

            - `"gpt-image-1"`

            - `"gpt-image-1-mini"`

            - `"gpt-image-2"`

            - `"gpt-image-2-2026-04-21"`

            - `"gpt-image-2.5-sunburst"`

            - `"gpt-image-2.5-sunburst-2026-09-08"`

            - `"gpt-image-2.5-flare"`

            - `"gpt-image-2.5-flare-2026-09-08"`

            - `"gpt-image-2.6-sunburst"`

            - `"gpt-image-2.6-flare"`

            - `"gpt-image-1.5"`

            - `"chatgpt-image-latest"`

        - `moderation?: "auto" | "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression?: number`

          Compression level for the output image. Default: 100.

          `minimum: 0`, `maximum: 100`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more`

          The output format of the generated image. One of `png`, `webp`, `jpeg`,
          `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
          that supports the selected format. GIF output does not support
          partial image streaming (`partial_images` greater than `0`),
          `input_image_mask`, or custom `output_compression`.
          Responses lifecycle events can still be streamed for GIF output.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `partial_images?: number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          `minimum: 0`, `maximum: 3`

        - `quality?: "low" | "medium" | "high" | 3 more`

          The quality of the generated image. The GPT image models support `low`,
          `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
          including their `2026-09-08` snapshots, also support `xhigh` and `max`.
          Default: `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

          The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

        - `svg?: Svg`

          SVG author model settings. Requires `output_format` to be `svg`.
          When SVG model selection is enabled, omitting this object uses the
          outer response model. Otherwise, the default SVG author is used and
          explicit model overrides are unavailable.

          - `model?: string`

            `minLength: 1`

          - `reasoning?: Reasoning | null`

            Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

            - `effort?: "none" | "minimal" | "low" | 4 more`

              Controls how much effort the model should spend on reasoning for this request.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

      - `LocalShell`

        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`.

          - `"local_shell"`

      - `BetaFunctionShellTool`

        A tool that allows the model to execute shell commands.

        - `type: "shell"`

          The type of the shell tool. Always `shell`.

          - `"shell"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

        - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

          - `BetaContainerAuto`

            - `type: "container_auto"`

              Automatically creates a container for this request

              - `"container_auto"`

            - `file_ids?: Array<string>`

              An optional list of uploaded files to make available to your code.

              `maxItems: 50`

            - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

              The memory limit for the container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled`

              - `BetaContainerNetworkPolicyAllowlist`

            - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

              An optional list of skills referenced by id or inline data.

              `maxItems: 200`

              - `BetaSkillReference`

                - `skill_id: string`

                  The ID of the referenced skill.

                  `minLength: 1`, `maxLength: 64`

                - `type: "skill_reference"`

                  References a skill created with the /v1/skills endpoint.

                  - `"skill_reference"`

                - `version?: string`

                  Optional skill version. Use a positive integer or 'latest'. Omit for default.

              - `BetaInlineSkill`

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `source: BetaInlineSkillSource`

                  Inline skill payload

                  - `data: string`

                    Base64-encoded skill zip bundle.

                    `minLength: 1`, `maxLength: 70254592`

                  - `media_type: "application/zip"`

                    The media type of the inline skill payload. Must be `application/zip`.

                    - `"application/zip"`

                  - `type: "base64"`

                    The type of the inline skill source. Must be `base64`.

                    - `"base64"`

                - `type: "inline"`

                  Defines an inline skill for this request.

                  - `"inline"`

          - `BetaLocalEnvironment`

            - `type: "local"`

              Use a local computer environment.

              - `"local"`

            - `skills?: Array<BetaLocalSkill>`

              An optional list of skills.

              `maxItems: 200`

              - `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: string`

              The ID of the referenced container.

            - `type: "container_reference"`

              References a container created with the /v1/containers endpoint

              - `"container_reference"`

      - `BetaCustomTool`

        A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

          - `"custom"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

        - `async?: boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `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 | Grammar`

          The input format for the custom tool. Default is unconstrained text.

          - `Text`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar`

            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`.

              - `"lark"`

              - `"regex"`

            - `type: "grammar"`

              Grammar format. Always `grammar`.

              - `"grammar"`

      - `BetaToolSearchOutputNamespaceTool`

        Groups function/custom tools under a shared namespace.

        - `description: string`

          A description of the namespace shown to the model.

        - `name: string`

          The namespace name used in tool calls (for example, `crm`).

          `minLength: 1`

        - `tools: Array<Function | BetaCustomTool>`

          The function/custom tools loaded inside this namespace.

          `minItems: 1`

          - `Function`

            - `name: string`

              The name of the loaded function tool.

              `minLength: 1`, `maxLength: 128`

            - `type: "function"`

              - `"function"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `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`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `type: "namespace"`

          The type of the tool. Always `namespace`.

          - `"namespace"`

      - `BetaToolSearchTool`

        Hosted or BYOT tool search configuration for deferred tools.

        - `type: "tool_search"`

          The type of the tool. Always `tool_search`.

          - `"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.

          - `"server"`

          - `"client"`

        - `parameters?: unknown`

          Parameter schema for a client-executed tool search tool.

      - `BetaWebSearchPreviewTool`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `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`.

          - `"web_search_preview"`

          - `"web_search_preview_2025_03_11"`

        - `search_content_types?: Array<"text" | "image">`

          - `"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.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `user_location?: UserLocation | null`

          The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

          - `type: "approximate"`

            The type of location approximation. Always `approximate`.

            - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `BetaApplyPatchTool`

        Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "apply_patch"`

          The type of the tool. Always `apply_patch`.

          - `"apply_patch"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

    - `type: "tool_search_output"`

      The item type. Always `tool_search_output`.

      - `"tool_search_output"`

    - `id?: string | null`

      The unique ID of this tool search output.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `call_id?: string | null`

      The unique ID of the tool search call generated by the model.

      `minLength: 1`, `maxLength: 64`

    - `execution?: "server" | "client"`

      Whether tool search was executed by the server or by the client.

      - `"server"`

      - `"client"`

    - `status?: "in_progress" | "completed" | "incomplete" | null`

      The status of the tool search output.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `AdditionalTools`

    - `role: "developer"`

      The role that provided the additional tools. Only `developer` is supported.

      - `"developer"`

    - `tools: Array<BetaTool>`

      A list of additional tools made available at this item.

      - `BetaFunctionTool`

        Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

      - `BetaFileSearchTool`

        A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

      - `BetaComputerTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaComputerUsePreviewTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaWebSearchTool`

        Search the Internet for sources related to the prompt. Learn more about the
        [web search tool](/api/docs/guides/tools-web-search).

      - `Mcp`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

          - `"mcp"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools?: Array<string> | McpToolFilter | null`

          List of allowed tool names or a filter object.

          - `Array<string>`

          - `McpToolFilter`

            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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

          This field is deprecated for models released after September 1, 2026.
          Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
          connect through a Secure MCP Tunnel.

          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`

          - `"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" | null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter`

            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`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                it will match this filter.

              - `tool_names?: Array<string>`

                List of allowed tool names.

            - `never?: Never`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

          `format: uri`

        - `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`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string | CodeInterpreterToolAuto`

          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.

          - `string`

          - `CodeInterpreterToolAuto`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids?: Array<string>`

              An optional list of uploaded files to make available to your code.

              `maxItems: 50`

            - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled`

              - `BetaContainerNetworkPolicyAllowlist`

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action?: "generate" | "edit" | "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background?: "transparent" | "opaque" | "auto"`

          Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
          `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
          Transparent backgrounds are available for supported GPT Image models. For
          `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
          using `transparent`, set the output format to `png` or `webp`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `complexity?: "low" | "medium" | "high"`

          Computation spent planning the image, independently of rendering quality.
          Overrides the outer response's `reasoning.effort` for image generation.
          When omitted, inherits a supported outer reasoning effort or uses the
          image model's configured default.
          For SVG output, controls the reference image, not the SVG author's
          reasoning.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `frame_count?: number`

          Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

          `minimum: 2`, `maximum: 16`

        - `frame_duration_ms?: number`

          Duration of each GIF frame in milliseconds, rounded to 10 ms.
          Requires `output_format` to be `gif`. Default: 200.

          `minimum: 20`, `maximum: 2000`

        - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

          - `"high"`

          - `"low"`

        - `input_image_mask?: InputImageMask`

          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" | 9 more`

          The image generation model to use. One of `gpt-image-1-mini`,
          `gpt-image-1.5`, `gpt-image-2`,
          `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
          `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
          `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
          `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
          `gpt-image-2`.

          `gpt-image-1` was shut down on October 23, 2026. Use
          `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

          Deprecated values:

          - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

          - `(string & {})`

          - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

            The image generation model to use. One of `gpt-image-1-mini`,
            `gpt-image-1.5`, `gpt-image-2`,
            `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
            `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
            `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
            `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
            `gpt-image-2`.

            `gpt-image-1` was shut down on October 23, 2026. Use
            `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

            - `"gpt-image-1"`

            - `"gpt-image-1-mini"`

            - `"gpt-image-2"`

            - `"gpt-image-2-2026-04-21"`

            - `"gpt-image-2.5-sunburst"`

            - `"gpt-image-2.5-sunburst-2026-09-08"`

            - `"gpt-image-2.5-flare"`

            - `"gpt-image-2.5-flare-2026-09-08"`

            - `"gpt-image-2.6-sunburst"`

            - `"gpt-image-2.6-flare"`

            - `"gpt-image-1.5"`

            - `"chatgpt-image-latest"`

        - `moderation?: "auto" | "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression?: number`

          Compression level for the output image. Default: 100.

          `minimum: 0`, `maximum: 100`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more`

          The output format of the generated image. One of `png`, `webp`, `jpeg`,
          `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
          that supports the selected format. GIF output does not support
          partial image streaming (`partial_images` greater than `0`),
          `input_image_mask`, or custom `output_compression`.
          Responses lifecycle events can still be streamed for GIF output.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `partial_images?: number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          `minimum: 0`, `maximum: 3`

        - `quality?: "low" | "medium" | "high" | 3 more`

          The quality of the generated image. The GPT image models support `low`,
          `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
          including their `2026-09-08` snapshots, also support `xhigh` and `max`.
          Default: `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

          The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

        - `svg?: Svg`

          SVG author model settings. Requires `output_format` to be `svg`.
          When SVG model selection is enabled, omitting this object uses the
          outer response model. Otherwise, the default SVG author is used and
          explicit model overrides are unavailable.

          - `model?: string`

            `minLength: 1`

          - `reasoning?: Reasoning | null`

            Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

            - `effort?: "none" | "minimal" | "low" | 4 more`

              Controls how much effort the model should spend on reasoning for this request.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

      - `LocalShell`

        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`.

          - `"local_shell"`

      - `BetaFunctionShellTool`

        A tool that allows the model to execute shell commands.

      - `BetaCustomTool`

        A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

      - `BetaNamespaceTool`

        Groups function/custom tools under a shared namespace.

        - `description: string`

          A description of the namespace shown to the model.

        - `name: string`

          The namespace name used in tool calls (for example, `crm`).

          `minLength: 1`

        - `tools: Array<Function | BetaCustomTool>`

          The function/custom tools available inside this namespace.

          `minItems: 1`

          - `Function`

            - `name: string`

              `minLength: 1`, `maxLength: 128`

            - `type: "function"`

              - `"function"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `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`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `type: "namespace"`

          The type of the tool. Always `namespace`.

          - `"namespace"`

      - `BetaToolSearchTool`

        Hosted or BYOT tool search configuration for deferred tools.

      - `BetaWebSearchPreviewTool`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

      - `BetaApplyPatchTool`

        Allows the assistant to create, delete, or update files using unified diffs.

    - `type: "additional_tools"`

      The item type. Always `additional_tools`.

      - `"additional_tools"`

    - `id?: string | null`

      The unique ID of this additional tools item.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseConfigurationUpdateItemParam`

    An update to the conversation's response configuration. Supply reasoning,
    text, or both. Each setting stays in effect until a later update replaces it.

    - `type: "configuration_update"`

      The item type. Always `configuration_update`.

      - `"configuration_update"`

    - `id?: string | null`

      The unique ID of the configuration update item.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `reasoning?: Reasoning`

      Updates to reasoning configuration. Only effort is supported.

      - `effort?: "none" | "minimal" | "low" | 4 more | null`

        The reasoning effort to use for subsequent responses until another
        configuration update replaces it.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

    - `text?: Text`

      The text output configuration for subsequent responses.

      - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

        Use a JSON schema for structured output or text to return to plain text.

        - `Text`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig`

          JSON Schema response format. Used to generate structured JSON responses.
          Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

          - `name: string`

            The name of the response format. Must be a-z, A-Z, 0-9, or contain
            underscores and dashes, with a maximum length of 64.

          - `schema: Record<string, unknown>`

            The schema for the response format, described as a JSON Schema object.
            Learn how to build JSON schemas [here](https://json-schema.org/).

          - `type: "json_schema"`

            The type of response format being defined. Always `json_schema`.

            - `"json_schema"`

          - `description?: string`

            A description of what the response format is for, used by the model to
            determine how to respond in the format.

          - `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](/api/docs/guides/structured-outputs).

  - `BetaResponseReasoningItem`

    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](/api/docs/guides/conversation-state).

    - `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`.

        - `"summary_text"`

    - `type: "reasoning"`

      The type of the object. Always `reasoning`.

      - `"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`.

        - `"reasoning_text"`

    - `encrypted_content?: string | null`

      The encrypted content of the reasoning item. This is populated by default
      for reasoning items returned by `POST /v1/responses` and WebSocket
      `response.create` requests.

      When streaming, use the completed reasoning item and its
      `encrypted_content` from the `response.output_item.done` event in
      subsequent requests. The `encrypted_content` in
      `response.output_item.added` may be incomplete. This is especially
      important when `store` is `false` or when using Zero Data Retention.

    - `status?: "in_progress" | "completed" | "incomplete"`

      The status of the item. One of `in_progress`, `completed`, or
      `incomplete`. Populated when items are returned via API.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `BetaResponseCompactionItemParam`

    A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

    - `encrypted_content: string`

      The encrypted content of the compaction summary.

      `maxLength: 104857600`

    - `type: "compaction"`

      The type of the item. Always `compaction`.

      - `"compaction"`

    - `id?: string | null`

      The ID of the compaction item.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ImageGenerationCall`

    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.

      - `"in_progress"`

      - `"completed"`

      - `"generating"`

      - `"failed"`

    - `type: "image_generation_call"`

      The type of the image generation call. Always `image_generation_call`.

      - `"image_generation_call"`

    - `action?: "generate" | "edit" | "auto" | null`

      The action used for image generation.

      - `"generate"`

      - `"edit"`

      - `"auto"`

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `background?: "transparent" | "opaque" | "auto" | null`

      The background setting used for generation.

      - `"transparent"`

      - `"opaque"`

      - `"auto"`

    - `error?: Error`

      Details of a moderation failure, when available.

      - `code: string | null`

        The error code.

      - `message: string`

        A description of the error.

      - `param: string | null`

        The related request parameter.

      - `type: string`

        The error type.

      - `moderation_details?: ModerationDetails`

        Public details for a `moderation_blocked` error, when available.

        - `categories: Array<string>`

          Public moderation categories. New category values may be added over time.

        - `moderation_stage: "input" | "output" | "unknown"`

          The stage where moderation blocked the image generation call.

          - `"input"`

          - `"output"`

          - `"unknown"`

    - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

      The output format used for generation.

      - `"png"`

      - `"webp"`

      - `"jpeg"`

      - `"gif"`

      - `"svg"`

    - `quality?: "low" | "medium" | "high" | 3 more | null`

      The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

      - `"auto"`

    - `revised_prompt?: string | null`

      The prompt that was used after any model prompt rewriting.

    - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

      The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

      - `(string & {})`

      - `"1024x1024" | "1024x1536" | "1536x1024"`

        - `"1024x1024"`

        - `"1024x1536"`

        - `"1536x1024"`

    - `svg_usage?: SvgUsage`

      - `input_tokens: number`

      - `model: string`

      - `output_tokens: number`

      - `reasoning_tokens: number`

      - `total_tokens: number`

  - `BetaResponseCodeInterpreterToolCall`

    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 | Image> | null`

      The outputs generated by the code interpreter, such as logs or images.
      Can be null if no outputs are available.

      - `Logs`

        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`.

          - `"logs"`

      - `Image`

        The image output from the code interpreter.

        - `type: "image"`

          The type of the output. Always `image`.

          - `"image"`

        - `url: string`

          The URL of the image output from the code interpreter.

          `format: uri`

    - `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`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

      - `"interpreting"`

      - `"failed"`

    - `type: "code_interpreter_call"`

      The type of the code interpreter tool call. Always `code_interpreter_call`.

      - `"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`

    A tool call to run a command on the local shell.

    - `id: string`

      The unique ID of the local shell call.

    - `action: Action`

      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`.

        - `"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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "local_shell_call"`

      The type of the local shell call. Always `local_shell_call`.

      - `"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`

    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`.

      - `"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`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `ShellCall`

    A tool representing a request to execute one or more shell commands.

    - `action: Action`

      The shell commands and limits that describe how to run the tool call.

      - `commands: Array<string>`

        Ordered shell commands for the execution environment to run.

      - `max_output_length?: number | null`

        Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

      - `timeout_ms?: number | null`

        Maximum wall-clock time in milliseconds to allow the shell commands to run.

    - `call_id: string`

      The unique ID of the shell tool call generated by the model.

      `minLength: 1`, `maxLength: 64`

    - `type: "shell_call"`

      The type of the item. Always `shell_call`.

      - `"shell_call"`

    - `id?: string | null`

      The unique ID of the shell tool call. Populated when this item is returned via API.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

          `minLength: 1`, `maxLength: 64`

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

    - `environment?: BetaLocalEnvironment | BetaContainerReference | null`

      The environment to execute the shell commands in.

      - `BetaLocalEnvironment`

      - `BetaContainerReference`

    - `status?: "in_progress" | "completed" | "incomplete" | null`

      The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `ShellCallOutput`

    The streamed output items emitted by a shell tool call.

    - `call_id: string`

      The unique ID of the shell tool call generated by the model.

      `minLength: 1`, `maxLength: 64`

    - `output: Array<BetaResponseFunctionShellCallOutputContent>`

      Captured chunks of stdout and stderr output, along with their associated outcomes.

      - `outcome: Timeout | Exit`

        The exit or timeout outcome associated with this shell call.

        - `Timeout`

          Indicates that the shell call exceeded its configured time limit.

          - `type: "timeout"`

            The outcome type. Always `timeout`.

            - `"timeout"`

        - `Exit`

          Indicates that the shell commands finished and returned an exit code.

          - `exit_code: number`

            The exit code returned by the shell process.

          - `type: "exit"`

            The outcome type. Always `exit`.

            - `"exit"`

      - `stderr: string`

        Captured stderr output for the shell call.

        `maxLength: 10485760`

      - `stdout: string`

        Captured stdout output for the shell call.

        `maxLength: 10485760`

    - `type: "shell_call_output"`

      The type of the item. Always `shell_call_output`.

      - `"shell_call_output"`

    - `id?: string | null`

      The unique ID of the shell tool call output. Populated when this item is returned via API.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

          `minLength: 1`, `maxLength: 64`

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

    - `max_output_length?: number | null`

      The maximum number of UTF-8 characters captured for this shell call's combined output.

    - `status?: "in_progress" | "completed" | "incomplete" | null`

      The status of the shell call output.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `ApplyPatchCall`

    A tool call representing a request to create, delete, or update files using diff patches.

    - `call_id: string`

      The unique ID of the apply patch tool call generated by the model.

      `minLength: 1`, `maxLength: 64`

    - `operation: CreateFile | DeleteFile | UpdateFile`

      The specific create, delete, or update instruction for the apply_patch tool call.

      - `CreateFile`

        Instruction for creating a new file via the apply_patch tool.

        - `diff: string`

          Unified diff content to apply when creating the file.

          `maxLength: 10485760`

        - `path: string`

          Path of the file to create relative to the workspace root.

          `minLength: 1`

        - `type: "create_file"`

          The operation type. Always `create_file`.

          - `"create_file"`

      - `DeleteFile`

        Instruction for deleting an existing file via the apply_patch tool.

        - `path: string`

          Path of the file to delete relative to the workspace root.

          `minLength: 1`

        - `type: "delete_file"`

          The operation type. Always `delete_file`.

          - `"delete_file"`

      - `UpdateFile`

        Instruction for updating an existing file via the apply_patch tool.

        - `diff: string`

          Unified diff content to apply to the existing file.

          `maxLength: 10485760`

        - `path: string`

          Path of the file to update relative to the workspace root.

          `minLength: 1`

        - `type: "update_file"`

          The operation type. Always `update_file`.

          - `"update_file"`

    - `status: "in_progress" | "completed"`

      The status of the apply patch tool call. One of `in_progress` or `completed`.

      - `"in_progress"`

      - `"completed"`

    - `type: "apply_patch_call"`

      The type of the item. Always `apply_patch_call`.

      - `"apply_patch_call"`

    - `id?: string | null`

      The unique ID of the apply patch tool call. Populated when this item is returned via API.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

          `minLength: 1`, `maxLength: 64`

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

  - `ApplyPatchCallOutput`

    The streamed output emitted by an apply patch tool call.

    - `call_id: string`

      The unique ID of the apply patch tool call generated by the model.

      `minLength: 1`, `maxLength: 64`

    - `status: "completed" | "failed"`

      The status of the apply patch tool call output. One of `completed` or `failed`.

      - `"completed"`

      - `"failed"`

    - `type: "apply_patch_call_output"`

      The type of the item. Always `apply_patch_call_output`.

      - `"apply_patch_call_output"`

    - `id?: string | null`

      The unique ID of the apply patch tool call output. Populated when this item is returned via API.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

          `minLength: 1`, `maxLength: 64`

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

    - `output?: string | null`

      Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

      `maxLength: 10485760`

  - `McpListTools`

    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`.

      - `"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`

    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`.

      - `"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`

    A response to an MCP approval request.

    - `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`.

      - `"mcp_approval_response"`

    - `id?: string | null`

      The unique ID of the 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.

  - `McpCall`

    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`.

      - `"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?: BetaMcpToolCallError | null`

      The error from the tool call, if any.

      - `McpProtocolError`

        - `code: number`

        - `message: string`

        - `type: "mcp_protocol_error"`

          - `"mcp_protocol_error"`

      - `McpToolExecutionError`

        - `content: unknown`

        - `type: "mcp_tool_execution_error"`

          - `"mcp_tool_execution_error"`

      - `HTTPError`

        - `code: number`

        - `message: string`

        - `type: "http_error"`

          - `"http_error"`

    - `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`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

      - `"calling"`

      - `"failed"`

  - `BetaResponseCustomToolCallOutput`

    The output of a custom tool call from your code, being sent back to the model.

    - `call_id: string`

      The call ID, used to map this custom tool call output to a custom tool call.

    - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

      The output from the custom tool call generated by your code.
      Can be a string or an list of output content.

      - `string`

      - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile`

          A file input to the model.

    - `type: "custom_tool_call_output"`

      The type of the custom tool call output. Always `custom_tool_call_output`.

      - `"custom_tool_call_output"`

    - `id?: string`

      The unique ID of the custom tool call output 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 | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

          `minLength: 1`, `maxLength: 64`

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

  - `BetaResponseCustomToolCall`

    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`.

      - `"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.

    - `async?: boolean`

      Whether the custom tool call runs asynchronously.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `namespace?: string`

      The namespace of the custom tool being called.

  - `CompactionTrigger`

    Compacts the current context. Must be the final input item.

    - `type: "compaction_trigger"`

      The type of the item. Always `compaction_trigger`.

      - `"compaction_trigger"`

    - `id?: string | null`

      The unique ID of this compaction trigger.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ItemReference`

    An internal identifier for an item to reference.

    - `id: string`

      The ID of the item to reference.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `type?: "item_reference" | null`

      The type of item to reference. Always `item_reference`.

      - `"item_reference"`

  - `Program`

    - `id: string`

      The unique ID of this program item.

    - `call_id: string`

      The stable call ID of the program item.

      `minLength: 1`, `maxLength: 64`

    - `code: string`

      The JavaScript source executed by programmatic tool calling.

      `maxLength: 10485760`

    - `fingerprint: string`

      Opaque program replay fingerprint that must be round-tripped.

      `maxLength: 10485760`

    - `type: "program"`

      The item type. Always `program`.

      - `"program"`

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ProgramOutput`

    - `id: string`

      The unique ID of this program output item.

    - `call_id: string`

      The call ID of the program item.

      `minLength: 1`, `maxLength: 64`

    - `result: string`

      The result produced by the program item.

      `maxLength: 10485760`

    - `status: "completed" | "incomplete"`

      The terminal status of the program output.

      - `"completed"`

      - `"incomplete"`

    - `type: "program_output"`

      The item type. Always `program_output`.

      - `"program_output"`

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

### Beta Response Input Message Content List

- `BetaResponseInputMessageContentList = Array<BetaResponseInputContent>`

  A list of one or many input items to the model, containing different content
  types.

  - `BetaResponseInputText`

    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`.

      - `"input_text"`

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

  - `BetaResponseInputImage`

    An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

    - `detail: BetaImageDetail`

      The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

      - `"low"`

      - `"high"`

      - `"auto"`

      - `"original"`

    - `type: "input_image"`

      The type of the input item. Always `input_image`.

      - `"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.

      `format: uri`

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

  - `BetaResponseInputFile`

    A file input to the model.

    - `type: "input_file"`

      The type of the input item. Always `input_file`.

      - `"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`.

      - `"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.

      `format: uri`

    - `filename?: string`

      The name of the file to be sent to the model.

    - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

      Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

      - `ttl?: "30m" | "12h"`

        The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

        - `"30m"`

        - `"12h"`

### Beta Response Input Message Item

- `BetaResponseInputMessageItem`

  - `id: string`

    The unique ID of the message input.

  - `content: BetaResponseInputMessageContentList`

    A list of one or many input items to the model, containing different content
    types.

    - `BetaResponseInputText`

      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`.

        - `"input_text"`

      - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

        Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

        - `mode: "explicit"`

          The breakpoint mode. Always `explicit`.

          - `"explicit"`

        - `ttl?: "30m" | "12h"`

          The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

          - `"30m"`

          - `"12h"`

    - `BetaResponseInputImage`

      An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

      - `detail: BetaImageDetail`

        The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

        - `"low"`

        - `"high"`

        - `"auto"`

        - `"original"`

      - `type: "input_image"`

        The type of the input item. Always `input_image`.

        - `"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.

        `format: uri`

      - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

        Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

        - `mode: "explicit"`

          The breakpoint mode. Always `explicit`.

          - `"explicit"`

        - `ttl?: "30m" | "12h"`

          The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

          - `"30m"`

          - `"12h"`

    - `BetaResponseInputFile`

      A file input to the model.

      - `type: "input_file"`

        The type of the input item. Always `input_file`.

        - `"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`.

        - `"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.

        `format: uri`

      - `filename?: string`

        The name of the file to be sent to the model.

      - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

        Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

        - `mode: "explicit"`

          The breakpoint mode. Always `explicit`.

          - `"explicit"`

        - `ttl?: "30m" | "12h"`

          The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

          - `"30m"`

          - `"12h"`

  - `role: "user" | "system" | "developer"`

    The role of the message input. One of `user`, `system`, or `developer`.

    - `"user"`

    - `"system"`

    - `"developer"`

  - `type: "message"`

    The type of the message input. Always set to `message`.

    - `"message"`

  - `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"`

    The status of item. One of `in_progress`, `completed`, or
    `incomplete`. Populated when items are returned via API.

    - `"in_progress"`

    - `"completed"`

    - `"incomplete"`

### Beta Response Input Text

- `BetaResponseInputText`

  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`.

    - `"input_text"`

  - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

    Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

    - `mode: "explicit"`

      The breakpoint mode. Always `explicit`.

      - `"explicit"`

    - `ttl?: "30m" | "12h"`

      The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

      - `"30m"`

      - `"12h"`

### Beta Response Input Text Content

- `BetaResponseInputTextContent`

  A text input to the model.

  - `text: string`

    The text input to the model.

    `maxLength: 10485760`

  - `type: "input_text"`

    The type of the input item. Always `input_text`.

    - `"input_text"`

  - `prompt_cache_breakpoint?: PromptCacheBreakpoint | null`

    Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

    - `mode: "explicit"`

      The breakpoint mode. Always `explicit`.

      - `"explicit"`

    - `ttl?: "30m" | "12h"`

      The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

      - `"30m"`

      - `"12h"`

### Beta Response Item

- `BetaResponseItem = BetaResponseInputMessageItem | BetaResponseOutputMessage | BetaResponseFileSearchToolCall | 30 more`

  Content item used to generate a response.

  - `BetaResponseInputMessageItem`

    - `id: string`

      The unique ID of the message input.

    - `content: BetaResponseInputMessageContentList`

      A list of one or many input items to the model, containing different content
      types.

      - `BetaResponseInputText`

        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`.

          - `"input_text"`

        - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

          Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

          - `ttl?: "30m" | "12h"`

            The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

            - `"30m"`

            - `"12h"`

      - `BetaResponseInputImage`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `detail: BetaImageDetail`

          The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

          - `"low"`

          - `"high"`

          - `"auto"`

          - `"original"`

        - `type: "input_image"`

          The type of the input item. Always `input_image`.

          - `"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.

          `format: uri`

        - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

          Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

          - `ttl?: "30m" | "12h"`

            The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

            - `"30m"`

            - `"12h"`

      - `BetaResponseInputFile`

        A file input to the model.

        - `type: "input_file"`

          The type of the input item. Always `input_file`.

          - `"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`.

          - `"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.

          `format: uri`

        - `filename?: string`

          The name of the file to be sent to the model.

        - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

          Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

          - `ttl?: "30m" | "12h"`

            The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

            - `"30m"`

            - `"12h"`

    - `role: "user" | "system" | "developer"`

      The role of the message input. One of `user`, `system`, or `developer`.

      - `"user"`

      - `"system"`

      - `"developer"`

    - `type: "message"`

      The type of the message input. Always set to `message`.

      - `"message"`

    - `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"`

      The status of item. One of `in_progress`, `completed`, or
      `incomplete`. Populated when items are returned via API.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `BetaResponseOutputMessage`

    An output message from the model.

    - `id: string`

      The unique ID of the output message.

    - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

      The content of the output message.

      - `BetaResponseOutputText`

        A text output from the model.

        - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

          The annotations of the text output.

          - `FileCitation`

            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 in the output text at which to insert the file citation.

            - `type: "file_citation"`

              The type of the file citation. Always `file_citation`.

              - `"file_citation"`

          - `URLCitation`

            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_citation"`

            - `url: string`

              The URL of the web resource.

              `format: uri`

          - `ContainerFileCitation`

            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`.

              - `"container_file_citation"`

          - `FilePath`

            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`.

              - `"file_path"`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

          - `"output_text"`

        - `logprobs?: Array<Logprob>`

          - `token: string`

          - `bytes: Array<number>`

          - `logprob: number`

          - `top_logprobs: Array<TopLogprob>`

            - `token: string`

            - `bytes: Array<number>`

            - `logprob: number`

      - `BetaResponseOutputRefusal`

        A refusal from the model.

        - `refusal: string`

          The refusal explanation from the model.

        - `type: "refusal"`

          The type of the refusal. Always `refusal`.

          - `"refusal"`

    - `role: "assistant"`

      The role of the output message. Always `assistant`.

      - `"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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "message"`

      The type of the output message. Always `message`.

      - `"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" | "final_answer" | 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.

      - `"commentary"`

      - `"final_answer"`

  - `BetaResponseFileSearchToolCall`

    The results of a file search tool call. See the
    [file search guide](/api/docs/guides/tools-file-search) 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`,

      - `"in_progress"`

      - `"searching"`

      - `"completed"`

      - `"incomplete"`

      - `"failed"`

    - `type: "file_search_call"`

      The type of the file search tool call. Always `file_search_call`.

      - `"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.

        - `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.

        `format: float`

      - `text?: string`

        The text that was retrieved from the file.

  - `BetaResponseComputerToolCall`

    A tool call to a computer use tool. See the
    [computer use guide](/api/docs/guides/tools-computer-use) 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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "computer_call"`

      The type of the computer call. Always `computer_call`.

      - `"computer_call"`

    - `action?: BetaComputerAction`

      A click action.

      - `Click`

        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`.

          - `"left"`

          - `"right"`

          - `"wheel"`

          - `"back"`

          - `"forward"`

        - `type: "click"`

          Specifies the event type. For a click action, this property is always `click`.

          - `"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`

        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`.

          - `"double_click"`

        - `x: number`

          The x-coordinate where the double click occurred.

        - `y: number`

          The y-coordinate where the double click occurred.

      - `Drag`

        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`.

          - `"drag"`

        - `keys?: Array<string> | null`

          The keys being held while dragging the mouse.

      - `Keypress`

        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`.

          - `"keypress"`

      - `Move`

        A mouse move action.

        - `type: "move"`

          Specifies the event type. For a move action, this property is always set to `move`.

          - `"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`

        A screenshot action.

        - `type: "screenshot"`

          Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

          - `"screenshot"`

      - `Scroll`

        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`.

          - `"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`

        An action to type in text.

        - `text: string`

          The text to type.

        - `type: "type"`

          Specifies the event type. For a type action, this property is always set to `type`.

          - `"type"`

      - `Wait`

        A wait action.

        - `type: "wait"`

          Specifies the event type. For a wait action, this property is always set to `wait`.

          - `"wait"`

    - `actions?: BetaComputerActionList`

      Flattened batched actions for `computer_use`. Each action includes an
      `type` discriminator and action-specific fields.

      - `Click`

        A click action.

      - `DoubleClick`

        A double click action.

      - `Drag`

        A drag action.

      - `Keypress`

        A collection of keypresses the model would like to perform.

      - `Move`

        A mouse move action.

      - `Screenshot`

        A screenshot action.

      - `Scroll`

        A scroll action.

      - `Type`

        An action to type in text.

      - `Wait`

        A wait action.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseComputerToolCallOutputItem`

    - `id: string`

      The ID of the computer tool call output.

    - `call_id: string`

      The ID of the computer tool call that produced the output.

    - `output: BetaResponseComputerToolCallOutputScreenshot`

      A computer screenshot image used with the computer use tool.

      - `type: "computer_screenshot"`

        Specifies the event type. For a computer screenshot, this property is
        always set to `computer_screenshot`.

        - `"computer_screenshot"`

      - `file_id?: string`

        The identifier of an uploaded file that contains the screenshot.

      - `image_url?: string`

        The URL of the screenshot image.

        `format: uri`

    - `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.

      - `"completed"`

      - `"incomplete"`

      - `"failed"`

      - `"in_progress"`

    - `type: "computer_call_output"`

      The type of the computer tool call output. Always `computer_call_output`.

      - `"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.

  - `BetaResponseFunctionWebSearch`

    The results of a web search tool call. See the
    [web search guide](/api/docs/guides/tools-web-search) for more information.

    - `id: string`

      The unique ID of the web search tool call.

    - `action: Search | OpenPage | FindInPage`

      An object describing the specific action taken in this web search call.
      Includes details on how the model used the web (search, open_page, find_in_page).

      - `Search`

        Action type "search" - Performs a web search query.

        - `type: "search"`

          The action type.

          - `"search"`

        - `queries?: Array<string>`

          The search queries.

        - `query?: string`

          The search query.

        - `sources?: Array<Source>`

          The sources used in the search.

          - `type: "url"`

            The type of source. Always `url`.

            - `"url"`

          - `url: string`

            The URL of the source.

            `format: uri`

      - `OpenPage`

        Action type "open_page" - Opens a specific URL from search results.

        - `type: "open_page"`

          The action type.

          - `"open_page"`

        - `url?: string | null`

          The URL opened by the model.

          `format: uri`

      - `FindInPage`

        Action type "find_in_page": Searches for a pattern within a loaded page.

        - `pattern: string`

          The pattern or text to search for within the page.

        - `type: "find_in_page"`

          The action type.

          - `"find_in_page"`

        - `url: string`

          The URL of the page searched for the pattern.

          `format: uri`

    - `status: "in_progress" | "searching" | "completed" | 2 more`

      The status of the web search tool call.

      - `"in_progress"`

      - `"searching"`

      - `"completed"`

      - `"failed"`

      - `"incomplete"`

    - `type: "web_search_call"`

      The type of the web search tool call. Always `web_search_call`.

      - `"web_search_call"`

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseFunctionToolCallItem extends BetaResponseFunctionToolCall`

    A tool call to run a function. See the
    [function calling guide](/api/docs/guides/function-calling) for more information.

    - `id: string`

      The unique ID of the function tool call.

    - `status: "in_progress" | "completed" | "incomplete"`

      The status of the item. One of `in_progress`, `completed`, or
      `incomplete`. Populated when items are returned via API.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `created_by?: string`

      The identifier of the actor that created the item.

  - `BetaResponseFunctionToolCallOutputItem`

    - `id: string`

      The unique ID of the function call tool output.

    - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

      The output from the function call generated by your code.
      Can be a string or an list of output content.

      - `string`

      - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile`

          A file input to the model.

    - `status: "in_progress" | "completed" | "incomplete"`

      The status of the item. One of `in_progress`, `completed`, or
      `incomplete`. Populated when items are returned via API.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "function_call_output"`

      The type of the function tool call output. Always `function_call_output`.

      - `"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.

    - `call_id?: string`

      The unique ID of the function tool call generated by the model.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

          `minLength: 1`, `maxLength: 64`

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

    - `created_by?: string`

      The identifier of the actor that created the item.

    - `name?: string`

      The name of the tool that produced the output.

    - `namespace?: string`

      The namespace of the tool that produced the output.

  - `AgentMessage`

    - `id: string`

      The unique ID of the agent message.

    - `author: string`

      The sending agent identity.

    - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

      Encrypted content sent between agents.

      - `BetaResponseInputText`

        A text input to the model.

      - `BetaResponseOutputText`

        A text output from the model.

      - `Text`

        A text content.

        - `text: string`

        - `type: "text"`

          - `"text"`

      - `SummaryText`

        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`.

          - `"summary_text"`

      - `ReasoningText`

        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`.

          - `"reasoning_text"`

      - `BetaResponseOutputRefusal`

        A refusal from the model.

      - `BetaResponseInputImage`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

      - `ComputerScreenshot`

        A screenshot of a computer.

        - `detail: BetaImageDetail`

          The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

        - `file_id: string | null`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url: string | null`

          The URL of the screenshot image.

          `format: uri`

        - `type: "computer_screenshot"`

          Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

          - `"computer_screenshot"`

        - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

          Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

          - `ttl?: "30m" | "12h"`

            The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

            - `"30m"`

            - `"12h"`

      - `BetaResponseInputFile`

        A file input to the model.

      - `EncryptedContent`

        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`.

          - `"encrypted_content"`

    - `recipient: string`

      The destination agent identity.

    - `type: "agent_message"`

      The type of the item. Always `agent_message`.

      - `"agent_message"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `MultiAgentCall`

    - `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.

      - `"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`.

      - `"multi_agent_call"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `MultiAgentCallOutput`

    - `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.

      - `"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>`

      Text output returned by the multi-agent action.

      - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

        The annotations of the text output.

      - `text: string`

        The text output from the model.

      - `type: "output_text"`

        The type of the output text. Always `output_text`.

      - `logprobs?: Array<Logprob>`

    - `type: "multi_agent_call_output"`

      The type of the multi-agent result. Always `multi_agent_call_output`.

      - `"multi_agent_call_output"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseToolSearchCall`

    - `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.

      - `"server"`

      - `"client"`

    - `status: "in_progress" | "completed" | "incomplete"`

      The status of the tool search call item that was recorded.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "tool_search_call"`

      The type of the item. Always `tool_search_call`.

      - `"tool_search_call"`

    - `agent?: Agent`

      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: 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.

      - `"server"`

      - `"client"`

    - `status: "in_progress" | "completed" | "incomplete"`

      The status of the tool search output item that was recorded.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `tools: Array<BetaTool>`

      The loaded tool definitions returned by tool search.

      - `BetaFunctionTool`

        Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

          - `"function"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async?: boolean`

        - `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`

        A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `type: "file_search"`

          The type of the file search tool. Always `file_search`.

          - `"file_search"`

        - `vector_store_ids: Array<string>`

          The IDs of the vector stores to search.

        - `filters?: ComparisonFilter | CompoundFilter | null`

          A filter to apply.

          - `ComparisonFilter`

            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

              - `"eq"`

              - `"ne"`

              - `"gt"`

              - `"gte"`

              - `"lt"`

              - `"lte"`

              - `"in"`

              - `"nin"`

            - `value: string | number | boolean | Array<string | number>`

              The value to compare against the attribute key; supports string, number, or boolean types.

              - `string`

              - `number`

              - `boolean`

              - `Array<string | number>`

                - `string`

                - `number`

          - `CompoundFilter`

            Combine multiple filters using `and` or `or`.

            - `filters: Array<ComparisonFilter | unknown>`

              Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

              - `ComparisonFilter`

                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

                  - `"eq"`

                  - `"ne"`

                  - `"gt"`

                  - `"gte"`

                  - `"lt"`

                  - `"lte"`

                  - `"in"`

                  - `"nin"`

                - `value: string | number | boolean | Array<string | number>`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `Array<string | number>`

                    - `string`

                    - `number`

              - `unknown`

            - `type: "and" | "or"`

              Type of operation: `and` or `or`.

              - `"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`

          Ranking options for search.

          - `hybrid_search?: HybridSearch`

            Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

            - `embedding_weight: number`

              The weight of the embedding in the reciprocal ranking fusion.

            - `text_weight: number`

              The weight of the text in the reciprocal ranking fusion.

          - `ranker?: "auto" | "default-2024-11-15"`

            The ranker to use for the file search.

            - `"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`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `type: "computer"`

          The type of the computer tool. Always `computer`.

          - `"computer"`

      - `BetaComputerUsePreviewTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `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.

          - `"windows"`

          - `"mac"`

          - `"linux"`

          - `"ubuntu"`

          - `"browser"`

        - `type: "computer_use_preview"`

          The type of the computer use tool. Always `computer_use_preview`.

          - `"computer_use_preview"`

      - `BetaWebSearchTool`

        Search the Internet for sources related to the prompt. Learn more about the
        [web search tool](/api/docs/guides/tools-web-search).

        - `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`.

          - `"web_search"`

          - `"web_search_2025_08_26"`

        - `external_web_access?: boolean`

          Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

        - `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.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `user_location?: UserLocation | null`

          The approximate location of the user. If omitted or null, defaults to the
          United States. To avoid this fallback, pass `{"type": "approximate"}` without
          location fields. To localize results, provide the relevant location fields.

          - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `type?: "approximate"`

            The type of location approximation. Always `approximate`.

            - `"approximate"`

      - `Mcp`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

          - `"mcp"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools?: Array<string> | McpToolFilter | null`

          List of allowed tool names or a filter object.

          - `Array<string>`

          - `McpToolFilter`

            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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

          This field is deprecated for models released after September 1, 2026.
          Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
          connect through a Secure MCP Tunnel.

          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`

          - `"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" | null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter`

            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`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                it will match this filter.

              - `tool_names?: Array<string>`

                List of allowed tool names.

            - `never?: Never`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

          `format: uri`

        - `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`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string | CodeInterpreterToolAuto`

          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.

          - `string`

          - `CodeInterpreterToolAuto`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids?: Array<string>`

              An optional list of uploaded files to make available to your code.

              `maxItems: 50`

            - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled`

                - `type: "disabled"`

                  Disable outbound network access. Always `disabled`.

                  - `"disabled"`

              - `BetaContainerNetworkPolicyAllowlist`

                - `allowed_domains: Array<string>`

                  A list of allowed domains when type is `allowlist`.

                  `minItems: 1`

                - `type: "allowlist"`

                  Allow outbound network access only to specified domains. Always `allowlist`.

                  - `"allowlist"`

                - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                  Optional domain-scoped secrets for allowlisted domains.

                  `minItems: 1`

                  - `domain: string`

                    The domain associated with the secret.

                    `minLength: 1`

                  - `name: string`

                    The name of the secret to inject for the domain.

                    `minLength: 1`

                  - `value: string`

                    The secret value to inject for the domain.

                    `minLength: 1`, `maxLength: 10485760`

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action?: "generate" | "edit" | "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background?: "transparent" | "opaque" | "auto"`

          Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
          `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
          Transparent backgrounds are available for supported GPT Image models. For
          `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
          using `transparent`, set the output format to `png` or `webp`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `complexity?: "low" | "medium" | "high"`

          Computation spent planning the image, independently of rendering quality.
          Overrides the outer response's `reasoning.effort` for image generation.
          When omitted, inherits a supported outer reasoning effort or uses the
          image model's configured default.
          For SVG output, controls the reference image, not the SVG author's
          reasoning.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `frame_count?: number`

          Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

          `minimum: 2`, `maximum: 16`

        - `frame_duration_ms?: number`

          Duration of each GIF frame in milliseconds, rounded to 10 ms.
          Requires `output_format` to be `gif`. Default: 200.

          `minimum: 20`, `maximum: 2000`

        - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

          - `"high"`

          - `"low"`

        - `input_image_mask?: InputImageMask`

          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" | 9 more`

          The image generation model to use. One of `gpt-image-1-mini`,
          `gpt-image-1.5`, `gpt-image-2`,
          `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
          `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
          `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
          `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
          `gpt-image-2`.

          `gpt-image-1` was shut down on October 23, 2026. Use
          `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

          Deprecated values:

          - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

          - `(string & {})`

          - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

            The image generation model to use. One of `gpt-image-1-mini`,
            `gpt-image-1.5`, `gpt-image-2`,
            `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
            `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
            `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
            `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
            `gpt-image-2`.

            `gpt-image-1` was shut down on October 23, 2026. Use
            `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

            - `"gpt-image-1"`

            - `"gpt-image-1-mini"`

            - `"gpt-image-2"`

            - `"gpt-image-2-2026-04-21"`

            - `"gpt-image-2.5-sunburst"`

            - `"gpt-image-2.5-sunburst-2026-09-08"`

            - `"gpt-image-2.5-flare"`

            - `"gpt-image-2.5-flare-2026-09-08"`

            - `"gpt-image-2.6-sunburst"`

            - `"gpt-image-2.6-flare"`

            - `"gpt-image-1.5"`

            - `"chatgpt-image-latest"`

        - `moderation?: "auto" | "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression?: number`

          Compression level for the output image. Default: 100.

          `minimum: 0`, `maximum: 100`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more`

          The output format of the generated image. One of `png`, `webp`, `jpeg`,
          `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
          that supports the selected format. GIF output does not support
          partial image streaming (`partial_images` greater than `0`),
          `input_image_mask`, or custom `output_compression`.
          Responses lifecycle events can still be streamed for GIF output.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `partial_images?: number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          `minimum: 0`, `maximum: 3`

        - `quality?: "low" | "medium" | "high" | 3 more`

          The quality of the generated image. The GPT image models support `low`,
          `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
          including their `2026-09-08` snapshots, also support `xhigh` and `max`.
          Default: `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

          The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

        - `svg?: Svg`

          SVG author model settings. Requires `output_format` to be `svg`.
          When SVG model selection is enabled, omitting this object uses the
          outer response model. Otherwise, the default SVG author is used and
          explicit model overrides are unavailable.

          - `model?: string`

            `minLength: 1`

          - `reasoning?: Reasoning | null`

            Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

            - `effort?: "none" | "minimal" | "low" | 4 more`

              Controls how much effort the model should spend on reasoning for this request.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

      - `LocalShell`

        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`.

          - `"local_shell"`

      - `BetaFunctionShellTool`

        A tool that allows the model to execute shell commands.

        - `type: "shell"`

          The type of the shell tool. Always `shell`.

          - `"shell"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

        - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

          - `BetaContainerAuto`

            - `type: "container_auto"`

              Automatically creates a container for this request

              - `"container_auto"`

            - `file_ids?: Array<string>`

              An optional list of uploaded files to make available to your code.

              `maxItems: 50`

            - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

              The memory limit for the container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled`

              - `BetaContainerNetworkPolicyAllowlist`

            - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

              An optional list of skills referenced by id or inline data.

              `maxItems: 200`

              - `BetaSkillReference`

                - `skill_id: string`

                  The ID of the referenced skill.

                  `minLength: 1`, `maxLength: 64`

                - `type: "skill_reference"`

                  References a skill created with the /v1/skills endpoint.

                  - `"skill_reference"`

                - `version?: string`

                  Optional skill version. Use a positive integer or 'latest'. Omit for default.

              - `BetaInlineSkill`

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `source: BetaInlineSkillSource`

                  Inline skill payload

                  - `data: string`

                    Base64-encoded skill zip bundle.

                    `minLength: 1`, `maxLength: 70254592`

                  - `media_type: "application/zip"`

                    The media type of the inline skill payload. Must be `application/zip`.

                    - `"application/zip"`

                  - `type: "base64"`

                    The type of the inline skill source. Must be `base64`.

                    - `"base64"`

                - `type: "inline"`

                  Defines an inline skill for this request.

                  - `"inline"`

          - `BetaLocalEnvironment`

            - `type: "local"`

              Use a local computer environment.

              - `"local"`

            - `skills?: Array<BetaLocalSkill>`

              An optional list of skills.

              `maxItems: 200`

              - `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: string`

              The ID of the referenced container.

            - `type: "container_reference"`

              References a container created with the /v1/containers endpoint

              - `"container_reference"`

      - `BetaCustomTool`

        A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

          - `"custom"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

        - `async?: boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `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 | Grammar`

          The input format for the custom tool. Default is unconstrained text.

          - `Text`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar`

            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`.

              - `"lark"`

              - `"regex"`

            - `type: "grammar"`

              Grammar format. Always `grammar`.

              - `"grammar"`

      - `BetaNamespaceTool`

        Groups function/custom tools under a shared namespace.

        - `description: string`

          A description of the namespace shown to the model.

        - `name: string`

          The namespace name used in tool calls (for example, `crm`).

          `minLength: 1`

        - `tools: Array<Function | BetaCustomTool>`

          The function/custom tools available inside this namespace.

          `minItems: 1`

          - `Function`

            - `name: string`

              `minLength: 1`, `maxLength: 128`

            - `type: "function"`

              - `"function"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `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`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `type: "namespace"`

          The type of the tool. Always `namespace`.

          - `"namespace"`

      - `BetaToolSearchTool`

        Hosted or BYOT tool search configuration for deferred tools.

        - `type: "tool_search"`

          The type of the tool. Always `tool_search`.

          - `"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.

          - `"server"`

          - `"client"`

        - `parameters?: unknown`

          Parameter schema for a client-executed tool search tool.

      - `BetaWebSearchPreviewTool`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `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`.

          - `"web_search_preview"`

          - `"web_search_preview_2025_03_11"`

        - `search_content_types?: Array<"text" | "image">`

          - `"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.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `user_location?: UserLocation | null`

          The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

          - `type: "approximate"`

            The type of location approximation. Always `approximate`.

            - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `BetaApplyPatchTool`

        Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "apply_patch"`

          The type of the tool. Always `apply_patch`.

          - `"apply_patch"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

    - `type: "tool_search_output"`

      The type of the item. Always `tool_search_output`.

      - `"tool_search_output"`

    - `agent?: Agent`

      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: string`

      The unique ID of the additional tools item.

    - `role: "unknown" | "user" | "assistant" | 5 more`

      The role that provided the additional tools.

      - `"unknown"`

      - `"user"`

      - `"assistant"`

      - `"system"`

      - `"critic"`

      - `"discriminator"`

      - `"developer"`

      - `"tool"`

    - `tools: Array<BetaTool>`

      The additional tool definitions made available at this item.

      - `BetaFunctionTool`

        Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

      - `BetaFileSearchTool`

        A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

      - `BetaComputerTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaComputerUsePreviewTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaWebSearchTool`

        Search the Internet for sources related to the prompt. Learn more about the
        [web search tool](/api/docs/guides/tools-web-search).

      - `Mcp`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

      - `CodeInterpreter`

        A tool that runs Python code to help generate a response to a prompt.

      - `ProgrammaticToolCalling`

      - `ImageGeneration`

        A tool that generates images using the GPT image models.

      - `LocalShell`

        A tool that allows the model to execute shell commands in a local environment.

      - `BetaFunctionShellTool`

        A tool that allows the model to execute shell commands.

      - `BetaCustomTool`

        A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

      - `BetaNamespaceTool`

        Groups function/custom tools under a shared namespace.

      - `BetaToolSearchTool`

        Hosted or BYOT tool search configuration for deferred tools.

      - `BetaWebSearchPreviewTool`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

      - `BetaApplyPatchTool`

        Allows the assistant to create, delete, or update files using unified diffs.

    - `type: "additional_tools"`

      The type of the item. Always `additional_tools`.

      - `"additional_tools"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseConfigurationUpdateItem`

    A configuration update for subsequent responses. Each setting stays in effect
    until a later update replaces that setting.

    - `id: string`

      The unique ID of the configuration update item.

    - `type: "configuration_update"`

      The item type. Always `configuration_update`.

      - `"configuration_update"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `reasoning?: Reasoning`

      The reasoning configuration applied by this update.

      - `effort?: "none" | "minimal" | "low" | 4 more | null`

        The reasoning effort used for subsequent responses until another
        configuration update replaces it.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

    - `text?: Text`

      The text output configuration for subsequent responses.

      - `format: Text | BetaResponseFormatTextJSONSchemaConfig`

        Use a JSON schema for structured output or text to return to plain text.

        - `Text`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig`

          JSON Schema response format. Used to generate structured JSON responses.
          Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

          - `name: string`

            The name of the response format. Must be a-z, A-Z, 0-9, or contain
            underscores and dashes, with a maximum length of 64.

          - `schema: Record<string, unknown>`

            The schema for the response format, described as a JSON Schema object.
            Learn how to build JSON schemas [here](https://json-schema.org/).

          - `type: "json_schema"`

            The type of response format being defined. Always `json_schema`.

            - `"json_schema"`

          - `description?: string`

            A description of what the response format is for, used by the model to
            determine how to respond in the format.

          - `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](/api/docs/guides/structured-outputs).

  - `BetaResponseReasoningItem`

    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](/api/docs/guides/conversation-state).

    - `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`.

        - `"summary_text"`

    - `type: "reasoning"`

      The type of the object. Always `reasoning`.

      - `"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`.

        - `"reasoning_text"`

    - `encrypted_content?: string | null`

      The encrypted content of the reasoning item. This is populated by default
      for reasoning items returned by `POST /v1/responses` and WebSocket
      `response.create` requests.

      When streaming, use the completed reasoning item and its
      `encrypted_content` from the `response.output_item.done` event in
      subsequent requests. The `encrypted_content` in
      `response.output_item.added` may be incomplete. This is especially
      important when `store` is `false` or when using Zero Data Retention.

    - `status?: "in_progress" | "completed" | "incomplete"`

      The status of the item. One of `in_progress`, `completed`, or
      `incomplete`. Populated when items are returned via API.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `Program`

    - `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`.

      - `"program"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ProgramOutput`

    - `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.

      - `"completed"`

      - `"incomplete"`

    - `type: "program_output"`

      The type of the item. Always `program_output`.

      - `"program_output"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseCompactionItem`

    A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

    - `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`.

      - `"compaction"`

    - `agent?: Agent`

      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`

    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.

      - `"in_progress"`

      - `"completed"`

      - `"generating"`

      - `"failed"`

    - `type: "image_generation_call"`

      The type of the image generation call. Always `image_generation_call`.

      - `"image_generation_call"`

    - `action?: "generate" | "edit" | "auto" | null`

      The action used for image generation.

      - `"generate"`

      - `"edit"`

      - `"auto"`

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `background?: "transparent" | "opaque" | "auto" | null`

      The background setting used for generation.

      - `"transparent"`

      - `"opaque"`

      - `"auto"`

    - `error?: Error`

      Details of a moderation failure, when available.

      - `code: string | null`

        The error code.

      - `message: string`

        A description of the error.

      - `param: string | null`

        The related request parameter.

      - `type: string`

        The error type.

      - `moderation_details?: ModerationDetails`

        Public details for a `moderation_blocked` error, when available.

        - `categories: Array<string>`

          Public moderation categories. New category values may be added over time.

        - `moderation_stage: "input" | "output" | "unknown"`

          The stage where moderation blocked the image generation call.

          - `"input"`

          - `"output"`

          - `"unknown"`

    - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

      The output format used for generation.

      - `"png"`

      - `"webp"`

      - `"jpeg"`

      - `"gif"`

      - `"svg"`

    - `quality?: "low" | "medium" | "high" | 3 more | null`

      The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

      - `"auto"`

    - `revised_prompt?: string | null`

      The prompt that was used after any model prompt rewriting.

    - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

      The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

      - `(string & {})`

      - `"1024x1024" | "1024x1536" | "1536x1024"`

        - `"1024x1024"`

        - `"1024x1536"`

        - `"1536x1024"`

    - `svg_usage?: SvgUsage`

      - `input_tokens: number`

      - `model: string`

      - `output_tokens: number`

      - `reasoning_tokens: number`

      - `total_tokens: number`

  - `BetaResponseCodeInterpreterToolCall`

    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 | Image> | null`

      The outputs generated by the code interpreter, such as logs or images.
      Can be null if no outputs are available.

      - `Logs`

        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`.

          - `"logs"`

      - `Image`

        The image output from the code interpreter.

        - `type: "image"`

          The type of the output. Always `image`.

          - `"image"`

        - `url: string`

          The URL of the image output from the code interpreter.

          `format: uri`

    - `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`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

      - `"interpreting"`

      - `"failed"`

    - `type: "code_interpreter_call"`

      The type of the code interpreter tool call. Always `code_interpreter_call`.

      - `"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`

    A tool call to run a command on the local shell.

    - `id: string`

      The unique ID of the local shell call.

    - `action: Action`

      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`.

        - `"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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "local_shell_call"`

      The type of the local shell call. Always `local_shell_call`.

      - `"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`

    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`.

      - `"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`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `BetaResponseFunctionShellToolCall`

    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`

      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 | BetaResponseContainerReference | null`

      Represents the use of a local environment to perform shell actions.

      - `BetaResponseLocalEnvironment`

        Represents the use of a local environment to perform shell actions.

        - `type: "local"`

          The environment type. Always `local`.

          - `"local"`

      - `BetaResponseContainerReference`

        Represents a container created with /v1/containers.

        - `container_id: string`

        - `type: "container_reference"`

          The environment type. Always `container_reference`.

          - `"container_reference"`

    - `status: "in_progress" | "completed" | "incomplete"`

      The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "shell_call"`

      The type of the item. Always `shell_call`.

      - `"shell_call"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `created_by?: string`

      The ID of the entity that created this tool call.

  - `BetaResponseFunctionShellToolCallOutput`

    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 | Exit`

        Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

        - `Timeout`

          Indicates that the shell call exceeded its configured time limit.

          - `type: "timeout"`

            The outcome type. Always `timeout`.

            - `"timeout"`

        - `Exit`

          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`.

            - `"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`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "shell_call_output"`

      The type of the shell call output. Always `shell_call_output`.

      - `"shell_call_output"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `created_by?: string`

      The identifier of the actor that created the item.

  - `BetaResponseApplyPatchToolCall`

    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 | DeleteFile | UpdateFile`

      One of the create_file, delete_file, or update_file operations applied via apply_patch.

      - `CreateFile`

        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.

          - `"create_file"`

      - `DeleteFile`

        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.

          - `"delete_file"`

      - `UpdateFile`

        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.

          - `"update_file"`

    - `status: "in_progress" | "completed"`

      The status of the apply patch tool call. One of `in_progress` or `completed`.

      - `"in_progress"`

      - `"completed"`

    - `type: "apply_patch_call"`

      The type of the item. Always `apply_patch_call`.

      - `"apply_patch_call"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `created_by?: string`

      The ID of the entity that created this tool call.

  - `BetaResponseApplyPatchToolCallOutput`

    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`.

      - `"completed"`

      - `"failed"`

    - `type: "apply_patch_call_output"`

      The type of the item. Always `apply_patch_call_output`.

      - `"apply_patch_call_output"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"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.

  - `McpListTools`

    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`.

      - `"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`

    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`.

      - `"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`

    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`.

      - `"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.

  - `McpCall`

    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`.

      - `"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?: BetaMcpToolCallError | null`

      The error from the tool call, if any.

      - `McpProtocolError`

        - `code: number`

        - `message: string`

        - `type: "mcp_protocol_error"`

          - `"mcp_protocol_error"`

      - `McpToolExecutionError`

        - `content: unknown`

        - `type: "mcp_tool_execution_error"`

          - `"mcp_tool_execution_error"`

      - `HTTPError`

        - `code: number`

        - `message: string`

        - `type: "http_error"`

          - `"http_error"`

    - `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`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

      - `"calling"`

      - `"failed"`

  - `BetaResponseCustomToolCallItem extends BetaResponseCustomToolCall`

    A call to a custom tool created by the model.

    - `id: string`

      The unique ID of the custom tool call 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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `created_by?: string`

      The identifier of the actor that created the item.

  - `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

    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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `created_by?: string`

      The identifier of the actor that created the item.

### Beta Response Local Environment

- `BetaResponseLocalEnvironment`

  Represents the use of a local environment to perform shell actions.

  - `type: "local"`

    The environment type. Always `local`.

    - `"local"`

### Beta Response Mcp Call Arguments Delta Event

- `BetaResponseMcpCallArgumentsDeltaEvent`

  Emitted when there is a delta (partial update) to the arguments of an MCP tool call.

  - `delta: string`

    A JSON string containing the partial update to the arguments for the MCP tool call.

  - `item_id: string`

    The unique identifier of the MCP tool call item being processed.

  - `output_index: number`

    The index of the output item in the response's output array.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.mcp_call_arguments.delta"`

    The type of the event. Always 'response.mcp_call_arguments.delta'.

    - `"response.mcp_call_arguments.delta"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Mcp Call Arguments Done Event

- `BetaResponseMcpCallArgumentsDoneEvent`

  Emitted when the arguments for an MCP tool call are finalized.

  - `arguments: string`

    A JSON string containing the finalized arguments for the MCP tool call.

  - `item_id: string`

    The unique identifier of the MCP tool call item being processed.

  - `output_index: number`

    The index of the output item in the response's output array.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.mcp_call_arguments.done"`

    The type of the event. Always 'response.mcp_call_arguments.done'.

    - `"response.mcp_call_arguments.done"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Mcp Call Completed Event

- `BetaResponseMcpCallCompletedEvent`

  Emitted when an MCP  tool call has completed successfully.

  - `item_id: string`

    The ID of the MCP tool call item that completed.

  - `output_index: number`

    The index of the output item that completed.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.mcp_call.completed"`

    The type of the event. Always 'response.mcp_call.completed'.

    - `"response.mcp_call.completed"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Mcp Call Failed Event

- `BetaResponseMcpCallFailedEvent`

  Emitted when an MCP  tool call has failed.

  - `item_id: string`

    The ID of the MCP tool call item that failed.

  - `output_index: number`

    The index of the output item that failed.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.mcp_call.failed"`

    The type of the event. Always 'response.mcp_call.failed'.

    - `"response.mcp_call.failed"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Mcp Call In Progress Event

- `BetaResponseMcpCallInProgressEvent`

  Emitted when an MCP  tool call is in progress.

  - `item_id: string`

    The unique identifier of the MCP tool call item being processed.

  - `output_index: number`

    The index of the output item in the response's output array.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.mcp_call.in_progress"`

    The type of the event. Always 'response.mcp_call.in_progress'.

    - `"response.mcp_call.in_progress"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Mcp List Tools Completed Event

- `BetaResponseMcpListToolsCompletedEvent`

  Emitted when the list of available MCP tools has been successfully retrieved.

  - `item_id: string`

    The ID of the MCP tool call item that produced this output.

  - `output_index: number`

    The index of the output item that was processed.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.mcp_list_tools.completed"`

    The type of the event. Always 'response.mcp_list_tools.completed'.

    - `"response.mcp_list_tools.completed"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Mcp List Tools Failed Event

- `BetaResponseMcpListToolsFailedEvent`

  Emitted when the attempt to list available MCP tools has failed.

  - `item_id: string`

    The ID of the MCP tool call item that failed.

  - `output_index: number`

    The index of the output item that failed.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.mcp_list_tools.failed"`

    The type of the event. Always 'response.mcp_list_tools.failed'.

    - `"response.mcp_list_tools.failed"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Mcp List Tools In Progress Event

- `BetaResponseMcpListToolsInProgressEvent`

  Emitted when the system is in the process of retrieving the list of available MCP tools.

  - `item_id: string`

    The ID of the MCP tool call item that is being processed.

  - `output_index: number`

    The index of the output item that is being processed.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.mcp_list_tools.in_progress"`

    The type of the event. Always 'response.mcp_list_tools.in_progress'.

    - `"response.mcp_list_tools.in_progress"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Output Audio

- `BetaResponseOutputAudio`

  An audio output from the model.

  - `data: string`

    Base64-encoded audio data from the model.

  - `transcript: string`

    The transcript of the audio data from the model.

  - `type: "output_audio"`

    The type of the output audio. Always `output_audio`.

    - `"output_audio"`

### Beta Response Output Item

- `BetaResponseOutputItem = BetaResponseOutputMessage | BetaResponseFileSearchToolCall | BetaResponseFunctionToolCall | 28 more`

  An output message from the model.

  - `BetaResponseOutputMessage`

    An output message from the model.

    - `id: string`

      The unique ID of the output message.

    - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

      The content of the output message.

      - `BetaResponseOutputText`

        A text output from the model.

        - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

          The annotations of the text output.

          - `FileCitation`

            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 in the output text at which to insert the file citation.

            - `type: "file_citation"`

              The type of the file citation. Always `file_citation`.

              - `"file_citation"`

          - `URLCitation`

            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_citation"`

            - `url: string`

              The URL of the web resource.

              `format: uri`

          - `ContainerFileCitation`

            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`.

              - `"container_file_citation"`

          - `FilePath`

            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`.

              - `"file_path"`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

          - `"output_text"`

        - `logprobs?: Array<Logprob>`

          - `token: string`

          - `bytes: Array<number>`

          - `logprob: number`

          - `top_logprobs: Array<TopLogprob>`

            - `token: string`

            - `bytes: Array<number>`

            - `logprob: number`

      - `BetaResponseOutputRefusal`

        A refusal from the model.

        - `refusal: string`

          The refusal explanation from the model.

        - `type: "refusal"`

          The type of the refusal. Always `refusal`.

          - `"refusal"`

    - `role: "assistant"`

      The role of the output message. Always `assistant`.

      - `"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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "message"`

      The type of the output message. Always `message`.

      - `"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" | "final_answer" | 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.

      - `"commentary"`

      - `"final_answer"`

  - `BetaResponseFileSearchToolCall`

    The results of a file search tool call. See the
    [file search guide](/api/docs/guides/tools-file-search) 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`,

      - `"in_progress"`

      - `"searching"`

      - `"completed"`

      - `"incomplete"`

      - `"failed"`

    - `type: "file_search_call"`

      The type of the file search tool call. Always `file_search_call`.

      - `"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.

        - `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.

        `format: float`

      - `text?: string`

        The text that was retrieved from the file.

  - `BetaResponseFunctionToolCall`

    A tool call to run a function. See the
    [function calling guide](/api/docs/guides/function-calling) 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`.

      - `"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.

    - `async?: boolean`

      Whether the function tool call runs asynchronously.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `BetaResponseFunctionToolCallOutputItem`

    - `id: string`

      The unique ID of the function call tool output.

    - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

      The output from the function call generated by your code.
      Can be a string or an list of output content.

      - `string`

      - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

        - `BetaResponseInputText`

          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`.

            - `"input_text"`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `detail: BetaImageDetail`

            The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

            - `"low"`

            - `"high"`

            - `"auto"`

            - `"original"`

          - `type: "input_image"`

            The type of the input item. Always `input_image`.

            - `"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.

            `format: uri`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputFile`

          A file input to the model.

          - `type: "input_file"`

            The type of the input item. Always `input_file`.

            - `"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`.

            - `"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.

            `format: uri`

          - `filename?: string`

            The name of the file to be sent to the model.

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

    - `status: "in_progress" | "completed" | "incomplete"`

      The status of the item. One of `in_progress`, `completed`, or
      `incomplete`. Populated when items are returned via API.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "function_call_output"`

      The type of the function tool call output. Always `function_call_output`.

      - `"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.

    - `call_id?: string`

      The unique ID of the function tool call generated by the model.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

          `minLength: 1`, `maxLength: 64`

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

    - `created_by?: string`

      The identifier of the actor that created the item.

    - `name?: string`

      The name of the tool that produced the output.

    - `namespace?: string`

      The namespace of the tool that produced the output.

  - `AgentMessage`

    - `id: string`

      The unique ID of the agent message.

    - `author: string`

      The sending agent identity.

    - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

      Encrypted content sent between agents.

      - `BetaResponseInputText`

        A text input to the model.

      - `BetaResponseOutputText`

        A text output from the model.

      - `Text`

        A text content.

        - `text: string`

        - `type: "text"`

          - `"text"`

      - `SummaryText`

        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`.

          - `"summary_text"`

      - `ReasoningText`

        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`.

          - `"reasoning_text"`

      - `BetaResponseOutputRefusal`

        A refusal from the model.

      - `BetaResponseInputImage`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

      - `ComputerScreenshot`

        A screenshot of a computer.

        - `detail: BetaImageDetail`

          The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

        - `file_id: string | null`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url: string | null`

          The URL of the screenshot image.

          `format: uri`

        - `type: "computer_screenshot"`

          Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

          - `"computer_screenshot"`

        - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

          Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

          - `ttl?: "30m" | "12h"`

            The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

            - `"30m"`

            - `"12h"`

      - `BetaResponseInputFile`

        A file input to the model.

      - `EncryptedContent`

        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`.

          - `"encrypted_content"`

    - `recipient: string`

      The destination agent identity.

    - `type: "agent_message"`

      The type of the item. Always `agent_message`.

      - `"agent_message"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `MultiAgentCall`

    - `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.

      - `"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`.

      - `"multi_agent_call"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `MultiAgentCallOutput`

    - `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.

      - `"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>`

      Text output returned by the multi-agent action.

      - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

        The annotations of the text output.

      - `text: string`

        The text output from the model.

      - `type: "output_text"`

        The type of the output text. Always `output_text`.

      - `logprobs?: Array<Logprob>`

    - `type: "multi_agent_call_output"`

      The type of the multi-agent result. Always `multi_agent_call_output`.

      - `"multi_agent_call_output"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseFunctionWebSearch`

    The results of a web search tool call. See the
    [web search guide](/api/docs/guides/tools-web-search) for more information.

    - `id: string`

      The unique ID of the web search tool call.

    - `action: Search | OpenPage | FindInPage`

      An object describing the specific action taken in this web search call.
      Includes details on how the model used the web (search, open_page, find_in_page).

      - `Search`

        Action type "search" - Performs a web search query.

        - `type: "search"`

          The action type.

          - `"search"`

        - `queries?: Array<string>`

          The search queries.

        - `query?: string`

          The search query.

        - `sources?: Array<Source>`

          The sources used in the search.

          - `type: "url"`

            The type of source. Always `url`.

            - `"url"`

          - `url: string`

            The URL of the source.

            `format: uri`

      - `OpenPage`

        Action type "open_page" - Opens a specific URL from search results.

        - `type: "open_page"`

          The action type.

          - `"open_page"`

        - `url?: string | null`

          The URL opened by the model.

          `format: uri`

      - `FindInPage`

        Action type "find_in_page": Searches for a pattern within a loaded page.

        - `pattern: string`

          The pattern or text to search for within the page.

        - `type: "find_in_page"`

          The action type.

          - `"find_in_page"`

        - `url: string`

          The URL of the page searched for the pattern.

          `format: uri`

    - `status: "in_progress" | "searching" | "completed" | 2 more`

      The status of the web search tool call.

      - `"in_progress"`

      - `"searching"`

      - `"completed"`

      - `"failed"`

      - `"incomplete"`

    - `type: "web_search_call"`

      The type of the web search tool call. Always `web_search_call`.

      - `"web_search_call"`

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseComputerToolCall`

    A tool call to a computer use tool. See the
    [computer use guide](/api/docs/guides/tools-computer-use) 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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "computer_call"`

      The type of the computer call. Always `computer_call`.

      - `"computer_call"`

    - `action?: BetaComputerAction`

      A click action.

      - `Click`

        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`.

          - `"left"`

          - `"right"`

          - `"wheel"`

          - `"back"`

          - `"forward"`

        - `type: "click"`

          Specifies the event type. For a click action, this property is always `click`.

          - `"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`

        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`.

          - `"double_click"`

        - `x: number`

          The x-coordinate where the double click occurred.

        - `y: number`

          The y-coordinate where the double click occurred.

      - `Drag`

        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`.

          - `"drag"`

        - `keys?: Array<string> | null`

          The keys being held while dragging the mouse.

      - `Keypress`

        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`.

          - `"keypress"`

      - `Move`

        A mouse move action.

        - `type: "move"`

          Specifies the event type. For a move action, this property is always set to `move`.

          - `"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`

        A screenshot action.

        - `type: "screenshot"`

          Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

          - `"screenshot"`

      - `Scroll`

        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`.

          - `"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`

        An action to type in text.

        - `text: string`

          The text to type.

        - `type: "type"`

          Specifies the event type. For a type action, this property is always set to `type`.

          - `"type"`

      - `Wait`

        A wait action.

        - `type: "wait"`

          Specifies the event type. For a wait action, this property is always set to `wait`.

          - `"wait"`

    - `actions?: BetaComputerActionList`

      Flattened batched actions for `computer_use`. Each action includes an
      `type` discriminator and action-specific fields.

      - `Click`

        A click action.

      - `DoubleClick`

        A double click action.

      - `Drag`

        A drag action.

      - `Keypress`

        A collection of keypresses the model would like to perform.

      - `Move`

        A mouse move action.

      - `Screenshot`

        A screenshot action.

      - `Scroll`

        A scroll action.

      - `Type`

        An action to type in text.

      - `Wait`

        A wait action.

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseComputerToolCallOutputItem`

    - `id: string`

      The ID of the computer tool call output.

    - `call_id: string`

      The ID of the computer tool call that produced the output.

    - `output: BetaResponseComputerToolCallOutputScreenshot`

      A computer screenshot image used with the computer use tool.

      - `type: "computer_screenshot"`

        Specifies the event type. For a computer screenshot, this property is
        always set to `computer_screenshot`.

        - `"computer_screenshot"`

      - `file_id?: string`

        The identifier of an uploaded file that contains the screenshot.

      - `image_url?: string`

        The URL of the screenshot image.

        `format: uri`

    - `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.

      - `"completed"`

      - `"incomplete"`

      - `"failed"`

      - `"in_progress"`

    - `type: "computer_call_output"`

      The type of the computer tool call output. Always `computer_call_output`.

      - `"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`

    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](/api/docs/guides/conversation-state).

    - `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`.

        - `"summary_text"`

    - `type: "reasoning"`

      The type of the object. Always `reasoning`.

      - `"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`.

        - `"reasoning_text"`

    - `encrypted_content?: string | null`

      The encrypted content of the reasoning item. This is populated by default
      for reasoning items returned by `POST /v1/responses` and WebSocket
      `response.create` requests.

      When streaming, use the completed reasoning item and its
      `encrypted_content` from the `response.output_item.done` event in
      subsequent requests. The `encrypted_content` in
      `response.output_item.added` may be incomplete. This is especially
      important when `store` is `false` or when using Zero Data Retention.

    - `status?: "in_progress" | "completed" | "incomplete"`

      The status of the item. One of `in_progress`, `completed`, or
      `incomplete`. Populated when items are returned via API.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `Program`

    - `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`.

      - `"program"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ProgramOutput`

    - `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.

      - `"completed"`

      - `"incomplete"`

    - `type: "program_output"`

      The type of the item. Always `program_output`.

      - `"program_output"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseToolSearchCall`

    - `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.

      - `"server"`

      - `"client"`

    - `status: "in_progress" | "completed" | "incomplete"`

      The status of the tool search call item that was recorded.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "tool_search_call"`

      The type of the item. Always `tool_search_call`.

      - `"tool_search_call"`

    - `agent?: Agent`

      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: 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.

      - `"server"`

      - `"client"`

    - `status: "in_progress" | "completed" | "incomplete"`

      The status of the tool search output item that was recorded.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `tools: Array<BetaTool>`

      The loaded tool definitions returned by tool search.

      - `BetaFunctionTool`

        Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

          - `"function"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async?: boolean`

        - `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`

        A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `type: "file_search"`

          The type of the file search tool. Always `file_search`.

          - `"file_search"`

        - `vector_store_ids: Array<string>`

          The IDs of the vector stores to search.

        - `filters?: ComparisonFilter | CompoundFilter | null`

          A filter to apply.

          - `ComparisonFilter`

            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

              - `"eq"`

              - `"ne"`

              - `"gt"`

              - `"gte"`

              - `"lt"`

              - `"lte"`

              - `"in"`

              - `"nin"`

            - `value: string | number | boolean | Array<string | number>`

              The value to compare against the attribute key; supports string, number, or boolean types.

              - `string`

              - `number`

              - `boolean`

              - `Array<string | number>`

                - `string`

                - `number`

          - `CompoundFilter`

            Combine multiple filters using `and` or `or`.

            - `filters: Array<ComparisonFilter | unknown>`

              Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

              - `ComparisonFilter`

                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

                  - `"eq"`

                  - `"ne"`

                  - `"gt"`

                  - `"gte"`

                  - `"lt"`

                  - `"lte"`

                  - `"in"`

                  - `"nin"`

                - `value: string | number | boolean | Array<string | number>`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `Array<string | number>`

                    - `string`

                    - `number`

              - `unknown`

            - `type: "and" | "or"`

              Type of operation: `and` or `or`.

              - `"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`

          Ranking options for search.

          - `hybrid_search?: HybridSearch`

            Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

            - `embedding_weight: number`

              The weight of the embedding in the reciprocal ranking fusion.

            - `text_weight: number`

              The weight of the text in the reciprocal ranking fusion.

          - `ranker?: "auto" | "default-2024-11-15"`

            The ranker to use for the file search.

            - `"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`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `type: "computer"`

          The type of the computer tool. Always `computer`.

          - `"computer"`

      - `BetaComputerUsePreviewTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `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.

          - `"windows"`

          - `"mac"`

          - `"linux"`

          - `"ubuntu"`

          - `"browser"`

        - `type: "computer_use_preview"`

          The type of the computer use tool. Always `computer_use_preview`.

          - `"computer_use_preview"`

      - `BetaWebSearchTool`

        Search the Internet for sources related to the prompt. Learn more about the
        [web search tool](/api/docs/guides/tools-web-search).

        - `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`.

          - `"web_search"`

          - `"web_search_2025_08_26"`

        - `external_web_access?: boolean`

          Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

        - `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.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `user_location?: UserLocation | null`

          The approximate location of the user. If omitted or null, defaults to the
          United States. To avoid this fallback, pass `{"type": "approximate"}` without
          location fields. To localize results, provide the relevant location fields.

          - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `type?: "approximate"`

            The type of location approximation. Always `approximate`.

            - `"approximate"`

      - `Mcp`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

          - `"mcp"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools?: Array<string> | McpToolFilter | null`

          List of allowed tool names or a filter object.

          - `Array<string>`

          - `McpToolFilter`

            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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

          This field is deprecated for models released after September 1, 2026.
          Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
          connect through a Secure MCP Tunnel.

          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`

          - `"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" | null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter`

            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`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                it will match this filter.

              - `tool_names?: Array<string>`

                List of allowed tool names.

            - `never?: Never`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

          `format: uri`

        - `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`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string | CodeInterpreterToolAuto`

          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.

          - `string`

          - `CodeInterpreterToolAuto`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids?: Array<string>`

              An optional list of uploaded files to make available to your code.

              `maxItems: 50`

            - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled`

                - `type: "disabled"`

                  Disable outbound network access. Always `disabled`.

                  - `"disabled"`

              - `BetaContainerNetworkPolicyAllowlist`

                - `allowed_domains: Array<string>`

                  A list of allowed domains when type is `allowlist`.

                  `minItems: 1`

                - `type: "allowlist"`

                  Allow outbound network access only to specified domains. Always `allowlist`.

                  - `"allowlist"`

                - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                  Optional domain-scoped secrets for allowlisted domains.

                  `minItems: 1`

                  - `domain: string`

                    The domain associated with the secret.

                    `minLength: 1`

                  - `name: string`

                    The name of the secret to inject for the domain.

                    `minLength: 1`

                  - `value: string`

                    The secret value to inject for the domain.

                    `minLength: 1`, `maxLength: 10485760`

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action?: "generate" | "edit" | "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background?: "transparent" | "opaque" | "auto"`

          Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
          `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
          Transparent backgrounds are available for supported GPT Image models. For
          `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
          using `transparent`, set the output format to `png` or `webp`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `complexity?: "low" | "medium" | "high"`

          Computation spent planning the image, independently of rendering quality.
          Overrides the outer response's `reasoning.effort` for image generation.
          When omitted, inherits a supported outer reasoning effort or uses the
          image model's configured default.
          For SVG output, controls the reference image, not the SVG author's
          reasoning.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `frame_count?: number`

          Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

          `minimum: 2`, `maximum: 16`

        - `frame_duration_ms?: number`

          Duration of each GIF frame in milliseconds, rounded to 10 ms.
          Requires `output_format` to be `gif`. Default: 200.

          `minimum: 20`, `maximum: 2000`

        - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

          - `"high"`

          - `"low"`

        - `input_image_mask?: InputImageMask`

          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" | 9 more`

          The image generation model to use. One of `gpt-image-1-mini`,
          `gpt-image-1.5`, `gpt-image-2`,
          `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
          `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
          `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
          `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
          `gpt-image-2`.

          `gpt-image-1` was shut down on October 23, 2026. Use
          `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

          Deprecated values:

          - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

          - `(string & {})`

          - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

            The image generation model to use. One of `gpt-image-1-mini`,
            `gpt-image-1.5`, `gpt-image-2`,
            `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
            `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
            `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
            `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
            `gpt-image-2`.

            `gpt-image-1` was shut down on October 23, 2026. Use
            `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

            - `"gpt-image-1"`

            - `"gpt-image-1-mini"`

            - `"gpt-image-2"`

            - `"gpt-image-2-2026-04-21"`

            - `"gpt-image-2.5-sunburst"`

            - `"gpt-image-2.5-sunburst-2026-09-08"`

            - `"gpt-image-2.5-flare"`

            - `"gpt-image-2.5-flare-2026-09-08"`

            - `"gpt-image-2.6-sunburst"`

            - `"gpt-image-2.6-flare"`

            - `"gpt-image-1.5"`

            - `"chatgpt-image-latest"`

        - `moderation?: "auto" | "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression?: number`

          Compression level for the output image. Default: 100.

          `minimum: 0`, `maximum: 100`

        - `output_format?: "png" | "webp" | "jpeg" | 2 more`

          The output format of the generated image. One of `png`, `webp`, `jpeg`,
          `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
          that supports the selected format. GIF output does not support
          partial image streaming (`partial_images` greater than `0`),
          `input_image_mask`, or custom `output_compression`.
          Responses lifecycle events can still be streamed for GIF output.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

          - `"gif"`

          - `"svg"`

        - `partial_images?: number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          `minimum: 0`, `maximum: 3`

        - `quality?: "low" | "medium" | "high" | 3 more`

          The quality of the generated image. The GPT image models support `low`,
          `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
          including their `2026-09-08` snapshots, also support `xhigh` and `max`.
          Default: `auto`.

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

          - `"auto"`

        - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

          The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

          - `(string & {})`

          - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

        - `svg?: Svg`

          SVG author model settings. Requires `output_format` to be `svg`.
          When SVG model selection is enabled, omitting this object uses the
          outer response model. Otherwise, the default SVG author is used and
          explicit model overrides are unavailable.

          - `model?: string`

            `minLength: 1`

          - `reasoning?: Reasoning | null`

            Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

            - `effort?: "none" | "minimal" | "low" | 4 more`

              Controls how much effort the model should spend on reasoning for this request.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

      - `LocalShell`

        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`.

          - `"local_shell"`

      - `BetaFunctionShellTool`

        A tool that allows the model to execute shell commands.

        - `type: "shell"`

          The type of the shell tool. Always `shell`.

          - `"shell"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

        - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

          - `BetaContainerAuto`

            - `type: "container_auto"`

              Automatically creates a container for this request

              - `"container_auto"`

            - `file_ids?: Array<string>`

              An optional list of uploaded files to make available to your code.

              `maxItems: 50`

            - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

              The memory limit for the container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled`

              - `BetaContainerNetworkPolicyAllowlist`

            - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

              An optional list of skills referenced by id or inline data.

              `maxItems: 200`

              - `BetaSkillReference`

                - `skill_id: string`

                  The ID of the referenced skill.

                  `minLength: 1`, `maxLength: 64`

                - `type: "skill_reference"`

                  References a skill created with the /v1/skills endpoint.

                  - `"skill_reference"`

                - `version?: string`

                  Optional skill version. Use a positive integer or 'latest'. Omit for default.

              - `BetaInlineSkill`

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `source: BetaInlineSkillSource`

                  Inline skill payload

                  - `data: string`

                    Base64-encoded skill zip bundle.

                    `minLength: 1`, `maxLength: 70254592`

                  - `media_type: "application/zip"`

                    The media type of the inline skill payload. Must be `application/zip`.

                    - `"application/zip"`

                  - `type: "base64"`

                    The type of the inline skill source. Must be `base64`.

                    - `"base64"`

                - `type: "inline"`

                  Defines an inline skill for this request.

                  - `"inline"`

          - `BetaLocalEnvironment`

            - `type: "local"`

              Use a local computer environment.

              - `"local"`

            - `skills?: Array<BetaLocalSkill>`

              An optional list of skills.

              `maxItems: 200`

              - `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: string`

              The ID of the referenced container.

            - `type: "container_reference"`

              References a container created with the /v1/containers endpoint

              - `"container_reference"`

      - `BetaCustomTool`

        A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

          - `"custom"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

        - `async?: boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `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 | Grammar`

          The input format for the custom tool. Default is unconstrained text.

          - `Text`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar`

            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`.

              - `"lark"`

              - `"regex"`

            - `type: "grammar"`

              Grammar format. Always `grammar`.

              - `"grammar"`

      - `BetaNamespaceTool`

        Groups function/custom tools under a shared namespace.

        - `description: string`

          A description of the namespace shown to the model.

        - `name: string`

          The namespace name used in tool calls (for example, `crm`).

          `minLength: 1`

        - `tools: Array<Function | BetaCustomTool>`

          The function/custom tools available inside this namespace.

          `minItems: 1`

          - `Function`

            - `name: string`

              `minLength: 1`, `maxLength: 128`

            - `type: "function"`

              - `"function"`

            - `allowed_callers?: Array<"direct" | "programmatic"> | null`

              The tool invocation context(s).

              `minItems: 1`

              - `"direct"`

              - `"programmatic"`

            - `async?: boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `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`

            A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `type: "namespace"`

          The type of the tool. Always `namespace`.

          - `"namespace"`

      - `BetaToolSearchTool`

        Hosted or BYOT tool search configuration for deferred tools.

        - `type: "tool_search"`

          The type of the tool. Always `tool_search`.

          - `"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.

          - `"server"`

          - `"client"`

        - `parameters?: unknown`

          Parameter schema for a client-executed tool search tool.

      - `BetaWebSearchPreviewTool`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `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`.

          - `"web_search_preview"`

          - `"web_search_preview_2025_03_11"`

        - `search_content_types?: Array<"text" | "image">`

          - `"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.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `user_location?: UserLocation | null`

          The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

          - `type: "approximate"`

            The type of location approximation. Always `approximate`.

            - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `BetaApplyPatchTool`

        Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "apply_patch"`

          The type of the tool. Always `apply_patch`.

          - `"apply_patch"`

        - `allowed_callers?: Array<"direct" | "programmatic"> | null`

          The tool invocation context(s).

          `minItems: 1`

          - `"direct"`

          - `"programmatic"`

    - `type: "tool_search_output"`

      The type of the item. Always `tool_search_output`.

      - `"tool_search_output"`

    - `agent?: Agent`

      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: string`

      The unique ID of the additional tools item.

    - `role: "unknown" | "user" | "assistant" | 5 more`

      The role that provided the additional tools.

      - `"unknown"`

      - `"user"`

      - `"assistant"`

      - `"system"`

      - `"critic"`

      - `"discriminator"`

      - `"developer"`

      - `"tool"`

    - `tools: Array<BetaTool>`

      The additional tool definitions made available at this item.

      - `BetaFunctionTool`

        Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

      - `BetaFileSearchTool`

        A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

      - `BetaComputerTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaComputerUsePreviewTool`

        A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

      - `BetaWebSearchTool`

        Search the Internet for sources related to the prompt. Learn more about the
        [web search tool](/api/docs/guides/tools-web-search).

      - `Mcp`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

      - `CodeInterpreter`

        A tool that runs Python code to help generate a response to a prompt.

      - `ProgrammaticToolCalling`

      - `ImageGeneration`

        A tool that generates images using the GPT image models.

      - `LocalShell`

        A tool that allows the model to execute shell commands in a local environment.

      - `BetaFunctionShellTool`

        A tool that allows the model to execute shell commands.

      - `BetaCustomTool`

        A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

      - `BetaNamespaceTool`

        Groups function/custom tools under a shared namespace.

      - `BetaToolSearchTool`

        Hosted or BYOT tool search configuration for deferred tools.

      - `BetaWebSearchPreviewTool`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

      - `BetaApplyPatchTool`

        Allows the assistant to create, delete, or update files using unified diffs.

    - `type: "additional_tools"`

      The type of the item. Always `additional_tools`.

      - `"additional_tools"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseCompactionItem`

    A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

    - `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`.

      - `"compaction"`

    - `agent?: Agent`

      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`

    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.

      - `"in_progress"`

      - `"completed"`

      - `"generating"`

      - `"failed"`

    - `type: "image_generation_call"`

      The type of the image generation call. Always `image_generation_call`.

      - `"image_generation_call"`

    - `action?: "generate" | "edit" | "auto" | null`

      The action used for image generation.

      - `"generate"`

      - `"edit"`

      - `"auto"`

    - `agent?: Agent | null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `background?: "transparent" | "opaque" | "auto" | null`

      The background setting used for generation.

      - `"transparent"`

      - `"opaque"`

      - `"auto"`

    - `error?: Error`

      Details of a moderation failure, when available.

      - `code: string | null`

        The error code.

      - `message: string`

        A description of the error.

      - `param: string | null`

        The related request parameter.

      - `type: string`

        The error type.

      - `moderation_details?: ModerationDetails`

        Public details for a `moderation_blocked` error, when available.

        - `categories: Array<string>`

          Public moderation categories. New category values may be added over time.

        - `moderation_stage: "input" | "output" | "unknown"`

          The stage where moderation blocked the image generation call.

          - `"input"`

          - `"output"`

          - `"unknown"`

    - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

      The output format used for generation.

      - `"png"`

      - `"webp"`

      - `"jpeg"`

      - `"gif"`

      - `"svg"`

    - `quality?: "low" | "medium" | "high" | 3 more | null`

      The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

      - `"auto"`

    - `revised_prompt?: string | null`

      The prompt that was used after any model prompt rewriting.

    - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

      The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

      - `(string & {})`

      - `"1024x1024" | "1024x1536" | "1536x1024"`

        - `"1024x1024"`

        - `"1024x1536"`

        - `"1536x1024"`

    - `svg_usage?: SvgUsage`

      - `input_tokens: number`

      - `model: string`

      - `output_tokens: number`

      - `reasoning_tokens: number`

      - `total_tokens: number`

  - `BetaResponseCodeInterpreterToolCall`

    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 | Image> | null`

      The outputs generated by the code interpreter, such as logs or images.
      Can be null if no outputs are available.

      - `Logs`

        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`.

          - `"logs"`

      - `Image`

        The image output from the code interpreter.

        - `type: "image"`

          The type of the output. Always `image`.

          - `"image"`

        - `url: string`

          The URL of the image output from the code interpreter.

          `format: uri`

    - `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`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

      - `"interpreting"`

      - `"failed"`

    - `type: "code_interpreter_call"`

      The type of the code interpreter tool call. Always `code_interpreter_call`.

      - `"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`

    A tool call to run a command on the local shell.

    - `id: string`

      The unique ID of the local shell call.

    - `action: Action`

      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`.

        - `"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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "local_shell_call"`

      The type of the local shell call. Always `local_shell_call`.

      - `"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`

    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`.

      - `"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`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `BetaResponseFunctionShellToolCall`

    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`

      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 | BetaResponseContainerReference | null`

      Represents the use of a local environment to perform shell actions.

      - `BetaResponseLocalEnvironment`

        Represents the use of a local environment to perform shell actions.

        - `type: "local"`

          The environment type. Always `local`.

          - `"local"`

      - `BetaResponseContainerReference`

        Represents a container created with /v1/containers.

        - `container_id: string`

        - `type: "container_reference"`

          The environment type. Always `container_reference`.

          - `"container_reference"`

    - `status: "in_progress" | "completed" | "incomplete"`

      The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "shell_call"`

      The type of the item. Always `shell_call`.

      - `"shell_call"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `created_by?: string`

      The ID of the entity that created this tool call.

  - `BetaResponseFunctionShellToolCallOutput`

    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 | Exit`

        Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

        - `Timeout`

          Indicates that the shell call exceeded its configured time limit.

          - `type: "timeout"`

            The outcome type. Always `timeout`.

            - `"timeout"`

        - `Exit`

          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`.

            - `"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`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `type: "shell_call_output"`

      The type of the shell call output. Always `shell_call_output`.

      - `"shell_call_output"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `created_by?: string`

      The identifier of the actor that created the item.

  - `BetaResponseApplyPatchToolCall`

    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 | DeleteFile | UpdateFile`

      One of the create_file, delete_file, or update_file operations applied via apply_patch.

      - `CreateFile`

        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.

          - `"create_file"`

      - `DeleteFile`

        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.

          - `"delete_file"`

      - `UpdateFile`

        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.

          - `"update_file"`

    - `status: "in_progress" | "completed"`

      The status of the apply patch tool call. One of `in_progress` or `completed`.

      - `"in_progress"`

      - `"completed"`

    - `type: "apply_patch_call"`

      The type of the item. Always `apply_patch_call`.

      - `"apply_patch_call"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `created_by?: string`

      The ID of the entity that created this tool call.

  - `BetaResponseApplyPatchToolCallOutput`

    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`.

      - `"completed"`

      - `"failed"`

    - `type: "apply_patch_call_output"`

      The type of the item. Always `apply_patch_call_output`.

      - `"apply_patch_call_output"`

    - `agent?: Agent`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"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`

    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`.

      - `"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?: BetaMcpToolCallError | null`

      The error from the tool call, if any.

      - `McpProtocolError`

        - `code: number`

        - `message: string`

        - `type: "mcp_protocol_error"`

          - `"mcp_protocol_error"`

      - `McpToolExecutionError`

        - `content: unknown`

        - `type: "mcp_tool_execution_error"`

          - `"mcp_tool_execution_error"`

      - `HTTPError`

        - `code: number`

        - `message: string`

        - `type: "http_error"`

          - `"http_error"`

    - `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`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

      - `"calling"`

      - `"failed"`

  - `McpListTools`

    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`.

      - `"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`

    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`.

      - `"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`

    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`.

      - `"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`

    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`.

      - `"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.

    - `async?: boolean`

      Whether the custom tool call runs asynchronously.

    - `caller?: Direct | Program | null`

      The execution context that produced this tool call.

      - `Direct`

        - `type: "direct"`

          - `"direct"`

      - `Program`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `namespace?: string`

      The namespace of the custom tool being called.

  - `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

    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.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `created_by?: string`

      The identifier of the actor that created the item.

### Beta Response Output Item Added Event

- `BetaResponseOutputItemAddedEvent`

  Emitted when a new output item is added.

  - `item: BetaResponseOutputItem`

    The output item that was added. For reasoning items, `encrypted_content`
    may be incomplete while the item is in progress. Use the reasoning item
    from the corresponding `response.output_item.done` event when passing it
    as input to a subsequent request.

    - `BetaResponseOutputMessage`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

        The content of the output message.

        - `BetaResponseOutputText`

          A text output from the model.

          - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

            The annotations of the text output.

            - `FileCitation`

              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 in the output text at which to insert the file citation.

              - `type: "file_citation"`

                The type of the file citation. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation`

              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_citation"`

              - `url: string`

                The URL of the web resource.

                `format: uri`

            - `ContainerFileCitation`

              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`.

                - `"container_file_citation"`

            - `FilePath`

              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`.

                - `"file_path"`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

          - `logprobs?: Array<Logprob>`

            - `token: string`

            - `bytes: Array<number>`

            - `logprob: number`

            - `top_logprobs: Array<TopLogprob>`

              - `token: string`

              - `bytes: Array<number>`

              - `logprob: number`

        - `BetaResponseOutputRefusal`

          A refusal from the model.

          - `refusal: string`

            The refusal explanation from the model.

          - `type: "refusal"`

            The type of the refusal. Always `refusal`.

            - `"refusal"`

      - `role: "assistant"`

        The role of the output message. Always `assistant`.

        - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "message"`

        The type of the output message. Always `message`.

        - `"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" | "final_answer" | 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.

        - `"commentary"`

        - `"final_answer"`

    - `BetaResponseFileSearchToolCall`

      The results of a file search tool call. See the
      [file search guide](/api/docs/guides/tools-file-search) 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`,

        - `"in_progress"`

        - `"searching"`

        - `"completed"`

        - `"incomplete"`

        - `"failed"`

      - `type: "file_search_call"`

        The type of the file search tool call. Always `file_search_call`.

        - `"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.

          - `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.

          `format: float`

        - `text?: string`

          The text that was retrieved from the file.

    - `BetaResponseFunctionToolCall`

      A tool call to run a function. See the
      [function calling guide](/api/docs/guides/function-calling) 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`.

        - `"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.

      - `async?: boolean`

        Whether the function tool call runs asynchronously.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseFunctionToolCallOutputItem`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `string`

        - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          - `BetaResponseInputText`

            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`.

              - `"input_text"`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `detail: BetaImageDetail`

              The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

              - `"low"`

              - `"high"`

              - `"auto"`

              - `"original"`

            - `type: "input_image"`

              The type of the input item. Always `input_image`.

              - `"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.

              `format: uri`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFile`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"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`.

              - `"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.

              `format: uri`

            - `filename?: string`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "function_call_output"`

        The type of the function tool call output. Always `function_call_output`.

        - `"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.

      - `call_id?: string`

        The unique ID of the function tool call generated by the model.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

      - `name?: string`

        The name of the tool that produced the output.

      - `namespace?: string`

        The namespace of the tool that produced the output.

    - `AgentMessage`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

        Encrypted content sent between agents.

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseOutputText`

          A text output from the model.

        - `Text`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText`

          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`.

            - `"summary_text"`

        - `ReasoningText`

          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`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal`

          A refusal from the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot`

          A screenshot of a computer.

          - `detail: BetaImageDetail`

            The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

          - `file_id: string | null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string | null`

            The URL of the screenshot image.

            `format: uri`

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputFile`

          A file input to the model.

        - `EncryptedContent`

          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`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall`

      - `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.

        - `"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`.

        - `"multi_agent_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput`

      - `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.

        - `"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>`

        Text output returned by the multi-agent action.

        - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

          The annotations of the text output.

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

        - `logprobs?: Array<Logprob>`

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseFunctionWebSearch`

      The results of a web search tool call. See the
      [web search guide](/api/docs/guides/tools-web-search) for more information.

      - `id: string`

        The unique ID of the web search tool call.

      - `action: Search | OpenPage | FindInPage`

        An object describing the specific action taken in this web search call.
        Includes details on how the model used the web (search, open_page, find_in_page).

        - `Search`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries?: Array<string>`

            The search queries.

          - `query?: string`

            The search query.

          - `sources?: Array<Source>`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

              `format: uri`

        - `OpenPage`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url?: string | null`

            The URL opened by the model.

            `format: uri`

        - `FindInPage`

          Action type "find_in_page": Searches for a pattern within a loaded page.

          - `pattern: string`

            The pattern or text to search for within the page.

          - `type: "find_in_page"`

            The action type.

            - `"find_in_page"`

          - `url: string`

            The URL of the page searched for the pattern.

            `format: uri`

      - `status: "in_progress" | "searching" | "completed" | 2 more`

        The status of the web search tool call.

        - `"in_progress"`

        - `"searching"`

        - `"completed"`

        - `"failed"`

        - `"incomplete"`

      - `type: "web_search_call"`

        The type of the web search tool call. Always `web_search_call`.

        - `"web_search_call"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseComputerToolCall`

      A tool call to a computer use tool. See the
      [computer use guide](/api/docs/guides/tools-computer-use) 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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "computer_call"`

        The type of the computer call. Always `computer_call`.

        - `"computer_call"`

      - `action?: BetaComputerAction`

        A click action.

        - `Click`

          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`.

            - `"left"`

            - `"right"`

            - `"wheel"`

            - `"back"`

            - `"forward"`

          - `type: "click"`

            Specifies the event type. For a click action, this property is always `click`.

            - `"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`

          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`.

            - `"double_click"`

          - `x: number`

            The x-coordinate where the double click occurred.

          - `y: number`

            The y-coordinate where the double click occurred.

        - `Drag`

          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`.

            - `"drag"`

          - `keys?: Array<string> | null`

            The keys being held while dragging the mouse.

        - `Keypress`

          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`.

            - `"keypress"`

        - `Move`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"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`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll`

          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`.

            - `"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`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions?: BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click`

          A click action.

        - `DoubleClick`

          A double click action.

        - `Drag`

          A drag action.

        - `Keypress`

          A collection of keypresses the model would like to perform.

        - `Move`

          A mouse move action.

        - `Screenshot`

          A screenshot action.

        - `Scroll`

          A scroll action.

        - `Type`

          An action to type in text.

        - `Wait`

          A wait action.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseComputerToolCallOutputItem`

      - `id: string`

        The ID of the computer tool call output.

      - `call_id: string`

        The ID of the computer tool call that produced the output.

      - `output: BetaResponseComputerToolCallOutputScreenshot`

        A computer screenshot image used with the computer use tool.

        - `type: "computer_screenshot"`

          Specifies the event type. For a computer screenshot, this property is
          always set to `computer_screenshot`.

          - `"computer_screenshot"`

        - `file_id?: string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url?: string`

          The URL of the screenshot image.

          `format: uri`

      - `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.

        - `"completed"`

        - `"incomplete"`

        - `"failed"`

        - `"in_progress"`

      - `type: "computer_call_output"`

        The type of the computer tool call output. Always `computer_call_output`.

        - `"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`

      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](/api/docs/guides/conversation-state).

      - `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`.

          - `"summary_text"`

      - `type: "reasoning"`

        The type of the object. Always `reasoning`.

        - `"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`.

          - `"reasoning_text"`

      - `encrypted_content?: string | null`

        The encrypted content of the reasoning item. This is populated by default
        for reasoning items returned by `POST /v1/responses` and WebSocket
        `response.create` requests.

        When streaming, use the completed reasoning item and its
        `encrypted_content` from the `response.output_item.done` event in
        subsequent requests. The `encrypted_content` in
        `response.output_item.added` may be incomplete. This is especially
        important when `store` is `false` or when using Zero Data Retention.

      - `status?: "in_progress" | "completed" | "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `Program`

      - `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`.

        - `"program"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput`

      - `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.

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The type of the item. Always `program_output`.

        - `"program_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseToolSearchCall`

      - `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.

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the tool search call item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "tool_search_call"`

        The type of the item. Always `tool_search_call`.

        - `"tool_search_call"`

      - `agent?: Agent`

        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: 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.

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: Array<BetaTool>`

        The loaded tool definitions returned by tool search.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

            - `"function"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async?: boolean`

          - `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`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `type: "file_search"`

            The type of the file search tool. Always `file_search`.

            - `"file_search"`

          - `vector_store_ids: Array<string>`

            The IDs of the vector stores to search.

          - `filters?: ComparisonFilter | CompoundFilter | null`

            A filter to apply.

            - `ComparisonFilter`

              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

                - `"eq"`

                - `"ne"`

                - `"gt"`

                - `"gte"`

                - `"lt"`

                - `"lte"`

                - `"in"`

                - `"nin"`

              - `value: string | number | boolean | Array<string | number>`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `Array<string | number>`

                  - `string`

                  - `number`

            - `CompoundFilter`

              Combine multiple filters using `and` or `or`.

              - `filters: Array<ComparisonFilter | unknown>`

                Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

                - `ComparisonFilter`

                  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

                    - `"eq"`

                    - `"ne"`

                    - `"gt"`

                    - `"gte"`

                    - `"lt"`

                    - `"lte"`

                    - `"in"`

                    - `"nin"`

                  - `value: string | number | boolean | Array<string | number>`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `Array<string | number>`

                      - `string`

                      - `number`

                - `unknown`

              - `type: "and" | "or"`

                Type of operation: `and` or `or`.

                - `"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`

            Ranking options for search.

            - `hybrid_search?: HybridSearch`

              Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

              - `embedding_weight: number`

                The weight of the embedding in the reciprocal ranking fusion.

              - `text_weight: number`

                The weight of the text in the reciprocal ranking fusion.

            - `ranker?: "auto" | "default-2024-11-15"`

              The ranker to use for the file search.

              - `"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`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `type: "computer"`

            The type of the computer tool. Always `computer`.

            - `"computer"`

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `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.

            - `"windows"`

            - `"mac"`

            - `"linux"`

            - `"ubuntu"`

            - `"browser"`

          - `type: "computer_use_preview"`

            The type of the computer use tool. Always `computer_use_preview`.

            - `"computer_use_preview"`

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

          - `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`.

            - `"web_search"`

            - `"web_search_2025_08_26"`

          - `external_web_access?: boolean`

            Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

          - `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.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `user_location?: UserLocation | null`

            The approximate location of the user. If omitted or null, defaults to the
            United States. To avoid this fallback, pass `{"type": "approximate"}` without
            location fields. To localize results, provide the relevant location fields.

            - `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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type?: "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-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`.

            - `"mcp"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools?: Array<string> | McpToolFilter | null`

            List of allowed tool names or a filter object.

            - `Array<string>`

            - `McpToolFilter`

              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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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](/api/docs/guides/tools-connectors-mcp#connectors).

            This field is deprecated for models released after September 1, 2026.
            Use `server_url` to connect to a remote MCP server, or `tunnel_id` to
            connect through a Secure MCP Tunnel.

            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`

            - `"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" | null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter`

              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`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
                  it will match this filter.

                - `tool_names?: Array<string>`

                  List of allowed tool names.

              - `never?: Never`

                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`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-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.

            `format: uri`

          - `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`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string | CodeInterpreterToolAuto`

            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.

            - `string`

            - `CodeInterpreterToolAuto`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids?: Array<string>`

                An optional list of uploaded files to make available to your code.

                `maxItems: 50`

              - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist`

                  - `allowed_domains: Array<string>`

                    A list of allowed domains when type is `allowlist`.

                    `minItems: 1`

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets?: Array<BetaContainerNetworkPolicyDomainSecret>`

                    Optional domain-scoped secrets for allowlisted domains.

                    `minItems: 1`

                    - `domain: string`

                      The domain associated with the secret.

                      `minLength: 1`

                    - `name: string`

                      The name of the secret to inject for the domain.

                      `minLength: 1`

                    - `value: string`

                      The secret value to inject for the domain.

                      `minLength: 1`, `maxLength: 10485760`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action?: "generate" | "edit" | "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background?: "transparent" | "opaque" | "auto"`

            Allows to set transparency for the background of the generated image(s). 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.5-sunburst` and `gpt-image-2.5-flare`, including their
            `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds.
            Transparent backgrounds are available for supported GPT Image models. For
            `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
            using `transparent`, set the output format to `png` or `webp`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `complexity?: "low" | "medium" | "high"`

            Computation spent planning the image, independently of rendering quality.
            Overrides the outer response's `reasoning.effort` for image generation.
            When omitted, inherits a supported outer reasoning effort or uses the
            image model's configured default.
            For SVG output, controls the reference image, not the SVG author's
            reasoning.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `frame_count?: number`

            Number of GIF frames. Requires `output_format` to be `gif`. Default: 9.

            `minimum: 2`, `maximum: 16`

          - `frame_duration_ms?: number`

            Duration of each GIF frame in milliseconds, rounded to 10 ms.
            Requires `output_format` to be `gif`. Default: 200.

            `minimum: 20`, `maximum: 2000`

          - `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. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.

            - `"high"`

            - `"low"`

          - `input_image_mask?: InputImageMask`

            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" | 9 more`

            The image generation model to use. One of `gpt-image-1-mini`,
            `gpt-image-1.5`, `gpt-image-2`,
            `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
            `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
            `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
            `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
            `gpt-image-2`.

            `gpt-image-1` was shut down on October 23, 2026. Use
            `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

            Deprecated values:

            - "gpt-image-1": GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead.

            - `(string & {})`

            - `"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-2" | 9 more`

              The image generation model to use. One of `gpt-image-1-mini`,
              `gpt-image-1.5`, `gpt-image-2`,
              `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
              `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
              `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`,
              `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default:
              `gpt-image-2`.

              `gpt-image-1` was shut down on October 23, 2026. Use
              `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.

              - `"gpt-image-1"`

              - `"gpt-image-1-mini"`

              - `"gpt-image-2"`

              - `"gpt-image-2-2026-04-21"`

              - `"gpt-image-2.5-sunburst"`

              - `"gpt-image-2.5-sunburst-2026-09-08"`

              - `"gpt-image-2.5-flare"`

              - `"gpt-image-2.5-flare-2026-09-08"`

              - `"gpt-image-2.6-sunburst"`

              - `"gpt-image-2.6-flare"`

              - `"gpt-image-1.5"`

              - `"chatgpt-image-latest"`

          - `moderation?: "auto" | "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression?: number`

            Compression level for the output image. Default: 100.

            `minimum: 0`, `maximum: 100`

          - `output_format?: "png" | "webp" | "jpeg" | 2 more`

            The output format of the generated image. One of `png`, `webp`, `jpeg`,
            `gif`, or `svg`. Default: `png`. GIF and SVG output require a model
            that supports the selected format. GIF output does not support
            partial image streaming (`partial_images` greater than `0`),
            `input_image_mask`, or custom `output_compression`.
            Responses lifecycle events can still be streamed for GIF output.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

            - `"gif"`

            - `"svg"`

          - `partial_images?: number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            `minimum: 0`, `maximum: 3`

          - `quality?: "low" | "medium" | "high" | 3 more`

            The quality of the generated image. The GPT image models support `low`,
            `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
            including their `2026-09-08` snapshots, also support `xhigh` and `max`.
            Default: `auto`.

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

            - `"auto"`

          - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | "auto"`

            The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, 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.

            - `(string & {})`

            - `"1024x1024" | "1024x1536" | "1536x1024" | "auto"`

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

          - `svg?: Svg`

            SVG author model settings. Requires `output_format` to be `svg`.
            When SVG model selection is enabled, omitting this object uses the
            outer response model. Otherwise, the default SVG author is used and
            explicit model overrides are unavailable.

            - `model?: string`

              `minLength: 1`

            - `reasoning?: Reasoning | null`

              Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses.

              - `effort?: "none" | "minimal" | "low" | 4 more`

                Controls how much effort the model should spend on reasoning for this request.

                - `"none"`

                - `"minimal"`

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

        - `LocalShell`

          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`.

            - `"local_shell"`

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `environment?: BetaContainerAuto | BetaLocalEnvironment | BetaContainerReference | null`

            - `BetaContainerAuto`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids?: Array<string>`

                An optional list of uploaded files to make available to your code.

                `maxItems: 50`

              - `memory_limit?: "1g" | "4g" | "16g" | "64g" | null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy?: BetaContainerNetworkPolicyDisabled | BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled`

                - `BetaContainerNetworkPolicyAllowlist`

              - `skills?: Array<BetaSkillReference | BetaInlineSkill>`

                An optional list of skills referenced by id or inline data.

                `maxItems: 200`

                - `BetaSkillReference`

                  - `skill_id: string`

                    The ID of the referenced skill.

                    `minLength: 1`, `maxLength: 64`

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version?: string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill`

                  - `description: string`

                    The description of the skill.

                  - `name: string`

                    The name of the skill.

                  - `source: BetaInlineSkillSource`

                    Inline skill payload

                    - `data: string`

                      Base64-encoded skill zip bundle.

                      `minLength: 1`, `maxLength: 70254592`

                    - `media_type: "application/zip"`

                      The media type of the inline skill payload. Must be `application/zip`.

                      - `"application/zip"`

                    - `type: "base64"`

                      The type of the inline skill source. Must be `base64`.

                      - `"base64"`

                  - `type: "inline"`

                    Defines an inline skill for this request.

                    - `"inline"`

            - `BetaLocalEnvironment`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills?: Array<BetaLocalSkill>`

                An optional list of skills.

                `maxItems: 200`

                - `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: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#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`.

            - `"custom"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

          - `async?: boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `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 | Grammar`

            The input format for the custom tool. Default is unconstrained text.

            - `Text`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar`

              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`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

          - `description: string`

            A description of the namespace shown to the model.

          - `name: string`

            The namespace name used in tool calls (for example, `crm`).

            `minLength: 1`

          - `tools: Array<Function | BetaCustomTool>`

            The function/custom tools available inside this namespace.

            `minItems: 1`

            - `Function`

              - `name: string`

                `minLength: 1`, `maxLength: 128`

              - `type: "function"`

                - `"function"`

              - `allowed_callers?: Array<"direct" | "programmatic"> | null`

                The tool invocation context(s).

                `minItems: 1`

                - `"direct"`

                - `"programmatic"`

              - `async?: boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `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`

              A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

          - `type: "namespace"`

            The type of the tool. Always `namespace`.

            - `"namespace"`

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"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.

            - `"server"`

            - `"client"`

          - `parameters?: unknown`

            Parameter schema for a client-executed tool search tool.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `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`.

            - `"web_search_preview"`

            - `"web_search_preview_2025_03_11"`

          - `search_content_types?: Array<"text" | "image">`

            - `"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.

            - `"low"`

            - `"medium"`

            - `"high"`

          - `user_location?: UserLocation | null`

            The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{"type": "approximate"}` without location fields. To localize results, provide the relevant location fields.

            - `type: "approximate"`

              The type of location approximation. Always `approximate`.

              - `"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](https://en.wikipedia.org/wiki/ISO_3166-1) 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](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `BetaApplyPatchTool`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            `minItems: 1`

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent?: Agent`

        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: string`

        The unique ID of the additional tools item.

      - `role: "unknown" | "user" | "assistant" | 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: Array<BetaTool>`

        The additional tool definitions made available at this item.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/function-calling).

        - `BetaFileSearchTool`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

        - `BetaComputerTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

        - `BetaWebSearchTool`

          Search the Internet for sources related to the prompt. Learn more about the
          [web search tool](/api/docs/guides/tools-web-search).

        - `Mcp`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/api/docs/guides/tools-connectors-mcp).

        - `CodeInterpreter`

          A tool that runs Python code to help generate a response to a prompt.

        - `ProgrammaticToolCalling`

        - `ImageGeneration`

          A tool that generates images using the GPT image models.

        - `LocalShell`

          A tool that allows the model to execute shell commands in a local environment.

        - `BetaFunctionShellTool`

          A tool that allows the model to execute shell commands.

        - `BetaCustomTool`

          A custom tool that processes input using a specified format. Learn more about   [custom tools](/api/docs/guides/function-calling#custom-tools)

        - `BetaNamespaceTool`

          Groups function/custom tools under a shared namespace.

        - `BetaToolSearchTool`

          Hosted or BYOT tool search configuration for deferred tools.

        - `BetaWebSearchPreviewTool`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `BetaApplyPatchTool`

          Allows the assistant to create, delete, or update files using unified diffs.

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseCompactionItem`

      A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

      - `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`.

        - `"compaction"`

      - `agent?: Agent`

        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`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"generating"`

        - `"failed"`

      - `type: "image_generation_call"`

        The type of the image generation call. Always `image_generation_call`.

        - `"image_generation_call"`

      - `action?: "generate" | "edit" | "auto" | null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background?: "transparent" | "opaque" | "auto" | null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error?: Error`

        Details of a moderation failure, when available.

        - `code: string | null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string | null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details?: ModerationDetails`

          Public details for a `moderation_blocked` error, when available.

          - `categories: Array<string>`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" | "output" | "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format?: "png" | "webp" | "jpeg" | 2 more | null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

        - `"gif"`

        - `"svg"`

      - `quality?: "low" | "medium" | "high" | 3 more | null`

        The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

        - `"auto"`

      - `revised_prompt?: string | null`

        The prompt that was used after any model prompt rewriting.

      - `size?: (string & {}) | "1024x1024" | "1024x1536" | "1536x1024" | null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `(string & {})`

        - `"1024x1024" | "1024x1536" | "1536x1024"`

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

      - `svg_usage?: SvgUsage`

        - `input_tokens: number`

        - `model: string`

        - `output_tokens: number`

        - `reasoning_tokens: number`

        - `total_tokens: number`

    - `BetaResponseCodeInterpreterToolCall`

      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 | Image> | null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs`

          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`.

            - `"logs"`

        - `Image`

          The image output from the code interpreter.

          - `type: "image"`

            The type of the output. Always `image`.

            - `"image"`

          - `url: string`

            The URL of the image output from the code interpreter.

            `format: uri`

      - `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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"interpreting"`

        - `"failed"`

      - `type: "code_interpreter_call"`

        The type of the code interpreter tool call. Always `code_interpreter_call`.

        - `"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`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: Action`

        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`.

          - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "local_shell_call"`

        The type of the local shell call. Always `local_shell_call`.

        - `"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`

      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`.

        - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseFunctionShellToolCall`

      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`

        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 | BetaResponseContainerReference | null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "shell_call"`

        The type of the item. Always `shell_call`.

        - `"shell_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The ID of the entity that created this tool call.

    - `BetaResponseFunctionShellToolCallOutput`

      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 | Exit`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit`

            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`.

              - `"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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "shell_call_output"`

        The type of the shell call output. Always `shell_call_output`.

        - `"shell_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

    - `BetaResponseApplyPatchToolCall`

      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 | DeleteFile | UpdateFile`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile`

          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.

            - `"create_file"`

        - `DeleteFile`

          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.

            - `"delete_file"`

        - `UpdateFile`

          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.

            - `"update_file"`

      - `status: "in_progress" | "completed"`

        The status of the apply patch tool call. One of `in_progress` or `completed`.

        - `"in_progress"`

        - `"completed"`

      - `type: "apply_patch_call"`

        The type of the item. Always `apply_patch_call`.

        - `"apply_patch_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by?: string`

        The ID of the entity that created this tool call.

    - `BetaResponseApplyPatchToolCallOutput`

      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`.

        - `"completed"`

        - `"failed"`

      - `type: "apply_patch_call_output"`

        The type of the item. Always `apply_patch_call_output`.

        - `"apply_patch_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"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`

      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`.

        - `"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?: BetaMcpToolCallError | null`

        The error from the tool call, if any.

        - `McpProtocolError`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `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`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `McpListTools`

      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`.

        - `"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`

      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`.

        - `"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`

      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`.

        - `"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`

      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`.

        - `"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.

      - `async?: boolean`

        Whether the custom tool call runs asynchronously.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace?: string`

        The namespace of the custom tool being called.

    - `BetaResponseCustomToolCallOutputItem extends BetaResponseCustomToolCallOutput`

      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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `created_by?: string`

        The identifier of the actor that created the item.

  - `output_index: number`

    The index of the output item that was added.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.output_item.added"`

    The type of the event. Always `response.output_item.added`.

    - `"response.output_item.added"`

  - `agent?: Agent | null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Output Item Done Event

- `BetaResponseOutputItemDoneEvent`

  Emitted when an output item is marked done.

  - `item: BetaResponseOutputItem`

    The output item that was marked done.

    - `BetaResponseOutputMessage`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: Array<BetaResponseOutputText | BetaResponseOutputRefusal>`

        The content of the output message.

        - `BetaResponseOutputText`

          A text output from the model.

          - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

            The annotations of the text output.

            - `FileCitation`

              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 in the output text at which to insert the file citation.

              - `type: "file_citation"`

                The type of the file citation. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation`

              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_citation"`

              - `url: string`

                The URL of the web resource.

                `format: uri`

            - `ContainerFileCitation`

              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`.

                - `"container_file_citation"`

            - `FilePath`

              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`.

                - `"file_path"`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

          - `logprobs?: Array<Logprob>`

            - `token: string`

            - `bytes: Array<number>`

            - `logprob: number`

            - `top_logprobs: Array<TopLogprob>`

              - `token: string`

              - `bytes: Array<number>`

              - `logprob: number`

        - `BetaResponseOutputRefusal`

          A refusal from the model.

          - `refusal: string`

            The refusal explanation from the model.

          - `type: "refusal"`

            The type of the refusal. Always `refusal`.

            - `"refusal"`

      - `role: "assistant"`

        The role of the output message. Always `assistant`.

        - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "message"`

        The type of the output message. Always `message`.

        - `"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" | "final_answer" | 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.

        - `"commentary"`

        - `"final_answer"`

    - `BetaResponseFileSearchToolCall`

      The results of a file search tool call. See the
      [file search guide](/api/docs/guides/tools-file-search) 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`,

        - `"in_progress"`

        - `"searching"`

        - `"completed"`

        - `"incomplete"`

        - `"failed"`

      - `type: "file_search_call"`

        The type of the file search tool call. Always `file_search_call`.

        - `"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.

          - `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.

          `format: float`

        - `text?: string`

          The text that was retrieved from the file.

    - `BetaResponseFunctionToolCall`

      A tool call to run a function. See the
      [function calling guide](/api/docs/guides/function-calling) 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`.

        - `"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.

      - `async?: boolean`

        Whether the function tool call runs asynchronously.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseFunctionToolCallOutputItem`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string | Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `string`

        - `Array<BetaResponseInputText | BetaResponseInputImage | BetaResponseInputFile>`

          - `BetaResponseInputText`

            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`.

              - `"input_text"`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputImage`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `detail: BetaImageDetail`

              The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

              - `"low"`

              - `"high"`

              - `"auto"`

              - `"original"`

            - `type: "input_image"`

              The type of the input item. Always `input_image`.

              - `"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.

              `format: uri`

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFile`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"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`.

              - `"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.

              `format: uri`

            - `filename?: string`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

              Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl?: "30m" | "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "function_call_output"`

        The type of the function tool call output. Always `function_call_output`.

        - `"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.

      - `call_id?: string`

        The unique ID of the function tool call generated by the model.

      - `caller?: Direct | Program | null`

        The execution context that produced this tool call.

        - `Direct`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

            `minLength: 1`, `maxLength: 64`

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by?: string`

        The identifier of the actor that created the item.

      - `name?: string`

        The name of the tool that produced the output.

      - `namespace?: string`

        The namespace of the tool that produced the output.

    - `AgentMessage`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: Array<BetaResponseInputText | BetaResponseOutputText | Text | 7 more>`

        Encrypted content sent between agents.

        - `BetaResponseInputText`

          A text input to the model.

        - `BetaResponseOutputText`

          A text output from the model.

        - `Text`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText`

          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`.

            - `"summary_text"`

        - `ReasoningText`

          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`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal`

          A refusal from the model.

        - `BetaResponseInputImage`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot`

          A screenshot of a computer.

          - `detail: BetaImageDetail`

            The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.

          - `file_id: string | null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string | null`

            The URL of the screenshot image.

            `format: uri`

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint?: PromptCacheBreakpoint`

            Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

            - `ttl?: "30m" | "12h"`

              The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

              - `"30m"`

              - `"12h"`

        - `BetaResponseInputFile`

          A file input to the model.

        - `EncryptedContent`

          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`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall`

      - `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.

        - `"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`.

        - `"multi_agent_call"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput`

      - `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.

        - `"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>`

        Text output returned by the multi-agent action.

        - `annotations: Array<FileCitation | URLCitation | ContainerFileCitation | FilePath>`

          The annotations of the text output.

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

        - `logprobs?: Array<Logprob>`

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseFunctionWebSearch`

      The results of a web search tool call. See the
      [web search guide](/api/docs/guides/tools-web-search) for more information.

      - `id: string`

        The unique ID of the web search tool call.

      - `action: Search | OpenPage | FindInPage`

        An object describing the specific action taken in this web search call.
        Includes details on how the model used the web (search, open_page, find_in_page).

        - `Search`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries?: Array<string>`

            The search queries.

          - `query?: string`

            The search query.

          - `sources?: Array<Source>`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

              `format: uri`

        - `OpenPage`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url?: string | null`

            The URL opened by the model.

            `format: uri`

        - `FindInPage`

          Action type "find_in_page": Searches for a pattern within a loaded page.

          - `pattern: string`

            The pattern or text to search for within the page.

          - `type: "find_in_page"`

            The action type.

            - `"find_in_page"`

          - `url: string`

            The URL of the page searched for the pattern.

            `format: uri`

      - `status: "in_progress" | "searching" | "completed" | 2 more`

        The status of the web search tool call.

        - `"in_progress"`

        - `"searching"`

        - `"completed"`

        - `"failed"`

        - `"incomplete"`

      - `type: "web_search_call"`

        The type of the web search tool call. Always `web_search_call`.

        - `"web_search_call"`

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseComputerToolCall`

      A tool call to a computer use tool. See the
      [computer use guide](/api/docs/guides/tools-computer-use) 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.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "computer_call"`

        The type of the computer call. Always `computer_call`.

        - `"computer_call"`

      - `action?: BetaComputerAction`

        A click action.

        - `Click`

          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`.

            - `"left"`

            - `"right"`

            - `"wheel"`

            - `"back"`

            - `"forward"`

          - `type: "click"`

            Specifies the event type. For a click action, this property is always `click`.

            - `"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`

          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`.

            - `"double_click"`

          - `x: number`

            The x-coordinate where the double click occurred.

          - `y: number`

            The y-coordinate where the double click occurred.

        - `Drag`

          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`.

            - `"drag"`

          - `keys?: Array<string> | null`

            The keys being held while dragging the mouse.

        - `Keypress`

          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`.

            - `"keypress"`

        - `Move`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"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`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll`

          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`.

            - `"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`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions?: BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click`

          A click action.

        - `DoubleClick`

          A double click action.

        - `Drag`

          A drag action.

        - `Keypress`

          A collection of keypresses the model would like to perform.

        - `Move`

          A mouse move action.

        - `Screenshot`

          A screenshot action.

        - `Scroll`

          A scroll action.

        - `Type`

          An action to type in text.

        - `Wait`

          A wait action.

      - `agent?: Agent | null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseComputerToolCallOutputItem`

      - `id: string`

        The ID of the computer tool call output.

      - `call_id: string`

        The ID of the computer tool call that produced the output.

      - `output: BetaResponseComputerToolCallOutputScreenshot`

        A computer screenshot image used with the computer use tool.

        - `type: "computer_screenshot"`

          Specifies the event type. For a computer screenshot, this property is
          always set to `computer_screenshot`.

          - `"computer_screenshot"`

        - `file_id?: string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url?: string`

          The URL of the screenshot image.

          `format: uri`

      - `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.

        - `"completed"`

        - `"incomplete"`

        - `"failed"`

        - `"in_progress"`

      - `type: "computer_call_output"`

        The type of the computer tool call output. Always `computer_call_output`.

        - `"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`

      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](/api/docs/guides/conversation-state).

      - `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`.

          - `"summary_text"`

      - `type: "reasoning"`

        The type of the object. Always `reasoning`.

        - `"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`.

          - `"reasoning_text"`

      - `encrypted_content?: string | null`

        The encrypted content of the reasoning item. This is populated by default
        for reasoning items returned by `POST /v1/responses` and WebSocket
        `response.create` requests.

        When streaming, use the completed reasoning item and its
        `encrypted_content` from the `response.output_item.done` event in
        subsequent requests. The `encrypted_content` in
        `response.output_item.added` may be incomplete. This is especially
        important when `store` is `false` or when using Zero Data Retention.

      - `status?: "in_progress" | "completed" | "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `Program`

      - `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`.

        - `"program"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput`

      - `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.

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The type of the item. Always `program_output`.

        - `"program_output"`

      - `agent?: Agent`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `BetaResponseToolSearchCall`

      - `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.

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the tool search call item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: "tool_search_call"`

        The type of the item. Always `tool_search_call`.

        - `"tool_search_call"`

      - `agent?: Agent`

        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: 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.

        - `"server"`

        - `"client"`

      - `status: "in_progress" | "completed" | "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: Array<BetaTool>`

        The loaded tool definitions returned by tool search.

        - `BetaFunctionTool`

          Defines a function in your own code the model can choose to call. Learn more about [function calling](/api/docs/guides/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`.

            - `"function"`

          - `allowed_callers?: Array<"direct" | "programmatic"> | null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async?: boolean`

          - `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`

          A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](/api/docs/guides/tools-file-search).

          - `type: "file_search"`

            The type of the file search tool. Always `file_search`.

            - `"file_search"`

          - `vector_store_ids: Array<string>`

            The IDs of the vector stores to search.

          - `filters?: ComparisonFilter | CompoundFilter | null`

            A filter to apply.

            - `ComparisonFilter`

              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

                - `"eq"`

                - `"ne"`

                - `"gt"`

                - `"gte"`

                - `"lt"`

                - `"lte"`

                - `"in"`

                - `"nin"`

              - `value: string | number | boolean | Array<string | number>`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `Array<string | number>`

                  - `string`

                  - `number`

            - `CompoundFilter`

              Combine multiple filters using `and` or `or`.

              - `filters: Array<ComparisonFilter | unknown>`

                Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.

                - `ComparisonFilter`

                  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

                    - `"eq"`

                    - `"ne"`

                    - `"gt"`

                    - `"gte"`

                    - `"lt"`

                    - `"lte"`

                    - `"in"`

                    - `"nin"`

                  - `value: string | number | boolean | Array<string | number>`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `Array<string | number>`

                      - `string`

                      - `number`

                - `unknown`

              - `type: "and" | "or"`

                Type of operation: `and` or `or`.

                - `"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`

            Ranking options for search.

            - `hybrid_search?: HybridSearch`

              Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.

              - `embedding_weight: number`

                The weight of the embedding in the reciprocal ranking fusion.

              - `text_weight: number`

                The weight of the text in the reciprocal ranking fusion.

            - `ranker?: "auto" | "default-2024-11-15"`

              The ranker to use for the file search.

              - `"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`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `type: "computer"`

            The type of the computer tool. Always `computer`.

            - `"computer"`

        - `BetaComputerUsePreviewTool`

          A tool that controls a virtual computer. Learn more about the [computer tool](/api/docs/guides/tools-computer-use).

          - `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.

            - `"windows"`

            - `"mac"`

            - `"linux"`

            - `"ubuntu"`

            - `"browser"`

          - `type: "computer_use_preview"`

            The type of the computer use tool. Always `computer_use_preview`.

            - `"computer_use_preview